INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Cuboids around folded paper There is no backstory to this question; I just thought of it. Take a piece of origami paper, a square with area 1. Then fold the paper in any way possible without cutting. There is no limit to the number of folds. Then find the smallest possible cuboid that would contain the entirety of the folded paper. What is the largest possible volume of the cuboid? In what way(s) could the paper be folded into to create a cuboid of this volume? And how would other problems similarily relating to folded paper be solved?
I would claim it is "obvious" you only want one fold. More folds make the package smaller. If you fold along the diagonal you have to have a segment of length $\sqrt 2$ fit in the cuboid. A right angle fold lets you use cuboids of $\sqrt 2 \times \frac {\sqrt 2}2 \times \frac {\sqrt 2}2$ with volume $\frac {\sqrt 2}2$ or $\sqrt 2 \times 1 \times \frac 12$ with the same volume. I would suggest that is the best, and invite others to find better.
stackexchange-math
{ "answer_score": 0, "question_score": 2, "tags": "geometry, optimization, volume, origami" }
IDA Pro. How to select ARM or THUMB mode when using "Make Code" command How to select ARM or THUMB mode when using "Make Code" command? I have ARM binary and I want to specify ARM or THUMB code making manually in IDA, but how to do this?
When IDA first analyzes the binary, it detects which parts of the code are ARM, and which part are THUMB instructions. Then, it creates segments according to the analysis, and marks each segment as a "THUMB" or "ARM" segment. Press `ctrl`-`G` to see which segment has which type (Value 00=ARM, 01=THUMB). Press `alt`-`G` to change the designation of the current segment (the one the cursor is in right now). If you aren't satisfied with what the analyzer created, use the Edit/Segments submenus to move, resize, create, or delete them.
stackexchange-reverseengineering
{ "answer_score": 6, "question_score": 1, "tags": "ida, disassembly, arm" }
How to build SPEAK component in Sitecore? I'm trying to create a simple SPEAK component using Sitecore 7.5 and SPEAK 1.2. The documentation seems slim or outdated on the subject. I tried following this article, but there are lots of holes in it: < Can anyone recommend any steps to create a JavaScript SPEAK component?
Jakob Chrisensen has a good set of video tutorials on his YouTube! channel: <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, mvvm, sitecore, sitecore7, sitecore speak ui" }
C Producer/Consumer application getting environment variables with getenv() not working I'm writing an application with Producer who makes and sends messages and Consumer who is getting the messages. I have to set environment variable in producer app and read it in consumer app. In producer app I did this command putenv("MSG_KEY=15"); And in the consumer app i tried to get the variable like this char *z=getenv("MSG_KEY"); But it doesn't return any value (I get nil value). If I write the same command in producer it works if I use `putenv()` few lines before. I think the problem is that it sets variable only locally so I cannot access it from another program but I don't know how to solve it. Don't know if it matters but I'm using Linux system.
Environment variables are private to a process. You cannot set them in one process and expect to read them in another process. The only time you can communicate anything via environment variables to another process is from a parent process to a child, and _only_ at the time that the parent spawns the child. The parent may copy, modify, add, or remove environment variables when it spawns the child. From then on they become entirely separated. Change that one process makes to the variables, is not visible to the other.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -1, "tags": "c, linux, environment variables, getenv" }
Warning: Undefined array key WP PHP I have an error message in my Wordpress website in a plugin that i have installed. Error message is "Warning: Undefined array key in line 163" The line looks like that : $uip = $all_plugins["uipress/uipress.php"]; Can some one help me please i don't know how to fix this. Thanks in advance.
To skip this warning use a "@" before the array variable (it's not recommended). $uip = @$all_plugins["uipress/uipress.php"]; Or You can find out the place from where the array was created or generated. In that case, maybe the array key is a file name ("uipress/uipress.php"). If the file is missing then you will see this warning. Thank you
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, arrays, wordpress, key, undefined" }
Data Encryption and Internet Speed I was wondering, does encryption used over the Internet in a web browser noticeably slow down the speed of data transfer? I keep reading about stuff like HTTPS, but I always wonder if there's a speed disadvantage in securing your data over HTTPS, encrypted instant messages, or even an encrypted LAN VNC connection.
Generally any encryption or decryption process takes longer than clear messages;but if that encryption approach is supported by source and destination over network we can say it takes less time to proceed.
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "internet, encryption, speed, https, browser" }
$\ell^1$ predual with no $c_0$ quotient? > **Question:** Does there exist an isomorphic predual of $\ell^1$, which does not have a quotient isomorphic to $c_0$? Thanks in advance. * * * Edit: The answer is no. Let $X$ be a Banach space such that $X^*$ is isomorphic to $\ell^1$. If there didn't exist any surjective bounded $T:X\to c_0$, then $X$ would be a Grothendieck space. Being separable, $X$ would be reflexive. It is awkward to answer your own question in a few hours after you post it. Please accept my apologies, I will delete this post in a couple of days.
In my weak$^*$ basic sequences paper with Rosenthal we proved that if $\ell_1$ embeds into $X^*$ and $X$ is separable, then $c_0$ is isomorphic to a quotient of $X$.
stackexchange-mathoverflow_net_7z
{ "answer_score": 2, "question_score": 2, "tags": "fa.functional analysis, banach spaces" }
Android fragment manager fragment change listener When replacing a fragment using a `FragmentManager` is it possible to add a listener for when the event is completed? So myFragmentManager .beginTransaction() .replace(R.id.fragmentContainer, fragment, FRAGMENT_TAG) .commit() can I add a listener to `myFragmentManager` so that I know when the fragment has been replaced?
You can implement following listener in your activity class to watch for changes to the fragment back stack. public static interface FragmentManager.OnBackStackChangedListener later you need to register this listener to the fragment manager with the help of addOnBackStackChangedListener (FragmentManager.OnBackStackChangedListener listener) **Links for your reference** < <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 12, "tags": "android" }
How to tell what OpenSSL version was built with FFMPEG When I do `ffmpeg -version`, I get this: ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.17) configuration: --enable-openssl libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 It says `--enable-openssl`, but how can I check what version of SSL was it specifically built with?
You can see which version it **links** to: $ ldd /usr/bin/ffmpeg | grep ssl libssl.so.1.0.0 => /usr/lib/i386-linux-gnu/libssl.so.1.0.0 (0xb5ae8000) And then you can check with whatever package manager you distro uses what version of openssl this library belongs to.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "ffmpeg, ssl" }
Detect how much of a canvas element is filled in HTML5 I just started with HTML5, and I have a paint program where a user can fill in the canvas by clicking the mouse button and dragging the cursor around like a pen. I want to be able to figure out what percentage of the canvas is currently filled with the pen. How could I do this? Here's my current code on Gist Thanks!
You can get all the raw pixel values of the `<canvas>` using getImageData() call < Then you loop through this pixel data in a Javascript loop and count all pixels which are not of the background color. The percent of filled in canvas is completed = filledInPixels / (canvas.width * canvas.height) Note that `getImageData()` call is extremely slow and you might want to call it only like once in a second.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "html5 canvas, getimagedata" }
How to import Eviews data into pandas I am unfortunately only given datasets for my time series course as an Eviews wf1 file. How can I import this into pandas? I cannot find an answer in pandas online documentation.
A work-around solution I have just found is to: (1) Download gretl, an open-source econometrics software, see < (2) open the Eviews file into Gretl (3) export from Gretl as csv.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "pandas, statistics, time series, eviews" }
Persistently save chrome devtools settings **My Goal** : Persistently save settings of google-chrome-devtools settings for console. Specifically the "User messages only" option. **Problem** : If I check that option, close and open the devtools again, the options is unchecked again. So the changes I make are not persisted. **Question** : Is that behavior normal? Thanks for your time (Y) :-)
It's a bug. Star this issue to give it more attention: < Update: It's not a bug per se, the team intended for it to work like this. But I think it makes more sense for the setting to persist.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "google chrome, google chrome devtools" }
Define a matrix template with using I want to define a matrix with `using` keyword to use templates. #include <vector> template <typename T> using row = std::vector<T>; template<typename T> using Mat = std::vector<row> >; I think this definition is ok, but I don't know how to instantiate now the matrix. I tried with `Mat<int> m(3, row<int>(3));`, but It wont work. Any clues on how to instantiate it?
You have small typos, it should be template <typename T> using row = std::vector<T>; template<typename T> using Mat = std::vector<row<T>>; int main() { [[maybe_unused]] Mat<int> m(3, row<int>(3)); } Demo
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "c++" }
Hiding the ellipsis button (more button) in CommandBar in UWP (Windows 10) I am using a commandbar in my project (UWP), however, I realized there is an ellipsis button in the commandbar by default. Is there any way where by I can hide/remove it? ![Ellipsis button]( Here's my code: <Page.BottomAppBar> <CommandBar Background="{StaticResource CitiKioskBackgroundBrush}" IsOpen="True" IsSticky="True" Name="appBarName" Visibility="Collapsed" > <CommandBar.PrimaryCommands> <AppBarButton Name="SettingAppBarButton" Icon="Setting" Label="Settings" Foreground="White" Click="SettingAppBarButton_Click"/> </CommandBar.PrimaryCommands> </CommandBar> </Page.BottomAppBar>
You can use the `OverflowButtonVisibility` property: `<CommandBar OverflowButtonVisibility="Collapsed"></CommandBar>`
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 6, "tags": "uwp, ellipsis, commandbar" }
Rails Button to Update Attribute Not Working I have a link that looks like this in the object's show view: <%= link_to "Approve", object_path(@object, status: true), method: :put, confirm: "Are you sure?", class: 'button' %> The update action in the controller is standard and the object's regular edit form works just fine. But for some reason, this link isn't updating the boolean field to true... Is there something that I did wrong with this link? EDIT: Update Section of Controller def update @object = Object.find_by_certain_field(params[:id]) if @object.update_attributes(params[:object]) flash[:success] = "Object Updated" redirect_to @object else render 'edit' end end
`object_path(@object, status: true)` causes `params[:status]` to be true and not `params[:object][:status]` as you wish, thus not updating the object with `@object.update_attributes(params[:object])` If you want to keep using the current code pattern just add parmas[:object] ||= {} params[:object][:status] = params[:status] if params[:status] before if @object.update_attributes(params[:object]) and everything should be fine. Otherwise I'd avise you to make a form for this update call: <% form_for @object, :method => :put do |f| %> <%= f.hidden_field :status, :value => true %> <%= f.submit "Approve" %> <% end %>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, ruby on rails 3" }
Renewing the Developer Program Membership after it expires My Developer Program Membership ( _along with the iOS Distribution Certificate - it seems_ ) expires in a couple of weeks. About a week ago, Apple sent me an email implying that I must renew the certificate before it expires in one month. However, I expect to submit some apps in at least a couple of months, and I would prefer to wait until this time to renew my certificate. Can I do this long after it has expired, or must I renew it before the expiration date? ![enter image description here]( ![enter image description here](
You may renew your Developer account whenever you want. Just keep in mind: All your 'live' apps in the App Store will go offline when your membership expires. When you renew the Developer Account you can bring the apps back to the store again without setting up / needing a review proces. I had the same with a customer of mine, their membership expired for several months (they just didn't care enough) and they renewed the account without any hassle.
stackexchange-apple
{ "answer_score": 7, "question_score": 4, "tags": "applications, xcode, development, developer program, certificate" }
What is a selector engine? I've seen news of John Resig's fast new selector engine named Sizzle pop up in quite a few places, but I don't know what a selector engine is, nor have any of the articles given an explanation of what it is. I know Resig is the creator of jQuery, and that Sizzle is something in Javascript, but beyond that I don't know what it is. So, what is a selector engine? Thanks!
A selector engine is used to query a page's DOM for particular elements, based on some sort of query (usually CSS syntax or similar). For example, this jQuery: $('div') Would search for and return all of the <div> elements on the page. It uses jQuery's selector engine to do that. Optimizing the selector engine is a big deal because almost every operation you perform with these frameworks is based on some sort of DOM query.
stackexchange-stackoverflow
{ "answer_score": 52, "question_score": 32, "tags": "javascript, jquery, glossary, resig" }
How to get list of child nodes? Below, I have attached an image with some console output. What I would like to do is, grab all the numbered nodes (so, `0` and `1`, but there could be more or less), and put them into an array (like `[0, 1]`). Is this possible? ![enter image description here](
Use .toArray(). var listOfNodes = $list.toArray(); **EDIT:** As was pointed out by SterlingArcher, there's a better option in ES6 in the form of Array.from. var listOfNodes = Array.from($list);
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, jquery, console" }
What should be changed in the regex in order to allow only alphabets with spaces anywhere? @Pattern(regexp="^[a-zA-Z0-9]+$",message="Username must be alphanumeric with no spaces") I would like to change the regex in order to allow alphabets with spaces any where.
Then add `\s` to your character class ^[a-zA-Z0-9\s]+$ `\s` signifies space in regex. You can use a a literal space also like `^[a-zA-Z0-9 ]+$`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "regex, spring, spring mvc, annotations" }
Caching / Mapping strategy for standalone java application I have a SQL Table with disk size ~50 GB. The table is read-only and thus, ideal for caching. For faster and frequent look ups, what would be ideal - 1. Java 8 Hash Map. 2. Memcached. 3. Hibernate EH Cache. or anything better ? (provided 200 GB of main memory is available for JVM).
You can start trying Guava cache (Google Core Libraries for Java 1.6+) > Generally, the Guava caching utilities are applicable whenever: > > * You are willing to spend some memory to improve speed. > * You expect that keys will sometimes get queried more than once. > * Your cache will not need to store more data than what would fit in RAM. (Guava caches are local to a single run of your application. > They do not store data in files, or on outside servers. > > If this does not fit your needs, consider a tool like Memcached.) > >
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java, caching, hashmap, memcached, ehcache" }
Derivative of a multivariable function at a point I'm facing this problem of finding the derivative of a function $f(x,y)= (\sin^2 x \cdot \cos y, xy)$ at the point $(\pi,\pi/2).$ The problem is that I don't know if I should calculate the partial derivative and then plug in the points or find the directional derivative or what exactly because it's the first time to find such function with two components.
You can calculate the partial derivatives, and see that they`re continous. This means the function is differentiable . $$f_1(x,y)=sin^2(x)cos(y)$$ $$f_2(x,y)=xy$$ $\frac {\partial f_1} {\partial x}=cos(y)2sin(x)cos(x), \frac {\partial f_1} {\partial y}=-sin^2(x)sin(y)$ $\frac {\partial f_2} {\partial x}=y, \frac {\partial f_2} {\partial y}=x$. So the derivative is a $2x2$ matrix $D_f(v)=\frac {\partial f_i} {\partial x_j}$. (Use $x_1=x$ and $x_2=y$ for simplicity of writing)
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "multivariable calculus, derivatives, partial derivative" }
How to create a minimal and complete IAM roles/permissions given requirements? IAM gives developers controls to limit which users can access specific services, the kinds of action they can perform, and which resources are available (VMs, database instances, etc). Given a list of resources, API calls, and services used, how does one go about creating a minimal (but sufficiently free) IAM role or user for this project? * * * Inspired by Exelian's reponse to Jiew Meng in Is there anyway to determine what IAM permissions I actually need for a CloudFormation template?: > Jiew Meng: "I guess, it should be possible for there to be some parser that given a CloudFormation template can determine the minimum set of permissions it" > > Exelian: "I discussed this with multiple AWS engineers at a conference and their answer was: "not really". Best way is to assign nothing and see what errors it throws."
"Not really" still applies. You have to hand-craft your roles and policies and test them. But, there are some tools to help: * AWS Policy Generator and AWS Identity and Access Management Template Snippets to get you started. * Complete AWS IAM Reference to check the fine detail. * Then, peer review and testing.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "amazon web services, amazon iam" }
Converting from decimal to binary digits upto n bits I am converting decimal numbers to n binary bits, then separate it into n binary bits and then assign it to x by x grid. For example:- 325 -> 101000101 -> 1,0,1,0,0,0,1,0,1 I have written the following code, please help me figure out what algorithm shall I use for this task. Thanks! int binary_num[100]; int separate_num[100]; for (int i = 0; i<pow(2,4); i++) { int j = 0; int n = i; while(n>0) { binary_num[j] = n%2; j++; n /= 2; } for (int k = j-1; j>=0; j--) { int h = 0; separate_num[h] = binary_num[k]; h++; } } return 0;
Use bitset to find the required number of bits and you can store it in array then print in grid
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "c++, algorithm" }
How to automatically restart a linux background process if it fails? I have a process which is executed by init.d script on the background. Eg: case "$1" in start) /bin/myprocess & stop) killall myprocess restart) killall myprocess /bin/myprocess & esac In certain conditions, myprocess can fail and return. Is there any (standard) way how to detect its fail and restart in automatically?
The easiest way would be to add it to /etc/inittab, which is designed to do this sort of thing: > **respawn** If the process does not exist, start the process. Do not wait for its termination (continue scanning the /etc/inittab file). Restart the process when it dies. If the process exists, do nothing and continue scanning the /etc/inittab file. For example, you could do this: # Run my stuff myprocess:2345:respawn:/bin/myprocess
stackexchange-superuser
{ "answer_score": 18, "question_score": 47, "tags": "linux, bash, process, daemon" }
Are path traversals attacks possible with invalid directories between? Let's say I can control the variable `$path` and the full path is generated as follows: $full_path = "./valid_dir/docs/" . trim($path) ; readfile($full_path) ; where **`docs`** a non existent dir in the path. Is it still possible ,with some trick perhaps to ignore docs, to perform a path traversal attack ?
> Is it still possible ,with some trick perhaps to ignore docs, to perform a path traversal attack ? Yes, it's pretty simple, just use `../` and it will be normalized before the file is opened (on *nix systems anyway, I don't know for sure on Windows). Something like this would work. $path = '../test.txt'; $full_path = "./valid_dir/docs/" . trim($path); readfile($full_path);
stackexchange-security
{ "answer_score": 1, "question_score": 0, "tags": "php, unix" }
Unable to generate keystore and release cocos2dx project I tried to generate the keystore however, Seems like it's not working. I'm not used to create the apk and release via terminal. So if I may be doing something wrong, it would be great if you can tell me some hints or samples. My location of the project /Users/myself/Desktop/CocoFolder/MyGame Tried the following code. But not sure what to enter. keytool -genkey -v -keystore /Users/myself/Desktop/CocoFolder/MyGame -alias MyGame -validity 10000 Planning to use this to create a release apk. cocos run -s/Users/myself/Desktop/CocoFolder/MyGame -p android –android-studio -m release
Two questions : 1. How I generate keystore that required to sign your apk How can I create a keystore? 2. Done you've now your keystore with specified alias name, Now you want to generate signed apk from your keystore. Put this into`~/.gradle/gradle.properties` RELEASE_STORE_FILE={path to your keystore} RELEASE_STORE_PASSWORD=***** RELEASE_KEY_ALIAS=***** RELEASE_KEY_PASSWORD=***** After that, Build --> Select Build Variant --> Set release for your game and build.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "android, cocos2d x, cocos2d x 3.0" }
how to sed for pattern before and after match I currently am trying to get specific parameters from a url. My url looks like: ` I want just `redhat/ubi/ubi7/7.8` I can get `redhat/ubi/ubi7/7.8/2020-02-14T222203.548_2868/ubi7-7.8.tar` by doing, `echo | sed 's|.*/container-scan-reports/||'` Thus I want to remove `/2020-02-14T222203.548_2868/ubi7-7.8.tar` I also would like to change the `/` to a `-` so that I have `redhat-ubi-ubi7-7.8`
With GNU `sed`: Get the 4 following path elements after `.*/container-scan-reports/` and replace all `/` with `-`: url=' echo "$url" | sed -E 's|.*/container-scan-reports/(([^/]*/){3}[^/]*).*|\1|;s|/|-|g' Or you could get everything after `.*/container-scan-reports/`, but not the last two path elements: echo "$url" | sed -E 's|.*/container-scan-reports/(.*)/[^/]*/[^/]*|\1|;s|/|-|g'
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "regex, bash, sed" }
Adobe flash CC Unable to select other text type other than dynamic text !Screenshot of the program Hi guys, i am facing problems with the adobe flash program, currently the input and static text is greyed out. Any advice? as dynamic text does not allow users to enter after exporting. Thanks!!
It is because you are working in the new HTML Canvas document type for Flash CC. These features are greyed out because they are not available in this document file type. You need to create an ActionScript 3 Fla document type and these features will be enabled. To do this go to file from the pull down menu pick New and select ActionScript 3 for the document type. It is right below HTML Canvas.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "flash, adobe, flash cc" }
Mathematica doesn't give an answer to what wolframalpha answers I'm trying to calculate > Sum[(1/n)^(n), {n, 1, Infinity}] But mathematica outputs the input directly. What is the problem? when I put the same expression into wolframalpha, it gives me the answer but not mathematica.
Mathematica `Sum` just returns input means MMA doesn't find an analytical answer The sum seems to be convergent SumConvergence[(1/n)^(n), n] (* True *) Numerically result NSum[(1/n)^(n), {n, 1, Infinity}] (*1.29129*) That's the result from WolframAlpha!
stackexchange-mathematica
{ "answer_score": 6, "question_score": 0, "tags": "calculus and analysis" }
ORA-00905 : missing keyword I am facing an error message: > ORA-00905 : missing keyword I guess that it is related to the `case` expression listed below. Any suggestions to resolve it? This is the code : case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_CAT_T24 as CATEGORY1 else 0 end, case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_ACC_NAM as NAME else '' end, case when M1.M_GL_CAT_T24 > 50000 then M1.M_GL_CAT_T24 as PL_CATEGORY else 0 end, case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_ACC_NAM as PLCATE_NAME else '' end,
case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_CAT_T24 else 0 end as CATEGORY1, case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_ACC_NAM else '' end as NAME, case when M1.M_GL_CAT_T24 > 50000 then M1.M_GL_CAT_T24 else 0 end as PL_CATEGORY, case when M1.M_GL_CAT_T24 <= 50000 then M1.M_GL_ACC_NAM else '' end as PLCATE_NAME,
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "sql, oracle" }
How does angularjs react for changes of objects in the scope? If there is a view that displays elements in an array, and the array grows; how does angular refresh the DOM? Does it just append the new elements to the existing view or recreates the whole thing? I fear that I might run into a Schlemiel the Painter's algorithm if I keep adding stuff to lists...
The api appends a new element to the end of the dom tree (well at least the section you are working with) or beginning depending on the filter mechanic you implement. You should be safe, adding as many elements you like of course there is a limit to how big you can get in reality. However for sane amounts of items you should be perfectly fine.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angularjs, angularjs scope, angularjs ng repeat" }
Statistics + Computer Science = Data Science? i want to become a **data scientist**. I studied applied **statistics** (actuarial science), so i have a great statistical background (regression, stochastic process, time series, just for mention a few). But now, I am going to do a master degree in **Computer Science** focus in Intelligent Systems. Here is my study plan: * Machine learning * Advanced machine learning * Data mining * Fuzzy logic * Recommendation Systems * Distributed Data Systems * Cloud Computing * Knowledge discovery * Business Intelligence * Information retrieval * Text mining At the end, with all my statistical and computer science knowledge, can i call myself a data scientist? , or am i wrong? Thanks for the answers.
I think that you're on the right track toward becoming an **expert** _data scientist_. Recently I have answered related question here on Data Science StackExchange (pay attention to the _definition_ I mention there, as it essentially answers your question by itself, as well as to aspects of **practicing** _software engineering_ and **applying** knowledge to solving _real-world_ problems). I hope that you will find all that useful. Good luck in your career!
stackexchange-datascience
{ "answer_score": 1, "question_score": 11, "tags": "machine learning, statistics, career" }
Plot different variable by groups I have this data frame ddf <-data.frame(Class=c(rep("pat",times=4),rep("stm",times=4), rep("nst",times=4)), Ion= c(rep("pos", times=12), rep("neg", times=12)), M1 =runif(24, 5.0, 7.5), M2 =runif(24, 5.0, 7.5), M3 =runif(24, 5.0, 7.5)) For each variable `M1` `M2` `M3` I want to correlate `Ion` `Pos` vs `Neg` colour by `Class` and get the correlation coefficient. I melted library(reshape2) mm <- melt(ddf, id=c('Class', "Ion")) This in order to use `facet_wrap` to a correlation plot for each variable `M1` and so on. I am not sure how to proceed further
You can plot the data like this library(tidyverse) df %>% group_by(Ion) %>% mutate(n=1:n()) %>% gather(k, v, -Class, -Ion, -n) %>% spread(Ion,v) %>% ggplot(aes(neg, pos, color=Class)) + geom_point() + facet_grid(~k) ![]( and the correlation coefficient df %>% group_by(Ion) %>% mutate(n=1:n()) %>% gather(k, v, -Class, -Ion, -n) %>% spread(Ion,v) %>% split(.$k) %>% map(~cor(.$neg, .$pos)) $M1 [1] -0.01189842 $M2 [1] -0.02646084 $M3 [1] -0.0160802
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "r, ggplot2" }
Отобразить по центру большую блочную форму Есть `pushup` окно (большая блочная форма), у нее `position:absolute` и ширина `900px`. Проблема в том что не получается отцентрировать её по центру экрана. На маленьких экранах можно делать оступ по центру через %, но на больших экранах форма уезжает в сторону. Как её выравнять на всех экранах?
Вот вариант для ситуации, когда ширина блока постоянна: < Все просто: figure { position: absolute; left: 50%; width: 900px; margin-left: -450px; } А вот универсальный вариант (UPD). Смысл его в том, что контейнером служит таблица (на самом деле, другой элемент, но с табличным представлением), которая и растянута на всю ширину `body`. А таблица содержит одну-единственную ячейку, которая выравнивает дочерний элемент по центру: .pushup-container-inner { display: table-cell; vertical-align: middle; text-align: center; } Теперь все, что будет внутри, будет размещено по центру.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "html, css" }
How to get count of array of type at once? For example, I have a collection like this: {"_id": 1, "type": 'A', "data": "asdff"}, {"_id": 2, "type": 'B', "data": "fsdfs"}, {"_id": 3, "type": 'A', "data": "aesdf"}, {"_id": 4, "type": 'C', "data": "sdsdd"}, I can get type A's count: db.colA.find({type: 'A'}).count() How can I get an array of type, for example, A, B, C 's count db.colA.find({type: {$in: ['A', 'B', 'C']}}).countByType() ?? Should I do a loop like `db.colA.find({type: type}).count()`?
In order to do this, you need to use the aggregation framework. You simply need to `$group` your documents by "type" and use the `$sum` accumulator operator to return the "count" for each "type". db.colA.aggregate( [ { "$match": { "type": { "$in": [ "A", "B", "C" ] } }, { "$group": { "_id": "$type", "count": { "$sum": 1 } }} ] ) Of course you can always get the total count for "A", "B", "C" using the `count()` method: db.colA.count( { "type": { "$in": [ "A", "B", "C" ] } } )
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "mongodb, mongoose, mongodb query, aggregation framework" }
How can I predict the direction and arc of an Arcane Sentry? Arcane-type enemies throw down purple orbs that sweep a purple laser in an arc. Is it possible to predict the vector of the laser and its sweeping direction so I won't get fried? It appears arbitrary. !Arcane Sentry !Arcane Sentry !Arcane maze
There IS now a way to see which way the sentry will start. No way to determine which way it will rotate, but you can at least make sure you're not standing in it's way when it starts. Take a look: ![Arcane Sentry pre-damage]( Here, you can see where the sentry is going to spear out. It's almost due north. The closer it is to activating, the more pronounced the effect gets: ![Arcane Sentry closer to activation]( So now that you now where it's going to start, you can be that much safer before it activates and kills you instantly.
stackexchange-gaming
{ "answer_score": 4, "question_score": 5, "tags": "diablo 3" }
Числа 01, 02 ... внутри цикла for Пишу такой код <select class="form-control select"> <?php for ($i = 1; $i < 32; $i++) { ?> <option><?php echo $i ; ?></option> <?php } ;?> </select> Наверняка уже понятно что внутри селекта идут календарные дни . Всё бы ничего, но вот числа идут без нуля а хотелось бы как ни будь написать числа с нулями. Например 01, 02, 03 и т д. Если делаю так <?php for ($i = 01; $i < 32; $i++) { ?> то всё равно числа отображаются по прежнему без нулей , но уже до 25 числа. Как быть чтоб первые числа с 1 до 9 отображались с нулями. )
$leading_zero = sprintf("%02d", $i); echo $leading_zero; Как-то так.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, циклы" }
Are different offices of same car rental chain (Sixt) in Germany really different? I have arranged to rent a car from Sixt in Munich, Germany. It was two months ago and i don't remember if the car rental near the Central Station (Haubtbahnhof) did not have the car i wanted, if the price was different or if their reviews were bad. As it is i rented from a location at some distance from the station. However i think we are better of getting a car at the station, as we arrive by train. I have sent Sixt a mail to see if they will change the reservation and how much if anything they will charge. But I'm curious, is Sixt just Sixt everywhere? Or are those distinct German car rental agencies with their own cars, that just operate under a Sixt umbrella? Can i expect a big difference in service or price from one location to the next?
All offices are operated by the same company and you can expect similar service in all branches. Prices do however vary a lot depending on the location of the station. Just a check for tomorrow gives me prices between €110 and €170 for a daily rental of the same car depending on where you pick it up. The office at the main railway station is with €145 one of the more expensive locations, simply because customers are willing to pay a premium for picking up the car directly when they arrive by train. You can change most Sixt reservations, but depending on the tariff you have chosen, you may have to pay an additional fee. In any case, you must pay the difference between the new and the old tariff.
stackexchange-travel
{ "answer_score": 3, "question_score": 2, "tags": "germany, car rentals, munich" }
use exit(0) to close an app in iphone 4 instead of send it in background mode I've noticed that pressing the iphone button using SDK 4 sends the application in background. Since I'm dealing with login and other problems I find better closing the app instead of sending it in background status. So I would put an `exit(0);` statement inside `(void)applicationDidEnterBackground:(UIApplication *)application`. Is it a correct approach or is against Apple guidelines?
actually i found the answer by myself: I can set in the info.plst the option "Application does not run in background" to control this behavior instead of using exit(0) command
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "iphone, ios4" }
CSS removing white space in a specific situation Take a look at this. < When you click on the body of the lower right box, "TOO" is appended to the ul and animated upwards. This results in white space being added to #window-frame. I do not want this. I want no gap between "TOO" and "NEXT ITEM". Can this be done using CSS? I'd rather not fool with heights using JS. Also, any insight as to why this is happening? Thanks
Try using `margin-top` instead of animating the `top` property: $('#latest-image-list').animate({marginTop: "-=20"}, "fast"); Here is a demo: < Also, on a side-note, you created the `height` variable without the `var` statement which put it in the global scope (otherwise it would have been inside the `window.load` event handler scope). Always use `var` to make sure you aren't creating global variables unnecessarily (which creates extra overhead each time the variable is looked-up).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "jquery, css, jquery animate" }
KeyError: "None of [Float64Index([34.62365962451697, 30.28671076822607, 35.84740876993872], dtype='float64')] are in the [columns]" This is my dataframe: x1 x2 y x2_modified 0 34.623660 78.024693 0 99.294362 1 30.286711 43.894998 0 110.085855 2 35.847409 72.902198 0 96.249345 When i try to access the column `x1`, it does it perfectly: >>> print(df.x1) 0 34.623660 1 30.286711 2 35.847409 Name: x1, dtype: float64 But when i try to plot it, df.plot(x = df.x1, y = df.x2_modified) It gives above error: > KeyError: "None of [Float64Index([34.62366, 30.286710999999997, 35.847409000000006], dtype='float64')] are in the [columns]" I'm not getting the reason, please help. Thanks.
If want use `DataFrame.plot` only pass columns names: df.plot(x = 'x1', y = 'x2_modified') If want use `matplotlib.pyplot.plot` then you can pass `Series`: plt.plot(df.x1, df.x2_modified)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python, pandas, dataframe, plot" }
How to manage many number of parameters for a same url with jersey-servlet I am developing a REST API which has about 20 services. All are HTTP GET requests with same URL with different parameters for different services. All together there are about 100 parameters for the entire API. I am using Jersey library for the API.Is there any better way to manage these huge number of parameters? @GET @Path("/processMessage") @Produces({MediaType.APPLICATION_XML}) public Response processMessage( @QueryParam("a") String a, @QueryParam("b") String b, @QueryParam("c") String c, @QueryParam("d") String d, @QueryParam("e") String e, @QueryParam("f") String f, @QueryParam("g") String g, @QueryParam("h") String h, @QueryParam("h") String z, ) } `
Get all parameters using `UriInfo`: public Response processMessage(@Context UriInfo uriInfo) { MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(); Or as a field: @Context UriInfo uriInfo; > An instance of UriInfo can be injected as field or method parameter using the @Context annotation. UriInfo provides access to application and request URI information
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java, jersey, jax rs, query string" }
Programmatically sorting NSTableView I know how to make a tableview user-click sortable but how to sort it programmatically (without using an NSArrayController)? The docs are skimpy on this. Here is what I got: private func updateThemeTableView() { _tableViewDataDict = getAssociatedThemesFor(_type); _tableView.reloadData(); let sort = NSSortDescriptor(key: "Theme", ascending: true, selector: "caseInsensitiveCompare:"); _tableView.sortDescriptors = [sort]; } But this doesn't work. What is the key used here? Should this be the table view column name or the column identifier (set in IB)? When to apply the sort? (I suppose after _tableViewDataDict received the data and reloadData(), whereafter NSTableViewDataSource.viewForTableColumn() does its business?) Is the sort selector valid or do I have to provide a method for this?
Setting the table's sort descriptors is not enough. You also need to respond to the `NSTableViewDelegate` method `optional func tableView(_ aTableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [AnyObject])` by applying the sort descriptors to your data model then reloading the table's data (via `reloadData()`). This is true whether you're applying sort descriptors to the entire table (which doesn't let users click column headers) or to individual columns (which does let users click column headers). As mentioned in comments, you can't sort a dictionary, so you'll need to cache a sorted array and let the table data source methods reference the array instead of the dictionary.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "macos, cocoa, swift, sorting, nstableview" }
What is nodejitsu hosting details for nodejs "A drone is an individual unit of computing power." i cant understand what that means.... how much space? incoming traffic per month? outgoing? ram? Cpu? internet speed? I have searched their plans. They say you get 1drone for 10 dollars a month. Which doesn't tell me anything! What does it mean to get 1 drone in terms of questions above? hoping someone here knows more about their hosting as it's well known provider for node.js. Please word this question right if it feels weird..
Nodejitsu gives you 2 GB of disk space, 256 MB of RAM, and unlimited traffic. The CPUs are 2.4 GHz Xeon processors. As per Joyent's website: > 10 Gbit/s and 40 Gbit/s networking standard You can also scale up to 1 GB of RAM on business plans.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "node.js, web hosting, nodejitsu" }
Need the right .htaccess configuration Let's say I have a domain called test.com. Now my index.html is situated in /public_html/client/frontend/questionnaire/index.html, so I can access it in my browser via < What I want to achieve is: * As soon as a user enters the url < he or she should directly access the index.html * Restrict the user so that he can only access this index.html file and not other directories on the server. I think it should work somehow with the correct .htaccess configuration. Any help would be great :)
You can use this code in your `DOCUMENT_ROOT/.htaccess` file: Options -Indexes RewriteEngine On RewriteBase / RewriteRule ^$ client/frontend/questionnaire/index.html [L] Here `Options -Indexes` is used to disable directory listing.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "regex, apache, .htaccess, mod rewrite" }
Accessing the logged in user AuthComponent::user() < Can someone help me understand this. The `AuthComponent::user()` method only returns some basic information about the user, not the actual User object itself. Coming from rails, I am used to a fully loaded `current_user` object If I wanted something similar, should I do a `$this->User->id = AuthComponent::user('id')` and use that? Or is there already a built in method I can use. Thanks in advance.
I ended up doing something like this # load current_user $this->loadModel('User'); $this->User->id = AuthComponent::user('id'); $user = $this->User->read(); $this->set('current_user',$user);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "cakephp, cakephp 2.0" }
mysqld : multiple tmpdir & balancing Our 1Tb tempdir can sometimes be completely used by mysqld, resulting in disk-full and query errors. This can be due to lots of mid-size queries, or couple of very big queries. We have a 5Tb raid drive I could use to expand this tempdir. The manual says the `/etc/my.cnf --tmpdir` option can be set to a list of several paths, and that it can spread the load effectively. If I set `--tmpdir=/my1TbTemp/:/my5TbTemp/` I am wondering how mysqld will manage these two tempdirs. If the 1Tb disk is nearly full: will mysqld nicely switch to the 5Tb drive? I've run some tests on a small virtual machine, but I'm not sure I can fully replicate the behavior of our production machine.
it is round robin so the first query will go to my1TbTemp and the next will go to my5TbTemp. If the first is full it will then move to the my1TbTemp for the query.
stackexchange-serverfault
{ "answer_score": 2, "question_score": 1, "tags": "mysql, files, large data" }
No more Xcode 4 for Snow Leopard? I'm trying to download Xcode 4.0 for my Mac and they want me to upgrade to Lion and download 4.1. Is there a way to download 4.0 without having to change my entire operating system?
The App Store only distributes one version of each app. Xcode 4.0 is no longer available as Xcode 4.1 replaced it. If the author of the software wishes to keep an older version on the store, the new version has to be uploaded as a different sellable item. In this case, Apple didn't choose to leave both. You can get multiple versions of Xcode by joining the paid developer programs. Last time I checked, Xcode 3 was available with the free account. It runs on Snow Leopard - but it doesn't look like you can buy Xcode 4.0 anymore without a paid developer account - it might not even be available to the developers - you might ask before paying money if you really need 4.0 and only 4.0.
stackexchange-apple
{ "answer_score": 6, "question_score": 13, "tags": "snow leopard, xcode" }
Who is Barclay, the supporter of monarchy, mentioned in John Locke's treatise of government? In John Locke's two treatises of government he mentions "This is so evident, that Barclay himself, that great assertor of the power and sacredness of kings, is forced to confess" (chapter 19, paragraph 232). He then cites a passage from a book called "contra Monarchom.". I found many people called "Barclay", but I did not found any who fits the description and who wrote a book named like this. Who is this Barclay, and where can this book be found?
William Barclay (jurist)): "his principal work was De Regno et Regali Potestate (1600)." Also "De potestate papae: an & quatenus in reges & principes seculares jus & imperium habeat (published in 1609, after his death)." "Adversus Monarchomacos": De regno et regali potestate, adversus Buchananum, Brutum, Boucherium et reliquos Monarchomachos, libri sex. And see Monarchomachs.
stackexchange-philosophy
{ "answer_score": 4, "question_score": 3, "tags": "history of philosophy, political philosophy" }
Behat, PHP Scenario outline: outputting param Given the following behat scenario: Scenario Outline: Bootstrap pages does not encounter the following problems: Given I am on "<page>" And I should not see "" Examples: | page | | web.php | | logs.php | | web.php | | payout.php | One of them if not passing returning: 0 scenario0 step0m0.02s (23.11Mb) Given I am on "<page>" And I should not see "" The text "" appears in the text of this page, but it should not. Skipped step The problem is that I don't know which page is failing exactly because I have `"<page>"` instead of having the actual page. Does someone have an idea. I searched this on google and I did not find anything
The solution to have a detailed stack-trace of the error is to use verbose option. Add `-v|-vv|-vvv` flag based on the level of details you need.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, testing, behat" }
Rounded Corners using 3 images Can I club together three images to form a one with CSS? Basically, I need to create rounded corner button and I've three images left, middle and right. I've used in all the pages and it won't be possible for me to replace it with two or three other HTML controls. So is there any way by which I can combine these images to form one and apply that CSS class to asp:button? Please don't suggest for border-radius properties as backward support is important here. Thanks in advance
Read Sliding door technique < < To create rounded buttons and a lot more using two sliding images from left and right.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "html, css, user interface, controls" }
Ripple effect in custom view I am currently creating an Android view in which, when the use tap it, I will display a sort of ripple around the coordinate of the tap. But I'm not sure on how to do it. My first idea was to invalidate the cache and just make the circle bigger each time but it doesn't seem appropriate nor efficient to do this like that. If anyone faced the same problem before and would love the share some tips on how to do it it would be much appreciated.
I finally found out a solution. Not a perfect one but it works for now. Here is the code I did. Basically when I need it I change a boolean to true so my `onDraw`function knows that it have to execute the `drawFingerPrint`function. The `drawFingerPrint` function, in the other end, just draw a circle that's bigger and bigger between each iteration until it reaches the diameter needed private fun drawFingerPrint(canvas: Canvas) { canvas.drawCircle(pointerX, pointerY, radius, paint) if(radius<= 100F){ radius+=10F invalidate() } else{ radius = 0F drawAroundFinger = false invalidate() } } I hope someone else will find this useful sometimes! Matthieu
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "android, android canvas, android view, android custom view, ripple" }
QNetworkReply "unable to write" Im trying to upload some data with the QNetworkManager and getting the response in QNetworkReply. Then i test, if the reply was an error and if, i print the error message and i dont understand the result. if(reply->error()) { qDebug() << reply->error() << reply->errorString(); } Result: QNetworkReply::UnknownNetworkError "Unable to write" What does the errorString "Unable to write" mean. Is this a return message from the Server or where does it come from? I open QNetworkManager in a loop, is it a problem with opening to many Manager?
Don't construct QNetworkManager in loop, even use only one manager for an application as possible. It is not for single request. There is QNetworkRequest which ressembles request already.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, qt" }
setting the max value to be entered in my input[number] First I get the max value here <div class="form-group"> <label for="inputAddress" class="col-md-6">Cost Per Case</label> <div class="col-md-12"><input type="number" min="0" step="0.01" class="form-control" placeholder="Enter cost/case." ng-model="purchase.cost" required> </div> </div> Then I set the max using the input value above, here <div class="form-group"> <label for="inputAddress" class="col-md-6">Discount Per Case</label> <div class="col-md-12"><input type="number" name="discountpercase" max="{{purchase.cost}}" step="0.01" class="form-control" placeholder="Enter discount/case." ng-model="purchase.discount" required> </div> </div> With these codes, my form will still be valid even though I enter a number more than the max.
ng-max directive would not watch the value updated later. If you want to use dynamic max value, you need to write your custom directive. If you intend to do, this post could help you.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "angularjs" }
Why do put option prices go higher when the underlying stock tanks (drops)? Why do higher and lower strike prices for options all go up when a stock tanks? I am looking at Apple today (as an example), and with it down $8 today and currently at $376, why would the October options for both $365 and $395 skyrocket?
!enter image description here There are two components of option valuation, the value that's "in the money" and the "time value." In the case of the $395 put, that option was already in the money and it will move less than the stock price by a bit as there will still be some time value there. $22.52 is intrinsic value (the right word for 'in the money') and the rest is time. The $365 strike is still out of the money, but as jldugger implied, the chance of it going through that strike is better as it's $6.66 closer. Looking at the options chain gives you a better perspective on this. If Apple went up $20 Monday, and down $20 Tuesday, these prices would be higher as implied volatility would also go higher. Now, I'd hardly call a drop of under 2% "tanking" but on the otherhand, I'd not call the 25% jump in the option price skyrocketing. Options do this all the time. Curious what prompted the question, are you interested in trading options? This stock in particular?
stackexchange-money
{ "answer_score": 2, "question_score": 2, "tags": "options, put options" }
Полсуток, полпятого Что делать, если эти слова нужно употребить в других падежах? Правильно ли будет сказать так? _Уже больше полсуток прошло._ _Я освобожусь не раньше полпятого._ Или надо _"полусуток"? "Половина суток"_ в этом случае не лучше для разговора? А вместо _"полпятого"_ в моём примере может лучше говорить _"половины пятого"?_ Интересно, что во втором случае я склоняюсь к "половине" (невольно обычно стараюсь так сказать), а в первом случае мне кажется, что с ней звучит уж слишком сложно, тяжело, неестественно для простого разговора.
Сложные имена существительные, первый компонент которых образован числительным пол (половина), типа полчаса, полдюжины, пол-арбуза имеют в косвенных падежах (кроме винительного, совпадающего с именительным) двоякого рода формы: в книжной речи пол меняется на полу, а в разговорной может сохраняться без изменения. Ср.: а) от получаса не осталось ни одной минуты; к полудюжине карандашей добавлено еще три; в полуарбузе было три килограмма веса; Я уже более полугода не бывал у них (Аксаков); Учитель невольно остановился на полуслове (Телешов); б) растворить лекарство в полстакане воды; ограничиться полдюжиной карандашей; На полслове он обрывал и тер себе лоб... (А. Н. Толстой); Полгодом позже я написал навеянное одной из этих поездок стихотворение... (Симонов); В полверсте, в кустах – противник (Твардовский) (Розенталь Д. Э.)
stackexchange-rus
{ "answer_score": 1, "question_score": 1, "tags": "грамотная речь" }
Round cube login connection to storage server failed I have multiple domains working on my mail server, and all are working normally, I configured new mail domain "newdomain.ae" normally on mysql mail db, created new user, inbox was created on server, But when i tried to login to my account on the new mail on round cube, i got the error "login connection to storage server failed" Round cube's logs were: [01-Feb-2016 23:00:01 +0200]: IMAP Error: Login failed for [email protected] from 2.2.2.2. Could not connect to newdomain.ae:143: Connection refused in /var/www/webmail/program/lib/Roundcube/rcube_imap.php on line 184 (POST /mail/?_task=login&_action=login) **Note:** the application server is hosted on another different server under domain "newdomain.ae"
I could finally fixed it, Roundcube default configuration was resolving the @newdomain.ae to the app server not the mail server, I modified the host parameter for both smtp and imap in the roundcube configuration file "config/main.inc.php" $rcmail_config['smtp_server'] and $rcmail_config['default_host'] to the mail server IP, and it finally worked :)
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 1, "tags": "12.04, mail server, roundcube" }
Selenium WebDriver selecting from scope (IWebElement) Is there a way to select elements **inside** already obtained IWebElement. Im trying to do this via C# binding (RemoteWebDriver) but findElem.FindElements(By.CssSelector(someStmt)) returns all elements from page (not from inside findElem)
That is exactly the behavior of `IWebElement.FindElement` and `IWebElement.FindElements`. For most locators, including `By.CssSelector`, this works exactly as expected. The one exception is that using `By.XPath`, you need to prepend a "." to scope the XPath search to the current element. The WebDriver project's integration tests include tests for exactly this functionality. Without further context, like some example HTML that demonstrates the issue, further diagnosis is impossible.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 3, "tags": "c#, selenium, selenium webdriver" }
Iphone: Highlight row when added I'm developing an application where the user adds new rows to an existing table. When a new row is added, i want to highlight it and make the view focus on the row if the table is scrollable. Any ideas on how I can do this? I`m still kinda new to iphone and objective-c so any help is highly appreciated ;)
If you know the NSIndexPath of the row you just added, calling selectRowAtIndexPath:animated:scrollPosition: on your table should do the trick: [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "iphone, uitableview" }
What is the appropriate word for someone who passes an entrance exam? I am trying to prepare a list of students who have taken an exam to be admitted to a course. In this list, there are 20 highly-placed people and 20 candidates who got lower marks. These people will be called up for the course if any of the first list don't take up the opportunity. I'd like to know what to call the first group: Name | Result ---|--- John Doe Alice Jones ... | **????** (There are twenty of these) John Smith Sue Bloggs ... | **Substitute** (Twenty of these too) **All** of the candidates passed the exam, so they are all "successful" in that sense; but we only have twenty places available, which will be offered in order of the mark each candidate achieved in the exam.
You could say _**admitted**_. The verb _**to admit**_ has this meaning recorded in the dictionaries: > If someone is admitted to an organization or group, they are allowed to join it. > He was _admitted_ to the Académie Culinaire de France. (Collins) > to allow to enter; grant or afford entrance to: > _to admit_ a student to college. (Dictionary.com) > To accept into an organization or group: > The college _admits_ fine arts students. (FreeDictionary) But I think the best option is the noun _**admissions**_ (in the plural): > _Admissions_ to a place such as a school or university are _the people who are allowed to enter or join it_. > > * Each school sets its own admissions policy. (Collins) >
stackexchange-english
{ "answer_score": 3, "question_score": 2, "tags": "single word requests, terminology" }
Can I use some method to get the variable name? I creat a instance of a class. Can I use some method to get the variable name, then I print out it? I just want this when I do some test project. I think I really mean is the variable name.
Unfortunately, no, you can't. Object instances don't have names. Classes have names. Methods have names. Properties have names. But object instances don't. Variables have names, but they're not unique to instances, and you don't have access to that programmatically, anyway. If you just invoke the `description` method, you'll generally get a little something to identify the instance, but it's not a name. `UIView` objects have a numeric `tag` property, so for those you can set that property and identify your controls that way.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ios, instance, var" }
IE 11 not understanding the common method, giving undefined I have defined a common function in a js file with the name as spMethods which is a common function which has some other function in it. It is defined as : var spMethods = function () { function getContext() { return new SP.ClientContext(appweburl); } function getAppContextSite(ctx) { var fct = new SP.ProxyWebRequestExecutorFactory(appweburl); ctx.set_webRequestExecutorFactory(fct); return new SP.AppContextSite(ctx, hostweburl); } }; now when i am trying to use this same function in other js file it is giving me undefined for spMethods
To define the global function in the common.js file use below given syntax. var globalFn= window.globalFn || {}; globalFn.spMethods = globalFn.spMethods || {}; To use this spMethods function in any other component js file use below given syntax. for example in 'abc.js': var _globalFn = window.globalFn|| {}; var _spMethodsClerk = new _globalFn.spMethods(); once _spMethodsClerk object is instantiated you will get other methods defined in it. Like `getContext()` and `getAppContextSite()` etc. Let me know if that helps?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "javascript, reactjs, sharepoint" }
Multiple input files to `awk`? I have a bunch of files named `dataX.dat` where `X` is a number that ranges over an interval. I was trying to get the seventh line of each of those and take them to a new file using `awk` but it just gets the latest one (the one with the highest `X`: awk 'NR==7' data*.dat only displays the seventh line of data128.dat being 128 the last one of them. Why does it do so and how should I do it so it takes all the files? Thank you in advance. EDIT: The system orders files alphabetically and 128 happens to be the first one (no other `X` number starts with `1`), so it's actually taking only the first file.
NR is across all files, FNR is in each file: awk 'FNR==7' data*.dat
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "awk" }
Remove "Category:", "Tag:", "Author:" from the_archive_title I have the following code in my theme's archive.php: <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> This gives me titles like "Category: Russia", "Tag: America", "Author: John". I would like to remove the "Category:", "Tag:" and "Author:" part and just display the category, tag and author names. Does anyone know how to accomplish this? Thank you.
You can extend the `get_the_archive_title` filter which I've mentioned in this answer add_filter('get_the_archive_title', function ($title) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { $title = '<span class="vcard">' . get_the_author() . '</span>'; } elseif (is_tax()) { //for custom post types $title = sprintf(__('%1$s'), single_term_title('', false)); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } return $title; });
stackexchange-wordpress
{ "answer_score": 127, "question_score": 84, "tags": "functions, archives" }
Is the MPICH Hydra an alternative for MPD? I am a user of `mpd` which come from licensed package. However, I am trying to clone the machine for increasing my parallel computational scope. The action give me a problem of alarm clock, which is I guess related to the licence. My scientific software require an processor management package like `mpd`. Therefore I am looking from the literature and stumble upon `MPICH Hydra` which is free. Is that possible to replace `mpd` function with `MPICH HYDRA`? Do they provide the same functions? Are there any drawbacks? Thanks
Yes, it is possible to replace MPD with hydra. Hydra is the launcher that's been used by MPICH for a couple of years now. It probably won't be a straight swap in terms of API, but all of the functionality from MPD should be there with ought the headache of having to set up daemons before launching, etc.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ubuntu, parallel processing, mpi, mpich" }
Java/Scala Regex: Move number in parentheses in string How can I capture the number (250 in the following case) and insert it in the replacement string? What I have: `"CHAR () FOR BIT DATA(250) NOT NULL"` What I want: `"CHAR (250) FOR BIT DATA NOT NULL"` I'm looking to do this in Scala, but I guess it simply uses `java.util.regex`. Here's what I've tried: `"""CHAR () FOR BIT DATA(250) NOT NULL""".replaceAll("CHAR \\(\\) FOR BIT DATA\\(([0-9]+)\\)", "Here is the string: $0")` I simply don't know how to get only the digits to re-insert them in a new string.
You can use .replaceAll("""(CHAR \()(\) FOR BIT DATA)\((\d+)\)""", "$1$3$2") See the regex demo **Details** * `(CHAR \()` \- Group 1 (`$1`): `CHAR (` text * `(\) FOR BIT DATA)` \- Group 2 (`$2`): `) FOR BIT DATA` text * `\(` \- a `(` char * `(\d+)` \- Group 3 (`$3`): one or more digits * `\)` \- a `)` char.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "java, regex, scala, replace, regex group" }
R: Conditionally select rows based on ther value and the average value of the rest rows with same key This should be very simple but I can't figure out how to do It properly. Given the following example dataframe: telar <- data.frame(name=c("uno","dos","tres","cuatro","cinco"), id=c(1,2,3,1,2), test=c(10,11,12,13,14)) telar name id test 1 uno 1 10 2 dos 2 11 3 tres 3 12 4 cuatro 1 13 5 cinco 2 14 I am trying to select all the rows that, for example, have a value of test that is bellow the average of al the values in the dataframe telar that have the same id value. I have already properly grouped the values by id and computed their average like this, but I do not know how to perform the comparison. > summarise(group_by(telar, id), test=mean(test)) A tibble: 3 x 2 id test <dbl> <dbl> 1 1 11.5 2 2 12.5 3 3 12 Thank you!
You can simply create your groups and keep the values that are less than the mean, i.e. library(dplyr) telar %>% group_by(name, id) %>% filter(test < mean(test)) %>% ungroup()
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "r, grouping, subset" }
Rails 3 Autocomplete solution with primary_key support I've been looking around for a Rails 3 form autocomplete solution. I ran into the auto_complete plugin, but it doesn't have support for assigning a hidden primary key so that a textual response can be used in the form. I'm also looking for something that can is able return a concatenated string in its view, e.g. the firstname and lastname of a user. Does anyone have any suggestions for a plugin that has this functionality?
Take a look at this one, if I remember correctly, there is an option that would allow that: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, ruby on rails, ajax, ruby on rails 3" }
How to display a changing value? (Python) I have a Raspberry Pi set up with an Analogue to Digital converter and have a two potentiometer joystick wired to the input. I can get the values of each potentiometer to display on screen using 'Print' however it displays thousands of lines per minute as the values change when the potentiometers move so it is impossible to read the values as they go flying past. I was wondering if there is another way to display these values so that it is just one area of the screen and the values change there making them easy to read rather than printing a new line each time?
You could try something like the snippet below. Assuming `MCP3008` is your converter, it will read the value every 0.1 secs (`sleep(0.1)`) and if the values are different by 5% (`threshold = 0.05`) it will `print` the new value and overwrite the old line (`end = '\r'`) from gpiozero import MCP3008 from time import sleep threshold = 0.05 pot = MCP3008() last_value = pot.value print(last_value, end='\r') while True: new_value = pot.value if abs((last_value - new_value) / new_value) > threshold: print(new_value, end='\r') last_value = new_value else: sleep(0.1)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python, raspberry pi, microcontroller" }
Is There A Way To Upgrade to OpenCL 2.0? There is a feature in OpenCL 2.0 that I would like to use. I dual boot Ubuntu and Mac OS (Graphics: GTX 670 + HD Graphics 4600). Is it possible to install OpenCL 2.0? This may be a dumb question - from what I have read, it seems like 2.0-compatible drivers may not be written yet? And also possibly my hardware will not support the new spec? Basically, when will OpenCL 2.0 be easy/available?
There are no OpenCL 2.0 drivers yet. The specification just became final yesterday. I don't believe any public statements have been made yet about when drivers will become available, and for what hardware. You'll have to wait for whatever fun new feature you wanted. Better yet, let your favorite vendors know that you'd like them to support OpenCL 2.0!
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "opencl" }
Add column with default null value I use rails with postgreSQL, I want to add a new column with a default null value, do I have to specify the default null value? add_column :posts, :string, default: null
You don't need to specify it. When you add new column to table without default value all the values will be null. Also: note that in ruby the equivalent of psql `Null` value is `nil`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "ruby on rails" }
MongoDB aggregate $match using dynamic field path I want to match documents in my pipeline based on whether the field to match is contained within an array that is within my documents. Example document to match: { 'wishlist': ['123','456','789'], 'productId': '123' } Example match aggregation: { $match: { 'productId': {$in: '$wishlist'} } } This isn't working - error is '$in needs an array' - but `'$wishlist'` is an array? so clearly the stage isn't picking up the path reference. How would I get something like this to work? Thanks!
If you want to match the internal field of the document, you can use $expr expression operator, and I see that field has an array value then you have to use $in operator's aggregation syntax, { $match: { $expr: { $in: ["$productId", '$wishlist'] } } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mongodb" }
Declaration of differents types of extern variables in C I have a doubt about declaration of external variables. I'm working in a project that is already working, and it is like below (it is an example based in the real program): # file1.h #include "mystruct.h" extern long a ; extern strc_1 s ; extern STRC_2 *ss; In my main program I have # main.c #include "file1.h" long a ; strc_1 s ; main() { a = 10; s.variableX = 10; s.variableY = 50; ss.J = 50; ss.J = 250; } So, my question is: Why does not the pointer 'ss' need to be declared in the main program? And why does it work? I mean, the variables 'a' and 'strc_1' were declared in the main program because I use them, however, I use 'ss' but I did not declared it in the main program.
long a ; strc_1 s ; These in `main.c` are called **definitions** , not **declarations**. (To be precise, all definitions are also declarations). The reason you don't have to define `ss` is because it's defined in some other source file. As long as the declaration of `ss` (which is in `header1.h`) can be seen, it will compile fine.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c, pointers, declaration, extern" }
I want to replace a result from a Query with my own value of choice I'm using QMF from IBM DB2 and I have a simple query SELECT * FROM COUNTRYTABLE Instead of giving names like US, Germany, I get a result like 123, 456, because we're using Country codes. There's not a single table where you would get the name "Germany", so I cannot join to be able to obtain the result I want. Is there a way to switch/replace the value of 123 to Germany? I know we can use this for Columns names with Country as Countries, but I'm not sure for results from a query. I do not have administrative privileges, I'm just a simple user, so no fancy stuff for me. I tried searching the web, but I didn't even know how to phrase the question.
I would make the table, but.. if you lack access you can use a CASE statement: SELECT CASE WHEN country_Code=123 THEN 'Germany' WHEN country_Code =124 THEN 'Spain' ELSE country_Code END as Country, Column2, Column3 FROM CountryTable; I can't recall if CTE's in DB2 allow SELECTS without a FROM, but if they do you may also consider making a CTE and joining to that as another option: WITH country AS ( SELECT 123 as country_code, CAST('germany' as varchar(50)) as country_name UNION ALL SELECT 124, 'Spain' UNION ALL SELECT 125, 'Portugal' ) SELECT country.country_name, countryTable.column2, countryTable.column3 FROM countryTable LEFT OUTER JOIN country ON countryTable.country_code = country.country_code;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, db2" }
Convert OracleLob to String C# Does anyone know how convert the `OracleLob` Value in string? `ToString()` only returns the name of the class: `System.Data.OracleClient.OracleLob`.
If you are sure it's actually characters (CLob or NCLob), then you can use the Value property. Please consider using the Oracle driver to connect to Oracle, the Microsoft driver is just for backwards compatibility. Microsoft announced years ago, that using the Oracle driver would be the best way to connect to Oracle databases.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, string, oracle" }
Clustering on tomcat with spring I have a Spring web application with singleton services. There're also some singleton variables such as map with session data for all authenticated users and so on. That all works nice on one server, but how could this system be distributed between a few servers? The system runs on Tomcat.
Terracotta has Spring support and makes sure it's only one singleton bean among all the instances in the Terracotta cluster. All you need to do is to enable Terracotta and declaratively add the singleton beans to the cluster. If you bother to register a community account, you can read more in their online documentation.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "spring, tomcat, cluster computing" }
Get specific element from an object list passed from controller in gsp I passed a list of objects from controller to the gsp with model as shown below model: [ houses: houses] I want to set in jquery that whenever the input value of houseId changed, the input value of houseName will be changed to the name of the specific house based on the houseId. Below is the code: $( "#houseId" ).change(function() { $('#houseName').attr('value', '${houses[0].houseName}'); });` As you can see, the '0' in `houses[0]` is suppose to be `houseId`, but I have no idea how to put houseId inside. Can anyone please enlighten me? Thanks!
A better way to do this is sending the `houses` list as a JSON array and parsing it with JavaScript. In your action: import grails.converters.JSON .... model: [ houses: houses as JSON] So you have something like this: [ { "id":1, "name":"House 1" }, { "id":2, "name":"House 2" } ] In your JS: var houses = JSON.parse(${houses}); $( "#houseId" ).change(function() { var index = $('#houseId').val(); $('#houseName').attr('value', houses[index].name); });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jquery, grails" }
October CMS - Cannot edit pages in backend - http status 403 After uploading my October CMS code base to the a cpanel based linux server, I can't edit my pages from backend (CMS->pages). It gives me a popup with an http status code of 403 error page. How can I fix the issue.
There is a known issue of the following: Hosting limitations - cannot edit pages in back-end I've fixed the issue by adding the following block of config in my .htaccess file: <IfModule mod_security.c> SecFilterEngine Off </IfModule>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "octobercms" }
Remote debugging under Mac OS X Anyone have documentation/tips/tricks/advice on how to debug an application from another computer? I have a MacPro (10.6.1) and a MacBook Pro (10.5.8), and I'd like to debug an application residing on the former from the latter. Both are running XCode 3.1.3.
The definitive Apple document on remote debugging can be found here. **Update** : Remote debugging is no longer supported under Xcode 4. See here.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "xcode, macos, remote debugging" }
How to hide a div with jQuery? How to hide the following `div` with jQuery? HTML: <div class="BottomSmMargin MiniCheckDiv">
$('.BottomSmMargin.MiniCheckDiv').hide(); Notice there is no space between the two classes here.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 3, "tags": "jquery" }
Source name when writing to event viewer C# How do you change the source name when writing to the event viewer in C# language? Currently have this > string cs = "Application"; > > > if (!EventLog.SourceExists(cs)) > EventLog.CreateEventSource(cs, "ReceiveDaily"); > EventLog.WriteEntry(cs, message.Message, EventLogEntryType.Error); > If I change CS to anything else, I see a Security-Kerberos (0x7) popping up at my event viewer It writes the error in the errorlog when I put "Application" though. But then the source is "Application", which isn't a very good description from where it comes ... Thanks in advance.
As @Phil mentions, I don't think that you can dynamically create event sources unless you are running in admin mode. However, if you know the set of sources that your application needs, then you can pre-install them using a `System.Diagnostics.EventLogInstaller` and `InstallUtil.exe`. These sources will then be available to use by your application. This has a good example of setting up the installer.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, event log, event viewer" }
AppleScript "if contain" I have a script which look for the name and search for a match with a another variable. It's working fine however if the variable 1 is "Name Demo" and variable 2 is "Demo Name" then the script don't find a match. set nameMatchTXT to "" if NameOnDevice contains theName then set nameMatch to theName & " : Name Match" end if Is there anyway to change this to find the match whatever the order ? PS the script is looking for word wild name, and sometime handle dual bit characters which can be a difficulty.
Your request stated: > if the variable 1 is "Name Demo" and variable 2 is "Demo Name" then the script don't find a match. This will solve that problem: set var1 to "Name Demo" set var2 to "Demo Name" if (var2 contains (word 1 of var1)) and (var2 contains (word 2 of var1)) then -- you have a match display dialog "var1 and var2 match" else display dialog "no match" end if
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "if statement, applescript, contain" }
CSS border won't animate For some reason, when I hover over the div, the border animates properly, but mousing off of it produces no transition. What am I missing? < HTML: <div class="test"> Test </div> LESS: .test { background: #eee; border-bottom: none; width: 300px; height: 300px; transition: border 100ms ease-out; &:hover { border-bottom: 5px solid black; transition: border 100ms ease-out; } }
If you truly want no border, you can animate the color to transparent and the length to 0: .test { background: #eee; border-bottom: 0px solid transparent; width: 300px; height: 300px; transition: border 100ms ease-out; } .test:hover { border-bottom: 5px solid black; } <div class="test"> Test </div>
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "css, less, css animations" }
Centering a Placeholder and Input Text in a Text Field I was wondering if it was possible to center a placeholder and the input which the user will enter in the Text Field. I imagine it would be possible yet I cant figure it out. could anyone help? my code for the Text Field in question is below... <input type="text" style="font-weight:bold:" name="kword" id="kword" autofocus ="on" placeholder="Enter Keyword(s)" autocomplete ="on"/> Thanks
This can be used to `text-align:center` CSS: input, input[placeholder] { text-align: center; }
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 8, "tags": "html, css" }
INNER JOIN and IN clause not returning same counts? More then likely I am not fully understanding the differences between the two. However I am trying to figure out how many people from my optout table are actually in my client table. I tried two different ways and thought they would return the same count... Method One: Select count(*) from `optout` where fname in (Select fname from client) and lname in (Select lname from client) and state in (Select state from client); Method Two: Select count(*) from `optout` as t1 join `client` as t2 on t1.fname = t2.fname t1.lname = t2.lname t1.state = t2.state; Which way would be the correct way to handle this? Method One returns 5,000+ records and Method Two only returns 258.
Method two is what you want, since it is counting rows in `optout` that match a single row in `client` on fname, lname, and state. Method one returns rows in `output` that have fname, lname and state rows which exist in `client`, even if they are spread across multiple different rows in the `client` table.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "mysql, sql" }
Is 了 optional in the following sentence: 我上午八点前起床了 and 我三十分钟前起床了? Is `` optional in the following sentences: `` and ``? I know that `` is for completed actions, but in the case of getting up, it's obvious that I already woke up. I got the same thoughts about e.g. saying `` while pointing with my finger at a cup, do I need to include ``?
"" indicates the completion of the action stated in front of it - **** means "This morning, I **got up** before eight o'clock". If "" is eliminated - becomes a statement, that means "I get up before eight o'clock", which can be an everyday event, or a future event, depending on the time indicator and modifiers: * **** . - "I get up before eight o'clock everyday morning". * **** (//). - "I am going to get up before eight o'clock tomorrow morning"; "I must get up before eight o'clock tomorrow morning". Follow the explanation above: * " **** " \- "I (have) purchased this mug". the act of purchase is completed. "(//)" \- "I buy this cup", which is a statement of the current action, or the action yet to be carried out - "I am going/wanting to buy this mug".
stackexchange-chinese
{ "answer_score": 1, "question_score": 2, "tags": "grammar, meaning" }
Different controllers for (almost) the same route? I have two routes that are almost identical: .state('route', { url: '/route/:id and .state('newroute', { url: '/route/new The first one takes in a parameter, id, and the second one is a static route. They each have a different controller but I can't seem to figure out how to get the /route/new to take affect, it keeps routing me to the first state's controller with "new" as the id.
Declare the `/route/new` route before the one with the ID, then ui-router will pick it up with priority
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "angularjs, angular ui router" }
How to Make a Revit Room Clickable in the Forge Viewer? I'm new to Revit, and I'm trying to access Room/Spaces data in a 2D sheet. In this answer, they note that the Room has to be clickable in the Forge Viewer. How can you make a Room clickable?
Except for the way I shared in this thread, to make the room clickable, you also need to set up Color Schemes for that 2D view.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "autodesk forge, autodesk viewer, autodesk" }
javascript ID selector I have 2 forms <form name= "form1" action=""> <input type="hidden" name="max" id= "max1" value="100"/> <input type="submit" class="submit" value="part 1" /> </form> <form name= "form2" action=""> <input type="hidden" name="max2" id= "max2" value="200"/> <input type="submit" class="submit" value="part 2" /> </form> I get the values from this form here $(".submit").click(function () { here --> var max_res = $("input#max1").val(); var Results = "Max Result " + max_res; }); My question is how can i dynamically change the id from **max1** to **max2** so I can store **max2** 's value in **max-res** when a click is made in form2
var max_res = $('input[id^="max"]', $(this).parent()).val(); //selects the id starting with max in this form var Results = "Max Result " + max_res;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, forms, css selectors" }
How to use 'if statement' with 'or' operator in python I have list that contains some value now i want to check it for empty string and Null values. So i am using below code for same but output is not coming correct. On checking for '' empty string it is giving output 'not nice' Its working fine for 'Null' value but not considering it for '' empty values. Any help would be appreciated. y=['',''] if ('Null' or '') in y: print ('nice') else: print('not nice')
`or` evaluates two Boolean expressions. In your case, the statement in the bracket is evaluated first and then the `in` is evaluated. This leads to the `if` statement being interpreted as false. You do not need to use the brackets. Just do this: `if 'Null' in y or '' in y:` Now there's a Boolean expression on either side of the `or`, so it will evaluate properly.
stackexchange-stackoverflow
{ "answer_score": -2, "question_score": -6, "tags": "python, python 3.x" }
Does >> leave simbolst in the stream? The code I wrote below figures the sum of the digits the given number consists of until sum > 10. So,the questions is: operator ">>" extracts the information from the stream and makes the stream empty ? If it's ,so why can't I perfom "ss<< sum" after I reset the bit of EOF to 0 ? int sum = 0; stringstream ss("13245"); char ch; while (1) { while (ss >> ch) { sum += ch - '0'; } ss.clear(); ss << sum; //can't perfom if (sum<10 ) break; sum=0; } cout << sum;
If you're trying to reset the stream with each iteration, this will likely do what you seek: int sum = 0; stringstream ss("13245"); while (1) { int c; while ((c = ss.get()) != EOF) sum += c - '0'; ss.clear(); // clear stream state ss.str(""); // clear buffer ss << sum; // write new data if (sum<10 ) break; sum=0; } cout << sum; **Output** 6 Note: I took liberty to use the `get()` member, as it seemed more appropriate for what you were trying to accomplish. And tested with your `9999` aux sample also produces the expected `9` result. To answer your question, yes, the string buffer is not cleared unless _you_ clear it (which we do above with `str("")`).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, stream, operator keyword, stringstream" }
How do I create a split column in one part of a page? What I would like to do is be able to do something like this in the header. I want to split it up. How do I do this? I know that I could just use the moderncv package, but there are parts of the template that I don't want.
Here is asolution \documentclass{article} \usepackage{graphicx} \begin{document} \noindent \begin{minipage}[b]{.45\textwidth} \includegraphics[width=.48\textwidth]{example-image}% \hfill \begin{minipage}[b]{.5\textwidth} \setlength{\parindent}{0pt} bla bla bla foo bar baz bla foo bar baz bla bla bla bla bla foo bar baz bla foo bar baz bla bla \end{minipage} \end{minipage}% \hfill \begin{minipage}[b]{.5\textwidth} \huge FOO BAR \end{minipage} \end{document} ![enter image description here](
stackexchange-tex
{ "answer_score": 0, "question_score": 0, "tags": "two column, moderncv" }
Modify render settings for all scenes using python I have some basic render settings (border off, resolution, etc.) that I would like to have applied for **all** scenes in the .blend file using Python, via the `-P` **command line** switch. I have tried: for scene in bpy.data.scenes: but it only operates on the active scene.
It works fine for me. import bpy for scene in bpy.data.scenes: scene.render.resolution_x = 1920 scene.render.resolution_y = 1080 scene.render.resolution_percentage = 100 scene.render.use_border = False Placing this in a file (`test.py`) and running blender with blender test.blend -P test.py Opens blender with all the settings set to the values defined in the Python script, in both scenes.
stackexchange-blender
{ "answer_score": 7, "question_score": 5, "tags": "python, scene" }
How to require dependencies in Clojure? I have two questions regarding dependencies in `Clojure` project. 1. Is there something like `:dev-dependencies` or `:test-dependencies` so that I don't have to download them all on `lein run`? So until I run my tests I don't need to have these extra libraries. 2. Can I load dependencies in one file and require this one file in an another file? I'd like to have something similar to: ; dependencies.clj ; ... (:require [clj-http.client :as client] [clj-http.fake :refer :all] [clojure.test :refer :all])) ; some-file.clj ; ... (:require [dependencies :refer :all[)
1) Yes, Leiningen offers profiles for just these purposes 2) No, referals from one namespace are not "inherited" between namespaces. You can't express "I want to refer to everything in this namespace, that some other namespace refers"
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "clojure, clojure testing" }
How to change the color of a tooltip using the Pmw module in python? I am trying to make a tooltip in Tkinter by using the Pmw module. When the user hovers the mouse over the button I want to display a tooltip with a black background and white text but I can't figure out how to do that. Here is the code I am using: from tkinter import * import Pmw root = Tk() Pmw.initialise(root) # Create some random widget button = Button(root, text=" This is a Test", pady=30) button.pack(pady=10) # create balloon object and bind it to the widget balloon = Pmw.Balloon(root) balloon.bind(button, "Text for the tool tip") mainloop() How would I go about changing the text color and background color of the tooltip?
Get the label component of the tooltip using `balloon.component("label")` then use `config` on that label. Here is an example: from tkinter import * import Pmw root = Tk() Pmw.initialise(root) # Create some random widget button = Button(root, text=" This is a Test", pady=30) button.pack(pady=10) # create balloon object and bind it to the widget balloon = Pmw.Balloon(root) balloon.bind(button, "Text for the tool tip") lbl = balloon.component("label") lbl.config(background="black", foreground="white") # Pmw.Color.changecolor(lbl, background="black", foreground="white") root.mainloop()
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, tkinter, tooltip, pmw" }
Warning when i'm trying to install Android on NetBeans 7.2 Beta I'm trying to Use `android` with `Netbeans` , but every time i try to do it , it gave me warning message Like this: !enter image description here Exactly what i do : * Tools -> Plugins ->Settings tab ->press `Add` button and fill name "NBAndroid" and URL "< then i get the above warning Message It's my first time to try it , and googled it but didn't find any thing ,So i need the help for do that , thank you
Finally , I found the solution : According to Installation using AutoUpdate center > address of our update center that is: > > * < if you run NetBeans 7.2 or newer Previous update center at > * < is removed now as it caused confusion about current version and what is supported and what not.`///////////and this is was my problem , so i used the first one , and it's ok now` >
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "java, android, netbeans" }
Images disappear when form is being submitted I have a contact page with a form and icons on the page with social media links and email address. When the form is submitted the icons/images disappear from the page however the form validates and is fine. I am using standard img tags and a class of floatLeft. I found a solution that worked for someone when they used position relative on their css but still no luck for me. It must be something to do with the css (at least i think it is). I have tried using codeigniters img snippet (I am using CI Framework) and the images are fine on form submit but not sure how to align a CI image tag with a P tag as they seem to drop under one another. Any help or links to what may be the problem would be much appreciated. Thanks. RESOLVED: <img src="<?php echo base_url(); ?>assets/images/phone.png" alt="Phone" class="floatLeft"><p>123 456 789</p>
Change the style as the following: img.floatLeft{ float:left; left:-20px; position:relative; } .contact-info{ padding:10px 0px 10px 0px; height:38px; font-size:14px; overflow:hidden; clear:both; } _**Please make sure the image is downloaded since you use relative link in the image source._**
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "css, forms, codeigniter, image" }
Audio amplifier provides the capability to drive 660Ω loads directly without buffering From PGA2311 datasheet we can read this sentence. Does that mean if I drive a 660ohm load at power P, in order to drive a 100ohm load with same power, PGA2311 won't be able to source enough current? So a buffer is needed? How can I determine load values range from datasheet? Is it related to output buffer short circuit current?
The output of the PGA2311 is a voltage source that, if powered with a +/- 5 volt supply, has an output range of -3.75 volts to +3.75 volts. The output can drive up to 50 mA of current. This means that if you connect a 100 ohm load, your worst case current will be 37.5 mA, well within the rated output current. You should perform a thermal dissipation calculation, however, to make certain you do not require a heatsink since the device power dissipation has gone up by a factor of 6.6 from their reference design. The device is designed for a 660 ohm load and unfortunately they do not specify the effect on THD based on load impedance. You can call an application engineer at TI if you are concerned about this parameter.
stackexchange-electronics
{ "answer_score": 1, "question_score": 0, "tags": "amplifier, datasheet" }
Rewrite urls with .htaccess file in localhost So I have managed to rewrite urls using the .htaccess file but the redirection messes up the url. For example I try to rewrite this: localhost/mysite/public_html/class/5/ into this: localhost/mysite/public_html/index.php?v=class&id=5 and I use the following lines in the .htaccess file: RewriteRule ^public_html/([A-Za-z]+)/([0-9]+)/?$ ./public_html/index.php?v=$1&id=$2 [L,R] but the browser redirects me here (I am using **wamp** on Windows 7): localhost/C:/wamp/www/mysite/public_html/index.php?v=class&id=5 Which is wrong and gets me a 403 error. What should I do?
It's unbelievable. The error was a result of Firefox's caching. I used Chrome and it was ok. So I cleared Firefox's cache and everything worked fine.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, apache, .htaccess, url, mod rewrite" }
HTTP request does not work I'm programming some kind of browser in c++ using winsock and got struck in some kind of error. The program works just fine for some pages in the internet, but for some reason it doesn't work for all of them. < As seen in these images the composed version of Fiddler works while my own program fails. I thought that maybe the HTTPS connection might be the problem, but it doesn't even seem to need a handshake or something similar. The sending part of the program is certainly not the problem because it works with other pages (e.g. the ones in the comments). Thanks in advance!
_I thought that maybe the HTTPS connection might be the problem, but it doesn't even seem to need a handshake or something similar._ Yes, HTTPS requires that you perform a rather complicated handshake, which is why essentially nobody attempts to implement HTTPS directly on sockets, and instead uses WinHTTP or WinINET, the two HTTP stacks included in Windows. While Fiddler is running, you can kinda "cheat" by sending your plaintext request (containing a HTTPS url) to Fiddler, which will then perform the proper secure handshake with the remote server on your behalf and then return the response to your client. (Fiddler is acting as a _HTTP-to-HTTPS gateway_ in this scenario.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, http, https, winsock, fiddler" }