INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Why do 11pt fonts of gnome-terminal look so much bigger when running under KDE compared to GNOME/Unity? I am trying to explore KDE a bit, but many of the tools I rely on have fonts that appear so much bigger under KDE than Gnome even though the chosen font size is the same and the resolution is the same (1920x1200). I have noticed this for **gnome-terminal** as well as **GNU Emacs 23.1** (compiled with xft). I run Ubuntu 11.10 if that helps. Is there a simple explanation? Thanks! SetJmp
This is a font DPI configuration issue: < The Font Settings menu has the appropriate dialogue. In my case changing to 96 DPI fixed the problem.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "gnome, font size, kde plasma" }
Java process that invoke pkzip taking long time to zip I **must** use pkzip in my java program to zip (since standard java zip routine does not work on mainframe), I think it zip correctly, however it take a long time to finish. Here is mycode Runtime myruntime = Runtime.getRuntime(); Process newproc = myruntime.exec("c:\\app\\pkzipc.exe -add c:\\output\\test.zip c:\\doc\\foo.pdf c:\\doc\\bar.doc""); `foo.pdf` and `bar.doc` are about 20MB each, if I execute this via commandline, then it take about a second to zip, but when I use the java, it take 30 min to 1 hours to finish the zipping. Any idea why?
You need to make sure that you are reading from the standard output and error streams of the child process. If pkzip generates output then it will be buffered by the operating system, and if the buffer fills up then you can expect the child process to block until the buffer is cleared. The `Process` object has methods for obtaining the input, output and error streams. Create new threads that read from the output and error streams and either pipe them to `System.out` and `System.err`, or just discard the output if you don't care about it.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java, zip" }
Working with nodejs api I'm new to nodejs and this is my first app. I am trying to use a nodejs API called event registry to get some data. Implementation below: app.get('/eventregistry', function(req,res){ console.log("dfsdfdf"); var er = new erBase.EventRegistry({apiKey: "API Key"}); er.getConceptUri("syria").then((conceptUri) => { var q = new erBase.QueryArticlesIter(er, {conceptUri: conceptUri, sortBy: "date"}); q.execQuery((items) => { for(var item of items) { console.info(item); } }) }); }); My problem is when I run the server and go to the route nothing happens. My event package is installed and required as well. What am I doing wrong?
you must send a response back to client using that `res` object in your callback function: app.get('/eventregistry', function(req,res){ console.log("dfsdfdf"); var er = new erBase.EventRegistry({apiKey: "API Key"}); er.getConceptUri("syria").then((conceptUri) => { var q = new erBase.QueryArticlesIter(er, {conceptUri: conceptUri, sortBy: "date"}); q.execQuery((items) => { for(var item of items) { console.info(item); } res.status(200).json(items); // as example }) }); }); I highly recommend you reading express documentation, exceptionally their Response Object part.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, node.js, express" }
UserControl inside Panel inside UserControl not working I am having some trouble creating the template of my application : I am making some dynamic parts of forms and I use a panel in which I include my User Control according to the choice of the user. The panel has the same size as the user control but it doesn't work at runtime. The panel in which the UC is included is inside another UC also. I tried `autoSize = true`, fixed size and many things but I don't know why it goes like this. Any idea? Some parts of my code to load the User Control : UC_panel.Controls.Clear(); UC_ADDRESS uca = new UC_ADDRESS(); uca.Dock = DockStyle.Fill; uca.AutoSize = true; UC_panel.Controls.Add(uca); My UserControl for the address At runtime it goes bigger
Since you set uca.Dock = DockStyle.Fill; and also uca.AutoSize = true; (which is redundant) it is possible that some other container has its `AutoScaleMode` set to `Font` and its font size is bigger.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, winforms, user controls, panel" }
Matching repeating groups of characters I'm trying to match groups of alphanumerics, optionally separated by the dash `-`. For example, * `ABC` * `ABC-DEF` * `123-DEF-ABC` but not * `-` * `-ABC` * `ABC-` I've managed to do this in the backend (Java) with `\w+(\-?\w+)*` which works well enough, but it doesn't seem to translate to JS. I've tried many permutations with various flag settings, to no avail. What am I doing wrong? The unit tests can be found here. Setting the sticky flag seems to pass most tests, except for the ones with a dash at the end. Thank you
You could use /^\w+(-\w+)*$/g with match for start and end of the string, for it. var strings = ['ABC', 'ABC-DEF', '123-DEF-ABC', '-', '-ABC', 'ABC-']; strings.forEach(function (a) { console.log(a.match(/^\w+(-\w+)*$/g)); // with g ^ }); strings.forEach(function (a) { console.log(a.match(/^\w+(-\w+)*$/)); // without g ^ }); .as-console-wrapper { max-height: 100% !important; top: 0; }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "javascript, regex" }
qunit - test exception message? So QUnit provides the "raise" assertion to test if an exception is thrown. Is there any way to test the actual message thrown by the exception, though? For instance, say I have this function: throwError = function(arg) { var err = new Error(); if (typeof arg === 'undefined') { err.message = 'missing parameter'; throw err; } } I'd like to be able to write something along these lines: raises( function(){throwError();}, Error.message, 'missing arg' ); Ideally, this test would fail because the exception message is "missing parameter" and I expect it to be "missing arg," but it passes because qunit only checks that an error was raised. Any way to check the actual contents of the thrown exception?
I figured out the answer, posting here in case others find it useful. Given this function: throwError = function(arg) { var err = new Error(); if (typeof arg === 'undefined') { err.message = 'missing parameter'; throw err; } } The test would look like this: raises( function(){ throwError(); }, function(err) { return err.message === 'missing arg'; }, 'optional - label for output here' );
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 10, "tags": "javascript, unit testing, exception, tdd, qunit" }
How to populate list<t> elements inside a class? I have a problem about populating `list<>` elements. I tried to set a value to first element of `list<>` object but it didn't work. Here is my two classes: **CLASS** class hotel { public List<room> rooms = new List<room>(); } class room { public string roomName; } **Form1.cs** private void Form1_Load(object sender, EventArgs e) { string word = "example"; hotel[] h = new hotel[3]; for (int i = 0; i < h.Length; i++) { h[i] = new hotel(); h[i].rooms[i].roomName = word;//It gives "Index out of range exception" error. } }
You're getting an error because, while you have created a new `hotel`, you haven't added any `room`s to it. Your code would have to do something like the following: for (int i = 0; i < h.Length; i++) { h[i] = new hotel(); h[i].rooms.Add(new room { roomName = word }); } If you want to add multiple rooms, you would either need to call `Add` multiple times or do so inside of an inner loop: for (int i = 0; i < h.Length; i++) { h[i] = new hotel(); // Add 10 rooms for (int a = 0; a < 10; a++) { h[i].rooms.Add(new room { roomName = word }); } }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "c#" }
Unable to start Android 4.4 AVD I guess the title is self explanatory. I created a AVD - Target - android-19 Device - 5.4" FWVGA Memory => RAM - 768 and VM Heap - 32 Internal Storage - 200 But I am not able to start it. I copied the platform/android-19 folder from another laptop and also the android-19 system image. But I dont think that should be a problem. I can see the android-19 option in the drop-down but the AVD is not getting started. Here is the screenshot while creating the AVD - !enter image description here Any ideas what went wrong?
!enter image description here Please delete the existing AVD and create a new as per the image instructions. I've done it for you at my side newly with your requirement and it is up well as indicated in the image. I believe you've updated your SDK through SDK manager as the latest is 4.4.2, if not, do that as well and check All the Best !
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, android virtual device, android 4.4 kitkat" }
How to create a stylish tab contol with items inside it like visual studio 2010 I want to develop an application. I want to create a stylish tab control and display pictures like Form1.cs looks like in visual studio tab control ,and i want to highlight it a yellow color when it is clicked. you can understand by seeing this image, !enter image description here There would be a great appreciation if someone could help me. Thanks In Advance.
You need WPF. AFAIK, AvalonDock is one good library made for very similar look. You need to check its forum for examples and latest discussions.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, winforms" }
Get a list of all author IDs for a given given university with pybliometrics I am trying to get the complete list of author IDs associated with a given University. I tried to do it from the Scopus web page but my request exceeded the allowed quota. Any possible solution for this?
You'd use the AuthorSearch class for that. Scopus hides the documentation for this API here, so it's a bit tricky to find all the allowed fields. What you want is the key "AF-ID": from pybliometrics.scopus import AuthorSearch q = "AF-ID(60105007)" s = AuthorSearch(q) print(s) The results are in `s.authors`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "scopus, pybliometrics" }
Excel custom formatting for negative numbers How would I create an Excel custom formatting option that displays negative numbers as zero? Right now I'm using this `##;"0";0` but it ignores values such as 0.25, 0.85 and 0.366666667 (only seems to acknowledge 1 or greater). How can I resolve this?
How many decimal values are you looking to use? `##` will not show any, so `0.2` will become `<empty>`, but `##.#` will return `.2`. To round out the format based on what you're looking for, on my own machine I used `##.###;"0";0`. If you want the leading zero (`0.2` vs. `.2`), then use `#0.###;"0";0`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "excel" }
Clash between hyperxmp and authblk Here is a MWE: \documentclass{article} \title{Title} \author{Author} \usepackage{hyperxmp} \usepackage{hyperref} \usepackage{authblk} \usepackage{pdfcomment} \begin{document} \maketitle some text \end{document} This leads to multiple "token not allowed in PDF string" warnings. This can be reproduced without the `pdfcomment` package, but it certainly makes things much worse. I believe something happens when processing metadata; a related situation occurs hyperref’s pdfusetitle option fails with authblk, but the situation isn't exactly the same.
Set the author for the pdf metadata with `pdfauthor`. Then hyperxmp will no longer try to get it from the `\author` command which `authblk` redefines in an way quite unsuitable for pdf metadata: \documentclass{article} \title{Title} \author{Author} \usepackage{hyperxmp} \usepackage[pdfauthor={Author}]{hyperref} \usepackage{authblk} \usepackage{pdfcomment} \begin{document} \maketitle some text \end{document}
stackexchange-tex
{ "answer_score": 0, "question_score": 0, "tags": "hyperref, authblk, hyperxmp" }
Handling multiple SSH keys/configs I have two SSH keys 'personal' and 'work'. With them I need to connect to a service: `[email protected]`. The keys are linked to two accounts on service.com, however in SSH they both have to use the same user 'user'. Thus I can't use `~/.ssh/config` and 'Host's to route the two keys to the correct accounts. As a result, I put the 'work' key into `~/.ssh/config` using `Host`, and comment it out when wanting to do stuff with my 'personal' key. My question is, is there a better way to handle this? When I interact with that service, I will `source somefile.sh` anyway so having some environment variable in there to handle the routing would be ideal, but I can't find a way to change, for example, the ssh config file path, using environment variables. I don't use `ssh` directly but rather through a 3rd party tool. Is there such a variable? I'm on Linux (Ubuntu).
You could have two entries in `~/.ssh/config` and have whatever settings you need: Host work User workid HostName service.com Host personal User homeid HostName service.com Then you can do `ssh work` and `ssh personal`. Basically the trick is: the `Host` part does not have to be a real DNS host name, it can be whatever you want.
stackexchange-superuser
{ "answer_score": 4, "question_score": 2, "tags": "linux, ssh" }
Entity framework How to prevent duplicate entries into db I am using EntityFramework to save a project version number to database .On the UI page user types in version(major,Minor,Build) integer values and click save button Before I save ,I want to ensure that no duplicate version is getting created in the DB. what I am trying is to make sure that major.minor.build combination is unique ProjVersion newVersion=new ProjVersion (); newVersion.Major=10; newVersion.Minor=1; newVersion.Build=1; this.repository.Add<ProjVersion>(newVersion); //here how can I ensure that no duplicate versions are added to database this.repository.SaveChanges(); [Serializable] public class ProjVersion { [Key] public int Version_Id { get; set; } public int Major { get; set; } public int Minor { get; set; } public int Build { get; set; } }
Check if there are any entries in the database that have the same details as what you're trying to add. If not, then it's a new version and you should add it, if so then it's a duplicate and you should do whatever you want to handle that situation. if (repository.Get(x => x.Major == newVersion.Major && x.Minor == newVersion.Minor && x.Build == newVersion.Build) .Count() > 0) { //notify the user that they are making a duplicate entry } else { repository.SaveChanges(); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, entity framework" }
How to use ansible's user option - ssh_key_bits? Is there any example on how to provide the SSH key for a user using the ssh_key_bits option? The documentation only specifies the 'password' option and searching for 'ssh_key_bits' only has 5 pages on Google and none of them are useful.
Sure you can try something like this: --- - name: Create User with ssh key bits hosts: all user: youruser sudo: True tasks: - name: Create user user: name=newuser generate_ssh_key=yes ssh_key_bits=4096
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ansible" }
Как задержать заставку на 5 секунд в xcode? Доброго времени суток. На реальном устройстве заставочная картинка проскакивает не успеешь моргнуть глазом, как её задержать скажем секунд на 5 используя (NSTimer)?
Во `viewDidLoad` первого `UIViewController`, который должен появиться на экране sleep(5);
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ios, xcode" }
Make WordPress show the same page on two different url patterns I need to make WordPress show the same page on two different URLs: _* I can only use functions.php_
I used a few similar cases and guides and here is code which worked out for me: function tail_rewrite() { add_rewrite_rule('^([^/]*)/tail?', 'index.php?name=$matches[1]', 'top'); // first parameter for posts: p or name, for pages: page_id or pagename } add_action('init', 'tail_rewrite'); > don't forget to flush the rules by visiting Settings > Permalinks OR use flush_rewrite_rules() in the plugin activation (don't execute it at every page load).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "wordpress, url, url rewriting, permalinks" }
Spring AOP: Getting parameters of the pointcut annotation Consider I have defined the following aspect: @Aspect public class SampleAspect { @Around(value="@annotation(sample.SampleAnnotation)") public Object display(ProceedingJoinPoint joinPoint) throws Throwable { // ... } } and the annotation public @interface SampleAnnotation { String value() default "defaultValue"; } Is there a way to read the value parameter of the annotation SampleAnnotation in the display method if my aspect? Thanks for your help, erik
Change the advice signature to @Around(value="@annotation(sampleAnnotation)") public Object display(ProceedingJoinPoint joinPoint, SampleAnnotation sampleAnnotation ) throws Throwable { // ... } and you will have access to the value in the annotation. See docs for more info.
stackexchange-stackoverflow
{ "answer_score": 48, "question_score": 30, "tags": "spring, aop, spring aop" }
how to add badge to UIButton similar to Fab Apps and increment it when user clicks the button I need to add a message like badge to `UIButton` and how to increment the badge on click of `UIButton`. Someone could help me please. Now how to customize the shape similar to the badge having 36. What control are they using. < Thanks..
Badge having 36 is an UIView that is added. U can add UIImage that is having shape like background and update UILabel that is 36 now. For badge on uibutton, Refer this link
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, objective c" }
R sprintf maximum two decimals but no leading zeros As per the title, I need a string format where sprintf(xxx,5) prints "5" sprintf(xxx,5.1) prints "5.1" sprintf(xxx,15.1234) prints "15.12" That is: no leading zeros, no trailing zeros, maximum of 2 decimals. Is it possible? if not with sprintf, some other way? The use case is to report degrees of freedom which are generally whole numbers, but when corrected, may result in decimals - for which case only I want to add two decimals).
Maybe `formatC` is easier for this: formatC(c(5, 5.1, 5.1234), digits = 2, format = "f", drop0trailing = TRUE) #[1] "5" "5.1" "5.12"
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "r, format, printf" }
cannot find inApp purchase option in app summary I have create app with in app purchase. It is mandatory to upload it for review but my problem is that i cant find option in app summary like this image.!enter image description here Above image is from another app where i found it but in my current app it is not visible. I have enabled in App purchase in my app id.
First I had selected "YES" for Hosting content with apple but when I changed it to "NO", then my problem got solved. Now it shows option for in App Purchase in App Summary.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, iphone, in app purchase" }
CSS Multiple background Images In CSS we can give multiple background images to a div by specifying background-image: url(img_flwr.gif), url(paper.gif); Will all the images specified here will load? Or if first image is not available, then the second image will load? If all the images will get loaded, isn't it affect the loading time of the website?
The different background images are separated by commas, and the images are stacked on top of each other, where the first image is closest to the viewer. You can read more on MDN
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "html, css" }
ORA-00920: invalid relational operator when using aggregate inside sub query I am writing a simple query in Oracle, SELECT CN.MyColumn1, SUM(CN.MyColumn2 - CN.MyColumn3 + CN.MyColumn4), (CASE WHEN EXISTS ( SELECT 't' FROM Table1 CN2 WHERE CN2.MyColumn1 = CN.MyColumn1 AND CN2.MyColumn5= 0 AND (CN2.MyColumn2- CN2.MyColumn3+ CN2.MyColumn4) >= SUM(CN.MyColumn2- CN.MyColumn3 + CN.MyColumn4) * 0.5) THEN 'Yes' ELSE 'No' END) FROM Table1 CN GROUP BY CN.MyColumn1 HAVING SUM (CN.MyColumn2- CN.MyColumn3 + CN.MyColumn4) < 6; But I am getting > SQL Error [920] [42000]: ORA-00920: invalid relational operator
The problem stems from `SUM` aggregation being used in `SUM(CN.MyColumn2- CN.MyColumn3 + CN.MyColumn4) * 0.5)` which needs to be used within `HAVING` clause. You may try to use the one below : SELECT CN.MyColumn1, SUM(CN.MyColumn2 - CN.MyColumn3 + CN.MyColumn4), (CASE WHEN EXISTS ( SELECT 't' FROM Table1 CN2 WHERE CN2.MyColumn1 = CN.MyColumn1 AND CN2.MyColumn5= 0 HAVING (CN2.MyColumn2- CN2.MyColumn3+ CN2.MyColumn4) >= SUM(CN.MyColumn2- CN.MyColumn3 + CN.MyColumn4) * 0.5) THEN 'Yes' ELSE 'No' END) FROM Table1 CN GROUP BY CN.MyColumn1 HAVING SUM (CN.MyColumn2- CN.MyColumn3 + CN.MyColumn4) < 6; `Demo`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql, oracle, subquery" }
Logging framework for mixed C#, managed C++, and unmanaged C++ application **Specific Background:** I have a Word Add-In written in C#. This Add-In calls a plugin developed for another application (EndNote) written in C++, which is further divided into managed and unmanaged code. The C# code is run from one process, while the C++ code is run from another. Furthermore, the C++ code is multithreaded. I've been considering using either one of or a combination of the following, but am open to other suggestions: * log4net * log4cxx * nlog * System.Diagnostics.Trace * System.Diagnostics.TraceSource What would you use?
I would pick a framework for C# and one for C++ (have you consider log4cplus?) and decide which one can be easily adapted so that its log output is written to the other framework. Which one to pick depends on the structure of your code ("who knows whom?").
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "c#, .net, c++, logging" }
Source and destination IP of ICMP packet I am capturing packets with Sharp Pcap, I can easily check IP of IPpacket or ARP packet: Dim ip1 As IpPacket = IpPacket.GetEncapsulated(pack) Dim arp As ARPPacket = ARPPacket.GetEncapsulated(pack) If (Not ip1 Is Nothing) Then log1.WriteLine("Received IP packet from {0}", ip1.SourceAddress.ToString) End If If (Not arp Is Nothing) Then log1.WriteLine("Received ARP packet from {0}", arp.SenderProtocolAddress.ToString) End If I wanted to find properties for ICMPPacket, with no luck. How can I check source/destination address of ICMPPacket?
ICMP packet is part of IP packet, thus to get source IP of ICMPPacket, you have to get source address of IP packet then check if it's ICMPPacket
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net, sharppcap" }
Why php json_encode encodes two dimensional array but outputs pure array $my_array = array( 0 => array( 1, 2, 3, ), 1 => array( 1, 2, 3, ), 2 => array( 1, 2, 3, ), ); echo json_encode($my_array); Result is this: [[1,2,3],[1,2,3],[1,2,3]] I thought the output should be a string of json,but here outputs a pure array,why?In other words,the result should be quoted,but why this is not.
Use `JSON_FORCE_OBJECT` with `json_encode()` echo json_encode($my_array, JSON_FORCE_OBJECT); **Program Output** {"0":{"0":1,"1":2,"2":3},"1":{"0":1,"1":2,"2":3},"2":{"0":1,"1":2,"2":3}} **DEMO**
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php, json" }
Getting Windows error reporting dialog In my C# app, even I handle exception : Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); and then in handler showing dialog box and doing Application.Exit still getting windows error reporting dialog with Send, Don't Send... How to prevent windows error reporting dialog from popping up? * * * In fact if the exception is thrown from main form constructor then the program ends up with Windows error report dlg. Otherwise if from some other location of UI thread, then as expected.
You'll need to terminate the app yourself. This will do it: static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = e.ExceptionObject as Exception; MessageBox.Show(ex.ToString()); if (!System.Diagnostics.Debugger.IsAttached) Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(ex)); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, exception, unhandled" }
How to use reduce() to convert multidimensional array to key value pairs? I have a multidimensional array that I would like to rearrange to a key:value pair. This is the code I have already: var userSavedScenario = [["Nigeria",1,"Solar"],["Ghana",20,"Wind"]] var mongoForm = userSavedScenario.reduce(function(acc,scenario) { var mongoDBForm = { 'country':scenario[0], 'capacity':scenario[1], 'fuel':scenario[2] } acc[scenario] = mongoDBForm return acc },{}) The output of this is: {Ghana,20,Wind={country=Ghana, fuel=Wind, capacity=20.0}, Nigeria,1,Solar={country=Nigeria, fuel=Solar, capacity=1.0}} How do I get the result to only be: {country=Ghana, fuel=Wind, capacity=20.0},{country=Nigeria, fuel=Solar, capacity=1.0}
I'd suggest you use `Array.map` instead of `Array.reduce`. For example: var userSavedScenario = [["Nigeria",1,"Solar"],["Ghana",20,"Wind"]]; var result = userSavedScenario.map(function(row){ return { "country":row[0], "capacity":row[1], "fuel":row[2] }; }); console.log(result);
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "arrays, multidimensional array, google apps script, reduce" }
How Google OAuth 2.0 Java library take care of Access Token! if Client ID, Secret and Refresh Token is provided.? Code snippets for Building OAuth 2.0 credentials : Credential credential = new GoogleCredential.Builder().setTransport(httpTransport) .setJsonFactory(jsonFactory) .setClientSecrets(myAppClientID, myAppSecret) .build(); credential.setRefreshToken(userRefreshToken); I am using Java Library in order to get the Google Analytics Data. I do have Client ID, Secret and Refresh Token. I am accessing Google Analytics API though this credentials information, **My question is, Will Google OAuth 2.0 take care of Access Token Automatically? Or Do i need to handle it manually with some mechanism? If i am not passing access token to this code.**
From the Credential API doc: > Thread-safe OAuth 2.0 helper for accessing protected resources using an access token, as well as optionally refreshing the access token when it expires using a refresh token. So if you don't specify an access token, it will be automatically fetched using the refresh token. But since you already have an access token, I would say it's good to set it - it will save the first network call to the `/token` endpoint.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "oauth 2.0, google oauth, google oauth java client" }
select multiple form how can i make a form where you dont need to hold down control key to select multiple options ? i want to make it so that when you just click on any of the options, they will be highlighted.
Create a list of checkboxes instead of using a list box: < This List Box containing checkboxes will also work: **JavaScript ListBox Control** <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "html, css" }
What is visibility in XML? dimen, string, etc (Android) I want to have different visibility for each version (JB, KK and L). Then, I have some attr.xml files for each version, before I was using dimen value to set its height to 0 or X dpi, but now I need to remove the view. What is visibility? is not a dimen, is not a string... how can I get it from my attr to my view with `android:visibility="@XXXXXXX/myViewVisibility"` With the height I use `android:visibility="@dimen/myViewHeight"` and it works perfectly... Thanks in advance.
It is an enum. You can find the definition for the enum in the framework's attrs.xml (line 2163). You can use an integer reference if you really want to use a resource reference, but I don't recommend it in case (for whatever reason) those constants change in the future. For example: <resources> <!-- 2 corresponds to "gone" --> <integer name="my_visibility">2</integer> </resources> <View visibility="@integer/my_visiblity" /> A style would also work for version-specific visibility, like so: <style name="MyViewStyle"> <item name="android:visibility">gone</item> </style> <View style="@style/MyViewStyle" />
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "android, xml, visibility, attr" }
Can these Chinese cameras be used as webcams? There are many cameras sourced from China that seem to be rebrands of the same item. A mere sample of Amazon links includes SJCAM AKASO Campark COOAU. There are many more. I don't know what electronics are in them, but they sure appear to at least use the same enclosure and lens. There is one Ask Ubuntu question already, which seems to indicate that this type of camera worked in a previous version, but no longer does. What I would like to do is use the USB3 cable to connect such a camera to my PC and use it as a webcam. None of these inexpensive cameras are listed in the gphoto database of Linux-compatible cameras. Any assistance would be appreciated. Edit: another existing Ask Ubuntu question about the same camera.
I did in fact buy one, and it works fine as a webcam on my box, at full resolution and frame rate. Also mounts as an external (MTP) drive perfectly.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 1, "tags": "usb, webcam, compatibility, camera" }
Ubuntu is not detecting my LCD properly , how do I fix the problem? I want to reduce the brightness of my monitor as per my wish . But ubuntu System->Prefernce->Monitor doesn't have options and I think that coz it uses generic drivers . How do I fix this problem ? Model is Acer One Zg5 , Ubuntu 10.10 OS . Do I load the LCD driver ? I think it has a intel based inbuilt GFX card . /proc/acpi/video/OVGA/LCD$ cat * device_id: 0x0400 type: UNKNOWN known by bios: no state: 0x1d query: 0x00
What happens if you exec `$ cat /proc/acpi/video/DGFX/LCD/brightness` ? Do you have any brightness dev file in your `/proc/acpi/video/OVGA`? If yes, then try to adjust that value using `echo 100 > /proc/acpi/video/DGFX/LCD/brightness` else put a comment… ;)
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "ubuntu, drivers, lcd" }
Ruby blocks and optional arguments: {|x=1|} Why is `x=1` an optional argument here: proc {|x=1|}.arity # => 0 Looking at the docs (< I don't see anything that explains why `|x=1|` means the parameter is optional whereas `|x|` means it's not optional.
`|x=1|` declares a block argument with a default value. If the argument has a default value, that means it can be omitted and the default is used instead. Any argument that can be omitted, is by definition, optional. Though it looks like ruby 1.9 allows you omit any argument in a block, and that will simply be set to `nil`. So you can for the result you want if you simply don't use block argument defaults, and do it manually instead. # Your proc proc { |x=1| puts x }.arity #=> 0 proc { |x=1| puts x }.call #=> 1 # suggested edit proc { |x| x ||= 1; puts x }.arity #=> 1 proc { |x| x ||= 1; puts x }.call #=> 1
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby" }
Oracle 12c: ORA-06575 Package or function name_of_func is in an invalid state I am trying to create a function that takes an input(character data) and replaces a set of specific characters. The function I have created so far is the following CREATE FUNCTION name_of_func(input VARCHAR(4000) RETURN VARCHAR(4000) IS BEGIN return replace(replace(replace(replace(replace(input, '\', '\\'), CHR(10), '\n'), CHR(13) || CHR(10), '\n'), CHR(13), '\n'),'"', '\"'); END name_of_func; How can I get this function to be compiled?
You can't specify the size of parameters in the function definition: SQL> CREATE OR REPLACE FUNCTION name_of_func(input VARCHAR) 2 RETURN VARCHAR IS 3 BEGIN 4 return replace(replace(replace(replace(replace(input, '\', '\\'), CHR(10), '\n'), CHR(13) || CHR(10), '\n'), CHR(13), '\n'),'"', '\"'); 5 END name_of_func; 6 / Function created. SQL> select name_of_func('dfghjk') from dual; NAME_OF_FUNC('DFGHJK') -------------------------------------------------------------------------------- dfghjk SQL>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "oracle, oracle12c" }
Refraction quality is lower in rendered image than in the viewport preview I was playing around with Glass BSDF shader to see what it look like and how it interacts with its environment. Bellow, you can see a test scene. Preview![test render of a cube sphere and suzanne]( Final ![enter image description here]( The preview render on the sphere looks fine but when a final render was done the refraction of the checker-board was pixelated and distorted. The final render was done with 400 samples. Is that too little or am I missing something. Is there a way to improve render quality of the refraction in the glass sphere? File here : ![](
The problem is that you are using flat shading on the mesh, as opposed to smooth shading that interpolates normals: < The reason why it looks ok in the viewport is that your subdivision surface modifier is set to 4 iterations for the viewport and 2 iterations for the final render. So the high subdivision in the viewport hides the flat shading. Solution: Set viewport subdivisions equal or lower than final subdivisions, and enable smooth shading on the mesh (see above link).
stackexchange-blender
{ "answer_score": 4, "question_score": 2, "tags": "rendering, glass" }
How use a print statement from a defined function in Python How can I call this defined function with customized text before each animation, so i can just print it like `print(Anim("text"))`? import time import sys animation = "|/-\\" def Anim(text): for i in range(20): time.sleep(0.1) sys.stdout.write("\r" + animation[i % len(animation)]) sys.stdout.flush()
**Answer:** thanks to @Matthias sys.stdout.write(f"\r{text}" + animation[i % len(animation)])
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, function, printing" }
Zend Framework - redirect without echo before doesn't work The code below **DOESN'T** redirect: return $this->_helper->redirector->gotoUrl('/customer/'); but this one **DOES** redirect: echo 'redirect'; return $this->_helper->redirector->gotoUrl('/customer/'); Any ideas? They both work on my localhost but only the second works on my client's machine. I could add echo 'something' before every redirect call but not sure why it works that way.
Try once like this : $this->_redirect("/customer/"); It will surely work.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "zend framework, redirect, header" }
Set translated field I'm having some trouble finding how to handle field translations in the documentation. I have a requirement to keep certain fields in English and Japanese. I periodically have to update nodes and taxonomy terms programmatically. I'm doing this with a combination of EntityQuery and the Entity class. Is there a set function that takes a language code? For example; $term->set('field_my_field', 'my value', 'ja');
You update another translation by getting an object for that language, and then you set the values of those fields. $translation->set('field_my_field', 'my en value'); $translation = $term->getTranslation('ja'); $translation->set('field_my_field', 'my ja value'); $translation->save(); Those translation objects are actually shallow clones that have a different internal active language code, so you can update multiple translations and then save, for example.
stackexchange-drupal
{ "answer_score": 8, "question_score": 3, "tags": "8, i18n l10n" }
How the changing the app Display Name is affect the app status My app is submitted and has 'live & listed' status. So, if i change the Display Name field - will this affect the app status and App Center listing?
> Once you have submitted your app detail page, the values cannot be changed until your app is listed or you cancel the submission. Once your app detail page is listed in the App Center, all future changes to the page will also be subject to review. For more details: App Center Tutorial
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "facebook, status" }
Getline is reading strings as characters I have a text file with one line of information structured as follows: > Manufacturer ModelNumber SerialNumber I am trying to use getline to retrieve the information: std::string vendorID; std::ifstream vendFile; vendFile.open(fNameVendID); std::getline(vendFile, vendorID); printf("Info: \t\t%s\n", vendorID); The output to the console is: > E2^ Am I missing something here with getline? It looks like it is printing the three different "words" from the text file into three characters.
`printf %s` modifier expect a C-like `char*` string, not an `std::string` printf("Info: \t\t%s\n", vendorID.c_str()); or just, in standard C++ , forget about `printf` : std::cout << "Info: \t\t" << vendorID << std::endl;
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "c++, std, getline" }
how to call member functions when the objects is variable template parameters how to call member functions when the objects is variable template parameters? Here's a example: template <typename ...A> void f(A... args) { args->memfunc("examples")...; // the code not right! } How to do it right?
In C++17, you can use a fold expression: template <typename ...A> void f(A... args) { (..., args->memfunc("examples")); // the code not right! }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c++, templates" }
Автоматическая генерация свойств класса Привет, ХэшКод. Подскажите, пожалуйста, как можно добавить свойства классу в рантайме? К примеру, я получаю на вход Dictionary или HashTable и из ключей, которые в них есть, сгенерировать свойства, которые возвращали бы значения ключей. Возможно ли такое? Спасибо.
Динамическое добавление свойств достаточно трудоемкий процесс, использующий .NET3.0. Как уже было замечено, обращаться затем через рефлексию к методам тоже тяжело. Язык С# строго типизирован, хотя наблюдается некоторое смещение акцента в последнее время. Если вас еще интересует, то посмотрите в сторону ExpandObject. Вот небольшая ссылка на stackoverflow.com
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#" }
Using bluetooth mouse and keyboard on windows remote desktop android app? I want to have access to a bluetooth keyboard and a bluetooth mouse connected to my android phone when using windows remote desktop to my pc. Would this work? Would the bluetooth devices need to be compatible with android, windows, or both?
this works. I've recently bought an samsung galaxy tab s6 and i use remote desktop to connect to my windows pc at home. I'm using a bluetooth mouse and keyboard right now as I am typing this to you. I have a rapoo bluetooth mouse and a trust mini keyboard, also using bluetooth.
stackexchange-superuser
{ "answer_score": 0, "question_score": 1, "tags": "windows, remote desktop, android" }
Google Cloud: Why my instance has 3 users created by default? I have a virtual machine instance (Debian wheezy) running on Google Compute Engine. At the time of creation of the instance, by default there were 3 users (apart from `root`) in the `/home` directory. For example, if my email id (with which I login to Google cloud platform) is `[email protected]` then the 3 users in the `/home` directory are `ab`, `abxyz` and `ab_xyz_co`. I don't understand what's the point of creating 3 different users. When I login, by default I am logged into the machine as the user `abxyz`. I also cannot assume that the other two users (`ab` and `ab_xyz_co`) just exist and are never used, because I can see some folders in the home directory of other 2 users whose size change whose time. Moreover, the sizes of these folders are different, i.e. same things are not being added to all the accounts. What's going on? Any ideas?
These are likely users you have SSH keys configured for in your project. Look at ` project>` to see if that's the case. You can delete SSH key records for the users you don't want to be present in the new instances. You will need to delete those users manually in the instances that are already running in the project though.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "cloud, virtual machine, google compute engine, google cloud platform" }
How can I make rake tasks run in an environment other than dev? I have a staging machine with a special "staging" environment. I always forget to run rake tasks on that machine like: rake jobs:work RAILS_ENV=staging So instead I end up doing: rake jobs:work And then I'm mystified why nothing has changed in my database. Doh! It's because I didn't remember to supply RAILS_ENV=staging. But I will never, ever need to run anything as the development environment on that server. How can I make rake tasks run in the "staging" environment by default?
You can put a line that sets the environment variable `RAILS_ENV` in a file that will get run when you log onto the machine. For example, I'm a bash user, so I'd put the line export RAILS_ENV=staging In either ~/.bashrc (just for me) or /etc/bashrc (for everyone who logs onto the machine). Hope this helps!
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "ruby on rails 3, rake" }
Sort items of globals() by created time Working in IPython, I input 3 assignments: In [1]: foo = 1 In [2]: bar = 2 In [3]: zoo = 3 I intend to fetch a dict of them. In [4]: globals() Out[4]: {... 'bar': 2, 'exit': <IPython.core.autocall.ExitAutocall at 0x10e61b048>, 'foo': 1, 'get_ipython': <bound method InteractiveShell.get_ipython of <IPython.terminal.interactiveshell.TerminalInteractiveShell object at 0x10e617208>>, 'quit': <IPython.core.autocall.ExitAutocall at 0x10e61b048>, 'zoo': 3} `globals` prints a dict in an alphabetical order, so I cannot select them all with one opearation. How to get an dict from globals() in assignnent_created order?
Firstly, globals doesn't track the order of creation. Secondly, you can try removing unwanted items and then sorting the dictionary like so: remove_keys = ['exit', 'get_ipython'] g = sorted( dict( (k,v) for k,v in globals() if k not in remove_keys ) )
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python" }
How to protect myself against unauthorized recurring CC charges? A gym I used to be a member of and to which I owe no more contractual obligation but are being difficult about membership cancellation still have my CC info. I changed my CC number hoping their not having my new number would prevent them from making charges. However, the CC company says that, because they have a recurring payment set up, they were able to roll over to having access to my account despite the new number. Rather than dealing with the vendor, who have proven to me to be an unethical business practitioner, I wanted to stop their access to my CC and prevent further charges. I called my CC but they said they were not able to do that, much to my surprise and dismay. How can I stop an unauthorized entity from charging my CC if they have account info without cancelling the card account altogether (I have a dividend mile program)?
The bank SHOULD be able to issue you a new card without letting vendors roll over the recurring payments. In fact, I've never had a bank move recurring payments to a new card automatically, or even upon request; they've always told me to contact the vendor and give them my new card number. So go back to the bank, tell them specifically that you have a security issue and you want the new card issued _WITHOUT_ carrying over any recurring charges, and see if they can do it properly. If not: 1) Issue a "charge back" every time a bogus charge comes in. This costs the vendor money, and should convince them to stop trying to access your card. It's a hassle because you have to keep contacting the bank about the bad charges, but it won't cost you more than time and a phone call or letter. (The bank can tell you what their preferred process is for this.) 2) Consider moving to a bank that isn't stupidly over-helpful.
stackexchange-money
{ "answer_score": 11, "question_score": 6, "tags": "united states, credit card" }
retain CKEditor scroll bar at cursor position I'm using the similar code to retain cursor position for ckeditor. var range = null; editor.on( 'blur', function() { range = editor.getSelection().getRanges()[ 0 ]; }); someElement.on('click',function() { var editor = CKEDITOR.instances.editor1; if(editor){ editor.focus(); range.select(); } }); I'm able to retain cursor position but the scrollbar scrolls to the top. How can i keep/retain the scrollbar at same position as of cursor's?
`range.select().scrollIntoView()` helped me out!!
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, jquery, ckeditor, ckeditor4.x" }
Restore RAID 0 storage volume after Windows 7 re-install? I have a RAID 0 storage volume in Windows 7 with 3 disks and I want to re-install Windows to the OS drive. If I do this, will Windows recognize the previous RAID array and configure appropriately? Note 1: Windows is not installed to the RAID. Note 2: The RAID is a Windows RAID, not a device RAID.
While the answer is "yes", it has nothing to do with appropriate drivers (since this is a Windows RAID). In Disk Management, the drives will appear as 'Dymamic', but unusable. Right-clicking one of the drives and selecting an option, I believe it was something along the lines of 'Create dynamic volumes', allows restoration of the drive volume. This worked on my RAID 0 with 3 disks.
stackexchange-superuser
{ "answer_score": 0, "question_score": -2, "tags": "windows 7, software raid, raid 0" }
Assign value to an array object in Java I am attempting to assign a value to an array object like this: public class Players { String Name; } Players[] player = new Players[10]; String name = Mike; player[1].Name = name; I am getting a NullPointerException and am not sure why. What could be causing this?
This is because creating a new array does not create individual objects inside the array; you should be creating them separately, e.g. in a loop. Players[] player = new Players[10]; for (int i = 0 ; i != player.length ; i++) { player[i] = new Players(); }
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 2, "tags": "java, arrays" }
How to find the minimum surface area enclosed by a boundary C? I am currently learning multivariable calculus and I was wondering how can I find the minimum surface area enclosed by a boundary C, as shown below.(This is not a exam/homework question, just something I thought of for fun.) r(t) is my take on parameterized this boundary. Any help would be appreciated ![AreaOfCurve](
This is a rather old question, and has a name -- it's called _Plateau's problem_ , and Fred Almgren wrote a nice little book about it back in the 1970s or so; there's probably lots of new stuff to consider since that time, but it's a good introduction. Anyhow, that's the keyword that you want to use for searching. No one can give you a complete answer here in the space of one math stackexchange answer. The general problem of optimization over classes of functions like this comes under the heading of "calculus of variations," which gives you another term to search. Stand warned: some of the notation varies from hideous (at worst) to baffling (at best) until you've used it for a while. One more thing: you talk about "the" surface of least area, but there are curves, like the seam on a baseball, for which there is no unique minimal spanning surface -- there may be two or more minimal surfaces!
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "multivariable calculus" }
How to catch client side errors I have angular2 project, how can I catch errors on client side, error 'Failed to load'. I want to control situation if some of html files doesn't exists my page wouldn't fail, but I'll get exception in console. Thank you.
As per my understanding, you want to handle exception, so you can done it in typescript using try catch and finally block. typescript allow us to use try catch. A reference for **Try Catch** < If you need in html, then you need to handle as case in html using some variables
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, angular2 routing, angular2 forms" }
Banach Algebra Question Suppose $A$ is a commutative Banach algebra with identity and $I\subset A$ is an ideal. If there is a _unique_ maximal ideal $M$ with $I\subset M$ does it follow that $I=M$? Or that $I$ is dense in $M$? An answer assuming $A$ is semi-simple would be enough; in fact the case I'm really interested in is $A=L^1(G)$ where $G$ is a discrete abelian group. (So this seems related to Wiener's Tauberian Theorem; if I'm recalling the definition correctly WTT says that $\emptyset\subset\hat G$ is a set of spectral synthesis, while the current question asks whether singletons are sets of spectral synthesis.)
As for your first question the answer is no, as there exist unital, commutative Banach algebras that are also local rings. For example, consider the unitisation of $$R = \\{f\in L_0((0,\infty))\colon \int\limits_0^\infty |f(t)|e^{-t^2}\, {\rm d}t <\infty\\},$$ endowed with the convolution product: $$(f\ast g)(t) = \int\limits_0^t f(t-s)g(s)\,{\rm d}s.$$ So $\\{0\\}$ is contained in $R$, the unique maximal ideal of $A$. I will reply for the second part later.
stackexchange-math
{ "answer_score": 1, "question_score": 4, "tags": "banach algebras, wieners tauberian theorem" }
PHP: Another regex I can't figure out I'm having trouble with 2 regular expressions in PHP **1\. stripping http(s):// and www.** => google.be/search?sclient=psy-ab&q=regex&oq=regex **2\. 3-30 characters, may contain a-zA-Z0-9.-_* but need at least one letter or number** Valid: -_l*96d.* Invalid: *-_. I've searched so long without any result so please help ! Many thanks!
preg_replace('/^(http|https):\/\/(www\.)?/i', '', $url)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -3, "tags": "php, regex" }
How to evaluate if a variable is equal to user input without having several if statements I'm fairly new to python and for the life of me I can't get this to work. I want to set this little script to check to see if what the user types in is equal to any of the names on the list and if it is execute a function. If what the user types in isn't one of the names it should do a different function. This seems like it should be simple but I can't figure it out. I've gotten it to work with multiple elif statements to check for each case but it seems like there should be a more elegant solution then simply typing out 50 elif statements every time I want to check for a name. Current script: names=['Scott', 'Doug', 'Sam', 'Harry'] typedname=str(input('What is your name?: ')) if typedname==['Scott' or 'Doug' or 'Sam' or 'Harry']: print('you are '+typedname) else: print('You are not in the names list')
if typedname in ['Scott', 'Doug', 'Sam', 'Harry']: print('You are', typedname): else: print('You are not in the names list') Python 3.2 brings an optmization for that cases: if typedname in {'Scott', 'Doug', 'Sam', 'Harry'}: will be translated to a `frozenset` and the search will be in constant time and the set will be built while compiling bytecode.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "python" }
Calculate $\vec{M}$ if $\vec{M} \cdot \vec{A} = c$ I am trying to solve an equation that involve the inner product of 2 vectors and I was wondering if there was a way to solve it. I know that $$ \vec{M} \cdot \vec{A} = c $$ Where $c$ is a constant scalar and vectors are in 2D space, Then how do I compute $\vec{M}$?
Since these are 2d vectors, we may write $M=(M_{1},M_{2})$, $A=(A_{1},A_{2})$, so your equation is $$M_{1}A_{1}+M_{2}A_{2}=c \implies M_{1}=\frac{c-M_{2}A_{2}}{A_{1}}$$ Therefore, if we let $t$ be any real number, the vector $$M=\pmatrix{\frac{c-tA_{2}}{A_{1}}\\\t}=\pmatrix{\frac{c}{A_{1}}\\\0}+t\pmatrix{-A_{2}/A_{1}\\\1}$$ satisfies your equation. There are many choices (as you should expect! If $c=0$, there are many vectors perpendicular to, say, $(1,0)$ - just take scalar multiples of them).
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "vectors, inner products" }
docker для чайника Поставил я docker и docker-compose на Win10, сделал три контейнера с nginx, php, mysql. Все работает, но не понятно как так. К примеру, я захожу через `docker exec -it` в контейнер c nginx, и там по факту у меня убунту стоит и я могу ставить там что хочу... Откуда она там взялась, почему при скачивании ее не было. Как так это происходит Кто может мне объяснить как это работает. Перечитал тонны материала, но никак не пойму. Мне бы простым языком как для дурака
> брал готовые типа nginx:latest и потом просто дописал конфиги на nginx и основной конфиг в docker-compose.yml. ничего дополнительно не собирал сам если «брали» с докерхаба, то, значит отсюда: < а там тег latest ведёт вот на такой dockerfile: FROM debian:stretch-slim ... т.е., образ `nginx:latest` строится на основе `debian:stretch-slim` (см. debian). отсюда и наличие программы `/usr/bin/apt`. * * * ну а по поводу программы, выполняющей функции оболочки (`/bin/sh`, `/bin/bash` и т.д. и т.п.): да, технически docker-образ без какой-либо оболочки собрать можно. вот только очень многие программы (внутри такого образа) не смогут после этого (нормально) функционировать.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "docker" }
Linux: Stopping tar command? Uh I badly messed up today, I was going to backup my whole website folder (public_html) and didn't realize that it was 24GB, now it's eating up disk usage and I have no idea how to stop it. The command I used was: tar -cvpzf /home/mywebsite/public_html/backup.tar.gz /home/mywebsite/public_html/ I deleted the existing backup.tar.gz from the directory but the command is still running and is still eating up disk space (even though the .tar.gz file no longer exists). How do I stop this?
ps -ef | grep tar Figure out the tar command's PID, then kill it with. kill <pid> For instance, `kill 1234` if it is PID 1234. Wait a bit, and if it hasn't died gracefully from that then hit it with the sledgehammer. kill -9 <pid> Alternatively, you could kill all running tar commands with a single command. pkill tar # if necessary pkill -9 tar Either way, once the process dies, the disk space will clear up. Deleting the file didn't help because a running process still has the file open. Files aren't truly deleted until they're removed _and_ they're not open in any process.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 4, "tags": "linux, tar" }
AMD-V is being used by another hypervisor. (VERR_SVM_IN_USE) When I try to open any OS on Oracle VirtualBox an error accurate. Failed to open a session for the virtual machine xp efendi. AMD-V is being used by another hypervisor. (VERR_SVM_IN_USE). VirtualBox can't enable the AMD-V extension. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_SVM_IN_USE). How can I repair this problem?
This error is because you have virtualbox and kvm installed. The kernel modules conflict. The "simple" solution is to use one or the other, but not both. You can, however, use both as long as you are willing to manually (or script) loading / unloading the kernel modules. To see your modules #Virtualbox modules sudo lsmod | grep vbox #kvm sudo lsmod| grep kvm To remove a module # remove virtualbox sudo rmmod vboxdrv sudo rmmod vboxnetflt #remove kvm sudo rmmod kvm sudo rmmod kvm_amd use insmod sudo insmod /full/path/to/your/modules You can find the module with locate kvm | grep .ko locate vbox | grep .ko Use the modules for your current kernel.
stackexchange-askubuntu
{ "answer_score": 4, "question_score": 3, "tags": "virtualbox, kvm virtualization" }
semantic-ui-react form method type The `semantic-ui-react` library doesn't seem to allow you to set a method on the form element, i.e. `<Form method="POST">`. I need to send the form data to another site on submit. I wanted to just use Semantic-UI forms here like I am everywhere else, but I can't seem to set the method. Is it impossible to do with this? Thanks.
It has been always possible, Semantic UI React passes all unhandled props down to the component, see code below: <Form method='POST' /> // produces: <form method="POST" class="ui form"> <Form action='/' method='POST' /> // produces: <form method="POST" action="/" class="ui form">
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "semantic ui react" }
how to use settimeofday(2)? What am I doing wrong here? I expect `settimeofday()` to change the system time, not return `EINVAL`. $ uname -a Linux io 4.3.5-300.fc23.x86_64 #1 SMP Mon Feb 1 03:18:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ cat settimeofday.c #include <sys/time.h> #include <stdio.h> int main() { struct timeval tv = {0, 0}; if (settimeofday(&tv, 0) == -1) perror("settimeofday"); } $ gcc settimeofday.c $ sudo ./a.out settimeofday: Invalid argument The error is coming from a Thinkpad T450 running Fedora 23. The same code runs fine on OS X. **EDIT** To clarify, the command is being executed as root: # whoami root # sudo ./a.out settimeofday: Invalid argument As expected, I get EPERM not EINVAL if I run the program as a regular user: $ ./a.out settimeofday: Operation not permitted
Commit e1d7ba was introduced to the Linux kernel in mid-2015 and restricts the value of the tv_sec field. The restriction is influenced by system uptime -- see the commit message and related LKML discussion for details. That's what was causing the `settimeofday` call to return `EINVAL` and explains why the code runs on OS X and older Linux machines.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "c, linux, posix, glibc" }
Distribution of Dark Matter around galaxies It is well-known that measurements of the velocity profile in galaxies are not compatible with Newtonian laws. A way to circumvent the problem is to assume that galaxies are surrounded by a spherical halo of Dark Matter. The density of mass of this Dark Matter can then be computed from the velocity profile with Newton's laws. My question is the following: the formation of a galaxy involves essentially only the gravitational interaction. According to Newton (and General Relativity too), the trajectory of a particle does not depend on its mass. As a consequence, I do not understand _how usual matter and Dark Matter could have followed different trajectories leading to such different mass distributions_ nowadays. Can somebody explain this (apparent) paradox ?
Because normal matter can radiate (and therefore lose) energy when it gets hot, it is able to collapse into more compact configurations, like the stars that form galaxies. The real hold up in forming a galactic disk, I believe, is angular momentum. Dark matter, on the other hand, has no efficient way of releasing energy, so it keeps moving around quickly on large orbits, which leads to a more spherical halo.
stackexchange-physics
{ "answer_score": 9, "question_score": 18, "tags": "dark matter" }
array_search function doesn't check first value I have an array which gives me correct results when I print it, for example: [0] => [email protected], [1] => 0909, [2] => [email protected], [3] => 0909 Now, when I want to check if [email protected] is in the array it gives me an error that the value doesnt exist in this array, but when I try for example [email protected] it gives the correct result. This is a little part of the code: $user is the word I want to search, $arrayname is the array. if (array_search(strtolower($user),array_map('strtolower',$arrayname))){ //value exist } else{ //value does not exist } Now [email protected] doesn't exist it says, while [email protected] does exist. Who has any idea?
`array_search` returns the index of the value that is found. When you search for the first item it returns 0. which is also means `false`. change your code so that it reads if (false !== array_search(strtolower($user),array_map('strtolower',$arrayname))){ an alternative method would be to use `in_array` if(in_array(strtolower($user),array_map('strtolower',$arrayname))){
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "php, arrays, search" }
MySQL AND & OR operator What is an operator in MySQL queries that covers AND and OR. So if I wanted to select a row where value1=lol OR value2=loly or both do.
this will look for one of the values or both. SELECT * FROM my_table WHERE your_column IN ( 'lol','loly' )
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
Prove that graph of $f$ , $G(f)$ is an affine variety. Let $f \in \tau(V)$, $V$ a variety in $\Bbb A^n$. Define $G(f)=\\{(a_1,\ldots,a_{n+1})\in \Bbb A^{n+1} \mid (a_1,\ldots,a_n)\in V$ and $a_{n+1}=f(a_1,\ldots,a_n)\\} $ Prove that $G(f)$ is an affine variety. Now first I thaught $G(f)=V(f(x_1,\ldots,x_n)-x_{n+1})$ but this is not true then we can express it as $G(f)=(f^{-1}(k)\cap V)\times k$... How to do this? If $G(f)=V(f(x_1,\ldots,x_n)-x_{n+1})$ then it is algebraic and $f(x_1,\ldots,x_n)-x_{n+1}$ is irreducible too. So it was done but now?
Hint: Suppose that $V=Z(I)$ where $I$ is an ideal of $k[X_1,...,X_n]$ denote $I'$ the ideal of $k[X_1,...,X_{n+1}]$ generated by $I$. $G(f)=Z(I',X_{n+1}-f)$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "algebraic geometry" }
How can I make some attributes required in AWS Cognito while creating a user? E.g. I want to create a user, but I need a phone number to be required, but the AWS Cognito method `AdminCreateUser` lets me add a new user without a phone number. How can I change it? Thanks)
You can make any standard attributes required while creating the user pool. If you use AWS console, while creating the user pool -> Attributes section you can configure which attributes are required. If you use AWS CLI then you can do while creating the user pool, aws cognito-idp create-user-pool --pool-name MyUserPool --schema Name=phone_number,Required=true Once the User pool is created, you can't change this.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, amazon web services, amazon cognito" }
Is it safe to share a swap partition with more than one Linux OS? I have one swap partition, and 3 installed Linux OSes. So I'm just wondering, are there any safety risks or potential problems that can come about as a result of having all 3 OSes use this partition? Only one of them can be booted at any given time, and each one releases the swap partition when powering off/rebooting. So if I were to, say, shut down Fedora and boot into Arch, could there be issues relating to the swap? Like data from the previous OS being used by the currently booted OS? So far I haven't ran into any issues. Should I just create a separate swap partition for each OS? I know that trying to share a hibernation file/swap partition could create issues, since another OS could try to hibernate from another OS'es data. But I don't use hibernation, since my installs are on an SSD. I've had issues with hibernation in the past (like Windows acting wonky).
Yes as long as you don't try anything weird such as hibernating one OS, then booting directly into another and expecting no issues. (One version of hibernation will save the ram directly into the swap partition.). All you need to do is make sure that each O/S you've installed mounts the correct swap partition.
stackexchange-superuser
{ "answer_score": 6, "question_score": 4, "tags": "linux, swap" }
Is there a way to prevent a broken react render from crashing the whole page? If a breaking error occurs in a React component, the whole page crashes. For instance, if `x` is null and you try to access `x.someProperty`, you'll get an error and the whole page will go white. This is a little bit different from an old-style app that isn't running entirely on JS, because the markup (HTML&CSS) would still be there even if the JS errored out and blocked some aspects of the page. Is there a way to mitigate this with React? Something like wrapping a component in a try/catch so that if something goes wrong, _only_ that component fails and only that part of the page goes white, rather than the entire page. I'm not sure if there's a better pattern than literally wrapping the entire body of a functional component's code in a try/catch. I suppose I'm particularly interested in functional components here, but a class-based answer might be useful for someone else.
You can mitigate such errors using Error Boundaries \- such components may catch errors thrown from the child components and display some meaningful error instead of just crashing.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "reactjs" }
Vertical align text inside dynamic height div I want to vertically align text inside a div which is dynamic height say 10% of page for example, but without using the well-known "table method". Can this be achieved with pure CSS? ![enter image description here]( Piece of code: HTML: <div class="post-details-wrapper"> <div class="post-details-h"> Post Details </div> </div> CSS: post-details-h { background-color: green; height:5%; width:100%; } In this particular case the goal is to vertically align the text of "post-details-h" div.
The usual approach is to use display:table stuff. But if you don't want to use it, you can try something like this: <div class="post-details-wrapper"> <div class="post-details-h"> <span>Post Details</span> </div> </div> .post-details-wrapper { height:350px; background:red; } .post-details-h { background-color: green; height:10%; width:100%; } .post-details-h:before { content: ''; display: inline-block; height: 100%; vertical-align: middle; } .post-details-h span { display: inline-block; vertical-align: middle; } Just add span so you can center taht element inside .post-details-h. You can check in JSFiddle Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "html, css, css tables" }
What is this wrench icon I have in the bottom right corner? I have this icon stuck on my screen in the bottom right corner. What does it mean? ![yellow wrench in a circle](
It means that you have collected enough of a particular type of animal skin to craft something.
stackexchange-gaming
{ "answer_score": 10, "question_score": 3, "tags": "far cry 4" }
vue, i18n translation: $t in alert() I'm using Vue 2.6.14 and vue-i18n 8.25 I can't figure it out how to put i18n translation in alert()... async ChangePassword() { await axios.post('/api/reset-password', this.form).then((response) => { alert( {{ $t('Password changed') }} ); })} This doesn't seems to work.
Try out with `this` alert( this.$t('Password changed') );
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "vue.js, internationalization, vue i18n" }
Write state space values from MATLAB to the state space block in simulink How can I write the A, B, C, and D matrices which I've generated in MATLAB to a state-space block in Simulink? I have an `ss` class variable from which I can extract those matrices. Perhaps there is some sort of helper function which takes the `ss` variable and writes the matrices to the block automatically? The reason I ask is because it can be quite cumbersome writing those matrices manually in the fields if there are a ton of states.
If you are using Simulink's State-Space Block and your A, B, C, D matrices are variables inside your global workspace, you should be able to just type those into the state space block and have it automatically update when the values of the matrices change. > ... [U]se your workspace commands to create four matrices A,B,C,D. Then go into your Simulink model, and double-click to open your State-Space block, then under the field of parameter A, just type A again, then under B, type B again, and so on. Source
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "matlab, matrix, simulink" }
Can two behemoths spawn in the same game? Suppose Team 1 gets far enough behind that a behemoth spawns for them. Then, suppose that Team 1 captures all the objectives before (or after) their behemoth is destroyed and now Team 2 is hundreds of tickets behind. Will a behemoth spawn for Team 2 as well? If so, how much damage do behemoths do to each other?
According to the Wiki: * For Conquest: > Only one Behemoth will appear during a match. * For Operations: > Each side may receive a behemoth, though at most one Behemoth may be active at any one time. If only one can spawn at a time/at most, then they can't do damage to one another.
stackexchange-gaming
{ "answer_score": 3, "question_score": 2, "tags": "battlefield 1" }
Finding the percentage increase in the price of a share At the close of one business day, a company's stock was trading at $\$24$ a share. At the close of the next business day, the stock was trading at $\$27$ a share. Find the percent of increase.
$\frac{27-24}{24}=\frac{3}{24}=\frac{1}{8}=12.5$%
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "percentages" }
Why can't I kill any escorts? On my travels I often encounter Thalmor Justiciar escorting a prisoner. As a former prisoner, I once tried aiding him by slaying his escort. Sadly, the guards at the next village I encountered saw that as a vile crime. So now I'm left wondering, **why can't I kill these lone escorts, especially when there are no eye witnesses?** Or are the Thalmor the good guys and should I let this criminal be taken to the block without inferring like a law-abiding citizen of Skyrim? !enter image description here
No witnesses? What do you mean, no witnesses? You're leaving the prisoner alive, right? Well, that bloke may be a prisoner, but he still thinks pretty highly of the law. If he sees you kill all those nambly-pambly elves, he's goin' to tattle to the nearest guard. Ungrateful prisoner. -_-
stackexchange-gaming
{ "answer_score": 14, "question_score": 6, "tags": "the elder scrolls v skyrim" }
¿Qué diferencia hay entre estos dos css? Tengo este código HTML: <div class="seccion-inferior contenedor seccion"> <section class="blog"></section> <section class="testimoniales"></section> </div> En el tutorial que estaba mirando le daba CSS al `blog` y `testimoniales` de esta manera: .seccion-inferior .blog{ flex-basis: 60%; } .seccion-inferior .testimoniales{ flex-basis: calc(40% - 2rem); } ¿Por qué simplemente no lo puso de esta manera?: .blog{ flex-basis: 60%; } .testimoniales{ flex-basis: calc(40% - 2rem); } Yo con la segunda manera consigo el mismo resultado, no sé si lo puso así por cuestión de claridad, especificidad, buena práctica de programación o para que tenga más peso ese selector.
El primer codigo esta indicando que se apliquen la regla a la clase **.blog y .testimoniales** contenidas dentro de la clase **.seccion-inferior** , con lo que solamente aplicara esa regla a ese grupo de etiquetas. .seccion-inferior .blog{ flex-basis: 60%; } .seccion-inferior .testimoniales{ flex-basis: calc(40% - 2rem); } En Cambio usando el segundo bloque CSS le dices que cualquier etiqueta que contengan la clase **.blog y .testimoniales** se aplique le regla, causando que tanto el contenido en la clase .seccion-inferior como cualquier otro que tenga esas dos clases tomen la regla. **Resumiendo:** Es una cuestion de ambito o alcance de la regla del CSS, en la cual quieres que afecte a un grupo especifico o todas las clases etiquetas que contengan esa clase.
stackexchange-es_stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "html, css, web" }
Intel i7 4930K CPU box stock cooler dimensions I'm not able to find the info about Intel's i7 4930K box stock cooler dimensions. Intel homepage mentions that this CPU can be bought in two flavors - boxed version (with cooler), and naked tray version. However, there is no info about the cooler's overall dimensions. Anyone know them? The reason for the question is that I'm not sure if stock cooler will fit in 3U rack case or not. Basically, I'm interested in cooler height.
Surprisingly, latest Intel i7 CPU's for LGA 2011 socket does not come with stock cooler anymore. I hope this answer will help people decreasing delays in computer building by giving a hint that **you need to buy a cooler for latest LGA 2011 i7 models**. Reference.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "intel core i7, cpu cooler" }
Solve $\cosh(z) = 2$ for $z\in \mathbb{C}$ How can I solve $\cosh(z) = 2$ for $z\in \mathbb{C}?$ My steps have only led to values of $z$ which are not imaginary, those being $\ln(2+\sqrt3)$ and $\ln(2-\sqrt3)$. How do I find solutions to the equations that are imaginary?
Using the fact that $e^{2 \pi i}=1$, if $e^x=2+\sqrt{3}$, then $e^{x+2\pi i}=e^{x+4\pi i}=e^{x+2n\pi i}....=2+\sqrt{3}$. A similar argument for $e^{x}=2-\sqrt{3}$. Therefore, the solutions are $\ln(2 \pm \sqrt{3})+2n\pi i$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "complex analysis, trigonometry, complex numbers, hyperbolic functions" }
Chrome randomly fails to clear the cache when hitting CTRL+R This issue seems completely random: sometimes, Chrome just won't clear the cache, even after multiple `CTRL+R`, in which case going to Settings & manually "Clear Browsing Cache" is the only way to clear it and finally see the last CSS/SCSS applied. Is there a definite solution to this annoying problem?
Ctrl+R only does a normal reload in chrome. What you want to do is use Ctrl+Shift+R to do a hard reload.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google chrome, caching" }
Word dialog shown programmatically doesn't respond to mouse clicks The following piece of code shows an _Insert table_ dialog: Dialog d = WordApp.Dialogs[WdWordDialog.wdDialogTableInsertTable]; int result = d.Show(ref missing); if (result == -1) // if user pressed OK { d.Execute(); } The problem is that the dialog **does not respond** to mouse clicks. It **responds** to keyboard input, though. Moreover, if I press Alt+Tab (to switch to some other running app) and then press Alt+Tab again (to switch back to my app), it responds to **both** mouse and keyboard input. My guess is that my application doesn't 'know' that a dialog box was shown (because it doesn't happen in a regular _Form.ShownDialog_ way) and it keeps the focus. How can I solve this problem?
I worked it out. I'm not exactly sure why but this helps: **before** displaying the dialog I **disable** the main application form, then **after** the dialog is displayed I **enable** it back. Dialog d = WordApp.Dialogs[WdWordDialog.wdDialogTableInsertTable]; MainApplicationFormInstance.Enabled = false; int result = d.Display(ref missing); MainApplicationFormInstance.Enabled = true; if (result == -1) // user pressed OK { d.Execute(); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, interop, ms word, ms office" }
How to passing data between 3 activities (Android Studio) enter image description here look at image link above, how to code that simple passing data between 3 activities? Activity 1: * input name * then click insert button * then intent to Activity 2 Activity 2: * click show button * then intent to Activity 3 Activity 3: * setText the input name from Activity 1 Maybe i should have use setter getter? but how? I need this for learning the basic, thanks :)
In Activity 1:on click listener of insert button put this: Intent i = new Intent(Activity1.this, Activity2.class); String name = input.gettext(); i.putExtra("name",name); StartActivity(i); above code will pass value from activity 1 to activity 2,i assume you are quite new to android development go through this link carefully to understand Intents and starting activity Now in Activity2 get the values from intent String name=getIntent().getStringExtra("name"); name will have value passed from activity 1; Now following same pattern you can pass value from activity 2 to activity 3
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android" }
Correctness of $\lim _{n\to \infty }m^{\frac{1}{n}}\le \lim _{n\to \infty }f\left(x\right)^{\frac{1}{n}}\le \lim _{n\to \infty }M^{\frac{1}{n}}$. > $f(x)$ is a continuous function in the interval $[a,b]$.So it has a maximum $M$ and a minimum $m$ on the interval $[a,b]$. That is: > $m\le f\left(x\right)\:\le M$ just like: > $\left(x^{\frac{1}{n}}\right)^{'}\:=\:\frac{1}{n}x^{\frac{1}{n}-1}$. we can't seem to detemine the monotonicity $x^{\frac{1}{n}}$ because it doesn't say that $x$ greater than $0$. **So,is this conclusion correct?** > $\lim _{n\to \infty }m^{\frac{1}{n}}\le \lim _{n\to \infty }f\left(x\right)^{\frac{1}{n}}\le \lim _{n\to \infty }M^{\frac{1}{n}}$ =====update==== The initial question was: > $f(x)$ is a continuous function in the interval $[a,b]$.And $x_1,x_2,...,x_n$ are on the interval $[a,b]$. What's the value of $\lim _{n\to \infty }\left(\frac{1}{n}\cdot \sum _{k=1}^{n }e^{f\left(x_k\right)}\right)^{\frac{1}{n}}$ ?
I found that I ignored $e^{f\left(x\right)}>0$.So the conclusion is right. By the way,the answer of the initial question is $1$. Because > $e^{f\left(x\right)}>0$, so > $0 < m\le e^{f\left(x\right)}\le M$ then > $\frac{1}{n}\sum \:\:_{k=1}m\le \frac{1}{n}\sum _{k=1}^n\:e^{f\left(x_k\right)}\le \frac{1}{n}\sum \:_{k=1}M$ > > $\lim _{n\to \infty }m^{\frac{1}{n}}\le \lim _{n\to \infty }\left(\frac{1}{n}\sum \:_{k=1}^n\:e^{f\left(x_k\right)}\right)^{\frac{1}{n}}\le \lim \:_{n\to \:\infty \:}M^{\frac{1}{n}}$ > > $\lim \:_{n\to \:\infty \:}m^{\frac{1}{n}}=\:\lim \:\:_{n\to \:\:\infty \:\:}M^{\frac{1}{n}}\:=\:1$ So > $\lim _{n\to \infty }\left(\frac{1}{n}\sum _{k=1}^n\:e^{f\left(x_k\right)}\right)^{\frac{1}{n}}=\:1$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "calculus" }
Strange Blank space appearing at right side of the web page I am trying to build a web page which should appear same in both wide screen as well as in small screen monitors. I was trying to keep it fluid but in the mean time strange blank space appeared at the right side of the web page. Strange thing is the blank space is outside the viewport but it makes horizontal screen bar to appear and once scrolled to Right most side, one can see the white space. Code can be seen here < MY gut feeling is the problem is at: #Navigation_Container { background: #3399cc; height: 50px; //width: 960px; //margin: 0 auto; } Help is much appreciated. Also any tips on how to style the web page so that it remains consistent over screens. Comments on the design are also welcome..:)
I found the issue....Its in the class '.notice' that is in the footer...if you remove position:absolute; It works just fine. :) Check it out! **Fiddle** I used the element inspector in firefox at saw that it was the only element that was extending beyond the page. !enter image description here Also, if you need it positioned absolute on the bottom as you had it, make sure also put the left postion as well like this position: absolute; bottom: 0px; left:0px; Here is an example with the left:0px added **FIDDLE**
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "html, css, layout, fluid layout, web testing" }
Who first used/gave a coordinate representation of a graph? In his proof of the Shannon capacity of a graph, Lovasz utilizes a coordinate representation of the pentagon (namely an orthonormal representation). Who first utilized a coordinate representation for finite/infinite graphs for any purpose? I am thinking a general vector valued representation. And not just a $2$-d representation or a 'fixed' dimensional representation.
If by "coordinate representation" you mean the assignment of geometric positions to a graph that was initially given as a purely combinatorial structure, then one possible contender is the proof of Steinitz's theorem by Steinitz, E. (1922), "Polyeder und Raumeinteilungen", _Encyclopädie der mathematischen Wissenschaften_ , Band 3 (Geometries), pp. 1–139. Somewhat later we have the proof of Fáry's theorem by Wagner, Klaus (1936), "Bemerkungen zum Vierfarbenproblem", _Jahresbericht der Deutschen Mathematiker-Vereinigung_ 46: 26–32. (Fáry's and Stein's independent discoveries were later) and the drawings of sociograms in Moreno, J. L. (1934), Who Shall Survive?, New York, N.Y.: Beacon House.
stackexchange-mathoverflow_net_7z
{ "answer_score": 4, "question_score": 6, "tags": "graph theory, ho.history overview" }
how to convert YYYYMMDD to DD-Mon-YYYY in oracle? I am trying to convert the date from **YYYYMMDD** to **DD-Mon-YYYY** in Oracle, but `to_char` or `to_Date` is not working. Can you please advise? `select to_date(20150324,'DD-Mon-YY') from dual; select to_char(20150324,'DD-Mon-YY') from dual;` I get an error message saying: `- ORA-01861: literal does not match format string`
Use this combination of `to_char` and `to_date`: select to_char (to_date('20150324','YYYYMMDD'), 'DD-Mon-YY') from dual; Your mistake was, that you used the wrong date pattern. Additionally it's recommended to add`''`, though it worked without them in this case. Check this Fiddle.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "sql, oracle, oracle11g" }
htaccess wildcard redirect misses some URLs I am using a wildcard redirect to redirect my old domain to a new domain. It works great but misses a few URLs (they don't get redirected to the destination and return status 200) Can you please help me understand what's wrong with this? Maybe I am doing the wildcard redirect incorrectly or it's a server issue. My old domain is `old.example` and my new domain is `new.example`. Example URL which isn't getting redirected: `old.example/example-url` Here's my `.htaccess` file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress #Options +FollowSymLinks # Redirect everything RewriteRule ^(.*)$ [R=301,L]
You've put the redirect directive in the wrong place. It needs to go _before_ the WordPress front-controller, otherwise, the redirect will simply get ignored for anything other than URLs that map directly to the filesystem. Since these domains are also on the same server (same hosting account I assume) then you will need to check for the requested hostname, otherwise, you'll get a redirect loop. For example: # Redirect everything from old to new domain RewriteCond %{HTTP_HOST} ^old\.example [NC] RewriteRule (.*) [R=301,L] # BEGIN WordPress # : The regex `^(.*)$` can be simplified to `(.*)` since regex is _greedy_ by default.
stackexchange-wordpress
{ "answer_score": 1, "question_score": 1, "tags": "redirect, htaccess" }
Checkmate 30 kings with rooks Using only kings, and **as few rooks as possible** , set up a position where 30 of black's kings are checkmated. Checkmate: 1. The king is in check 2. The king has no moves out of check Black only has kings, exactly 30 of them. White has rooks and kings, and the goal is to use as few rooks as possible. * White must have at least one king, but can have more than one. * White kings and black kings can not stand next to each other. * All black kings must be checkmated, stalemate is not enough. **Examples.** Left: NOT valid. The king on g8 is checkmated, but the king on h8 is merely stalemated. Right: A valid solution for 2 kings with 1 rook. ![enter image description here]( ![enter image description here]( Left: NOT valid. Either king can capture the rook. Right: A valid solution for 3 kings with 2 rooks. ![enter image description here]( ![enter image description here]( Online board editor
Here's a solution with 11 rooks and 1 king: > ![enter image description here]( ![enter image description here]( kkkRkkRk/2kRkkRk/R1kkkkkk/2k2Rk1/k1k1R1k1/k4Rk1/kRkk3R/kR1kkk1K b - - 0 1 <
stackexchange-puzzling
{ "answer_score": 30, "question_score": 26, "tags": "optimization, chess" }
How do I delay an event in xcode? I am surprised I can't find this answer but for some reason can't find it for Xcode. In my app I have an IBAction buttonPressed and it adds coins to my "coins" variable and displays it in a UILabel. I would like to make it so when the user presses the button it does not add the coins or display it in the UILabel for about 30 seconds. Is there a simple way to do this? I'm pretty new, so please explain in simple steps if possible. Thank You :)
It's very easy, just use performSelector:withObject:afterDelay:. You would put it in your IBAction code like this: -(IBAction)buttonPressed:(UIButton *) sender { [self performSelector:@selector(addCoins) withObject:nil afterDelay:30]; } -(void)addCoins { //put whatever code you want to happen after the 30 seconds }
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "iphone, objective c, ios, xcode" }
ruby on rails, replace last character if it is a * sign I have a string and I need to check whether the last character of that string is *, and if it is, I need to remove it. if stringvariable.include? "*" newstring = stringvariable.gsub(/[*]/, '') end The above does not search if the '*' symbol is the LAST character of the string. How do i check if the last character is '*'? Thanks for any suggestion
Use the `$` anchor to only match the end of line: "sample*".gsub(/\*$/, '') If there's the possibility of there being more than one * on the end of the string (and you want to replace them all) use: "sample**".gsub(/\*+$/, '')
stackexchange-stackoverflow
{ "answer_score": 57, "question_score": 28, "tags": "ruby on rails, ruby, regex" }
Concatenating strings in R I have the following list. l=list("home car train", "remote TV helicopter", "grenade hello") My goal is to set the words in each item of the list in an alphabetical order. Meaning, the requested result in this case would be: "car home train", "helicopter TV remote", "hello grenade" At first I used _strsplit_ to separate the words in each string: l2<-lapply(l,function(x){as.character(sort(unlist(strsplit(as.character(x), "\\ "))))}) After this step I'm not sure how to concatenate the different sorted values each item to the requested list format. (no luck so far with _paste_ function)
Split the words, sort and paste back together lapply(strsplit(unlist(l), " "), function(x) paste(sort(x), collapse=" ")) Output [[1]] [1] "car home train" [[2]] [1] "helicopter remote TV" [[3]] [1] "grenade hello" Use `unlist(l)` to convert `l` from a list to a character vector, which is required by `strsplit`. `strsplit` will output a list where each element is a vector of the words in an element of `l`. `sort` each vector, then `paste` together all its elements by setting `collapse=" "`.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 1, "tags": "r" }
How to work with Camera API in Firefox OS I want to work with camera api in firefox os simulator. Docs suggests that it is only available for certified apps. If i want to take picture using camera in my app, how can i proceed developing the app?? Thanks in advance
You have to use the Web Activities API to take pictures. Simply put, it's the equivalent of Android's `Intents` for the Open Web. I'd write a lot about it, but there are good code examples out there, like this one, implementing just that. You have to a few stuff: Create a Web Activity: var recordActivity = new MozActivity({ name: "record" }); Set a `onsuccess` callback, and do whatever you want with the result on it: recordActivity.onsuccess = function () { console.log(this); } There are a few more details, and all of them are listed on this post on Hacks.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 7, "tags": "firefox os" }
Account Linking Microsoft bot framework Facebook Tutorial I recently started working on a bot for Facebook through the Microsoft Bot Framework, and one of the key features I need is a good account linking system. When I did research I could only find a tutorial for the Facebook Messenger Platform < I was wondering if anyone knew of a similar tutorial for Microsoft Bot Framework or where I can find more information on this topic, or if anyone has advice. Thanks in advance Cuan
Even if you are using the BotFramework, you are still going to want to use Facebook's account linking (as described at the link shown above). To initiate the log-in, you'll need to create a custom message: msg = new builder.Message(session); msg.sourceEvent({ facebook: { attachment:{ type:"template", payload:{ template_type:"generic", elements:[{ title:"title", subtitle:"subtitle", image_url:" buttons:[{ type:"account_link", url: " }] }] } } } });
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "facebook, bots, botframework" }
Javascript - Map an array of strings to an array of objects with multiple object properties So I have something like this: var myArray = ["cherry", "Michigan", "potato", "Idaho", "apple", "NewYork", "Burrito", "California"] I need to convert into: [ {id: 1, foods: "cherry", location: "Michigan"}, {id: 2, foods: "potato", location: "Idaho"}, {id: 3, foods: "apple", location: "NewYork"}, {id: 4, foods: "burrito", location: "California"} ]
You can loop you array in the following way: const myArray = ["cherry", "Michigan", "potato", "Idaho", "apple", "NewYork", "Burrito", "California"] let result = [] for(let i=0; i< myArray.length -1; i+=2) { let id = result.length + 1 let foods = myArray[i] let location = myArray[i+1] result = [...result, {id, foods, location} ] } console.log(result)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "javascript" }
Making a button look pressed in I'm using Eclipse to write the android application. I've added some standard buttons from the Form Widgets tab and successfully got them opening new windows which display additional buttons. I would like the button that was pressed, to change appearance and continue to look pressed in after it is selected.
create xml file using the button image like this <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android=" <item android:state_pressed="true" android:drawable="@color/transparent" /> <item android:drawable="@drawable/closebutton" /> </selector> add the color folder in values <?xml version="1.0" encoding="utf-8"?> <resources> <color name="transparent">#00000000</color> </resources>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "android" }
MS-SQL 2008 Server : Wrong Syntax? I having a problem with this command line: IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.njams_test_sql_2.[PROC_DELETE_DATA]') AND type in (N'P', N'PC')) DROP PROCEDURE [PROC_DELETE_DATA] GO Following SubSelect-Command: SELECT * FROM sys.objects WHERE object_id = OBJECT_ID ( N'dbo.njams_test_sql_2.[PROC_DELETE_DATA]' Gives the error that there is an syntax error in the near of `'dbo.njams_test_sql_2.[PROC_DELETE_DATA]'` What am I doing wrong?
a bracket is missing at the end SELECT * FROM sys.objects WHERE object_id = OBJECT_ID ( N'dbo.njams_test_sql_2.[PROC_DELETE_DATA]' )
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql server, tsql, syntax error" }
Hiding password entry input in python I am trying to make a little log in program. But i am not sure if there is a way to replace the "password" with stars when you type the password. This is my code: from tkinter import * def callback(): print("hi") top = Tk() L1 = Label(top, text="User Name") L1.grid(row=0, column=0) E1 = Entry(top, bd = 5) E1.grid(row=0, column=1) L1 = Label(top, text="Password") L1.grid(row=1, column=0) E1 = Entry(top, bd = 5) E1.grid(row=1, column=1) MyButton1 = Button(top, text="Submit", width=10, command=callback) MyButton1.grid(row=3, column=1) top.mainloop()
Use the `show="*"` option. e.g. E1 = Entry(top, bd = 5, show="*")
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 1, "tags": "python, passwords, tkinter" }
Conditional Join with replace and case I have two tables that I want to join. The case is in table 1 the default value is 1 then in table 2 the default value is 0 Table 1 Table 2 -------- --------- 1 0 1232342 1232342 1241232 1231231 I want to join table 1 and table 2 with condition that if table 2 is 0 then it will be replaced to 1. SELECT T1.ID FROM TABLE1 T1, TABLE2 T2 WHERE T1.ID = REPLACE(CASE WHEN T2 = 0 THEN 1 ELSE T2.ID END, 'X', 'E') with this statement it does not return the other id's that are not 0 or 1 expected output Table 1 -------- 1 1232342
Use a join with a CASE. `replace()` is for string values: select t1.* from table1 t1 join table2 t2 on t1.id = case when t2.id = 0 then 1 else t2.id end;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, oracle, replace, case" }
Problem on continued fraction of $\frac{\sqrt{5}+1}{2}$ > If $\frac{p_r}{q_r}$ be the $r^{\text{th}}$ convergent of the continued fraction of $\frac{\sqrt{5}+1}{2}$ then prove that $p_{n+1}=p_{n}+p_{n-1}$ and $p_{2n}=p_{2n-1}+p_{2n-2}$. Attempt: I have written the continued fraction of $\frac{\sqrt{5}+1}{2}$ which is equal to $1+\frac{1}{1+}\frac{1}{1+}\frac{1}{1+}\cdots$. But how to get the above two relations. Please help.
It's quite standard $\displaystyle 1=\frac{1}{1}=\frac{p_{0}}{q_{0}}$ $\displaystyle 1+\frac{1}{1}=\frac{2}{1}=\frac{p_{1}}{q_{1}}$ $\displaystyle 1+\frac{1}{\frac{p_{n}}{q_{n}}}=\frac{p_{n}+q_{n}}{p_{n}}=\frac{p_{n+1}}{q_{n+1}}$ Note that if $\gcd(p_{n},q_{n}) = 1 \implies \gcd(p_{n},p_{n}+q_{n}) = 1$ Equating numerators and denominators then eliminate $q_{n}$. The result follows at once. Put $m=2n-1$, then $p_{m+1}=p_{m}+p_{m-1} \implies p_{2n}=p_{2n-1}+p_{2n-2}$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "continued fractions" }
center is not defined - <!DOCTYPE html> error I getting error: > ReferenceError: center is not defined and console marks `<!DOCTYPE html>`. Why? Without a parameter in the function call everything is fine. All HTML tags are fine, on top I have `<!DOCTYPE html>` <button onclick="getRegion(center)" class="btn btn-region">centrum</button> function getRegion(region) { var listRegions = { "center": [ '7', '5' ], "south": [ '12' ], "north": [ '11' ], "west": [ '4' ] }; var activeRegion = listRegions[region]; //remClass(); for ( var i = 0; i < activeRegion.length; i++ ) { $('section.bok-map').find( $('.pl' + activeRegion[i]) ).addClass('active-region'); } }
In the `getRegion(center)` call, `center` needs to be quoted because you want a string. <button onclick="getRegion('center')" class="btn btn-region">centrum</button> Without the quotes, it is treated as a variable called `center` which obviously doesn't exist.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "javascript, jquery, html" }