INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Joomla 1.5 2 categories, 2 layouts I have two categories that need their own layout. Right now it looks like both categories are using `template/html/com_content/category/blog.php`, and I can't for the life of me figure out how to switch this to a different layout from the menu item layout selection. Joomla 1.5 Stuff I have read: * < * < No matter where I place extra files within `...my-template/html/com_content/category` or `...my-template/html/com_content/category/views/[category]/[tmpl]/`, no new layouts show up from the layout selection dialog. System debug doesn't seem to print out any useful templating info either. WHAT DO?
You put layout overrides it the html folder of your template not in the core folders. Look at beez5 for examples of layout over ride and also for an alternative layout which is used in com_contact.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "templates, joomla, overriding, joomla1.5, joomla template" }
String.replaceAll() with [\d]* appends replacement String inbetween characters, why? I have been trying for hours now to get a regex statement that will match an unknown quantity of consecutive numbers. I believe [0-9]* or [\d]* should be what I want yet when I use Java's String.replaceAll it adds my replacement string in places that shouldn't be matching the regex. For example: I have an input string of "This is my99String problem" If my replacement string is "~" When I run this myString.replaceAll("[\\d]*", "~" ) or myString.replaceAll("[0-9]*", "~" ) my return string is "~T~h~i~s~ ~i~s~ ~m~y~~S~t~r~i~n~g~ ~p~r~o~b~l~e~m~" As you can see the numbers have been replaced but why is it also appending my replacement string in between characters. I want it to look like "This is my~String problem" What am I doing wrong and why is java matching like this.
`\\d*` matches 0 or more digits, and so it even matches an empty string. And you have an empty string before every character in your string. So, for each of them, it replaces it with `~`, hence the result. Try using `\\d+` instead. And you don't need to include `\\d` in character class.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 2, "tags": "java, regex" }
How can I dual-boot Windows and Fedora with two hard disks? I have an 80GB and a 40GB hard drive. My primary hard drive contains Windows. On the second hard drive, I want to install Fedora 15. When the system boots, there should be a menu to select the operating system. Is this possible? Where do I install the boot loader? On the primary or the secondary hard drive?
If you already have XP on primary then simply install Fedora on the second drive. Most Linux editions can detect Windows (or other system) and will work just fine without worries.
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "linux, windows xp, multi boot, fedora 15" }
Applying styles to a <video> when not in fullscreen mode I'd like to apply a style to a `<video>` only when it's not in fullscreen mode. My first thought was: video:not(:fullscreen):not(:-webkit-full-screen):not(:-moz-full-screen):not(:-ms-fullscreen) {} Unfortunately, MDN states that `not()` must not contain pseudo elements. I'd like to have the browser's default style take over in fullscreen mode, while I handle positioning of the element in non-fullscreen. I'm sure it's possible to do with adding a class through JS in fullscreen, but are there css-only ways to do it?
Browser will completely ignore any selector that contains an unrecognized part (such as a prefixed pseudo-class from a different browser). Therefore, you need to split each browser version into a separate ruleset.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, css, video" }
How to configure HttpClient via Unity container? I'm trying to register an instance of HttpClient object with the unity container so that it can be used throughout the app, but running into the error - "The type HttpMessageHandler does not have an accessible constructor." Here is the code I use to register the HttpClient with Unity- private static IUnityContainer BuildUnityContainer() { var container = new UnityContainer(); container.RegisterType<HttpClient>( new InjectionProperty("BaseAddress", new Uri(ConfigurationManager.AppSettings["ApiUrl"]))); return container; }
You can use the factory method to register it instead: container.RegisterType<HttpClient>( new InjectionFactory(x => new HttpClient { BaseAddress = new Uri(ConfigurationManager.AppSettings["ApiUrl"]) } ) );
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 13, "tags": "c#, .net, unity container, asp.net web api" }
Multiple condition IF statement I've got an if statement with multiple conditions that I just can't seem to get right if(((ISSET($_SESSION['status'])) && ($_SESSION['username']=="qqqqq")) || ((ISSET($_SESSION['status'])) && ($_SESSION['company']=="wwwwww")) || ((ISSET($_SESSION['status'])) && ($_SESSION['company']=="ffffffff")) || ((ISSET($_SESSION['status'])) && ($_SESSION['company']=="ggggggg")) || ((ISSET($_SESSION['status'])) && ($_SESSION['company']=="hhhhhhh")) || ($_SESSION['LOGINTYPE']=="ADMIN")) { Its supposed to return true if the status is set as well as either one of those company names OTHERWISE if the logintype is admin it should also return true regardless of company or status
What about this : if ( (isset($_SESSION['status']) && $_SESSION['username']=="qqqqq") || (isset($_SESSION['status']) && in_array($_SESSION['company'], array('wwwwww', 'ffffffff', 'ggggggg', 'hhhhhhh'))) || $_SESSION['LOGINTYPE']=="ADMIN" ) Rewriting the condition to try to make it a bit more easier to read might help : * One possible case per line : * status set and username OK * status set and company OK * admin * Using in_array instead of several tests on company -- I think it's easier to understand
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "php, if statement" }
What is the purpose of ValidationResult.Success field? Msdn: > public static readonly ValidationResult ValidationResult.Success > > Represents the success of the validation (true if validation was successful; otherwise, false). The text in above excerpt doesn't make sense to me, since `Success` field doesn't return a value of type `bool`, and the value it does return ( ie `ValidationResult` instance ) doesn't contain any boolean property or field which we could set to a value indicating a success or failure of a validation?! Any ideas what is the purpose of this field?
`ValidationResult.Success` is always constant `null`. Its purpose is **documentation**. In order to succeed validation you could either write: return null; or return ValidationResult.Success; In the first case I ask myself " **What does this mean? What does null mean? Is this success, or fail, or something else?** ". In the latter case the code is **inherently documented** without the need for informal text docs.
stackexchange-stackoverflow
{ "answer_score": 32, "question_score": 25, "tags": "entity framework, validation" }
Is it possible to follow progress of particular package managers? I notice that my node.js on the latest Ubuntu is only 0.4.12, but I'm trying to install something that needs 0.6. Is there a way to see the team who are involved in packaging this? Or track progress? Update : Thanks for the answer to my specific node.js issue, it's very useful. BUT I really wanted to ask the question that I asked - is there a way to follow the people doing the packaging for Ubuntu and to track their progress? (The node.js was just an example of why I might want to do this.)
Each package has a corresponding page on launchpad: < Here you'll see the versions of node in each version of Ubuntu it is shipped in, and at the bottom a list of other (potentially untrusted) sources of node that other people might be packaging it. As far at the maintainer goes, if you click on a specific version page: * < You'll see that the maintainer is listed as "Ubuntu Developers", with James Page being the last one who touched it. For questions about that package it's best to probably post on this mailing list.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 2, "tags": "package management, packaging" }
How to compute the trace of an exponential and diagonal matrix? I would like to understand how to compute the trace of an exponential and diagonal matrix. For instance, what is: $$ \mathrm{Tr}\left[ \exp \begin{pmatrix} 5 & 0 \\\ 0 & 8 \end{pmatrix} \right] = \; ? $$ I've tried to Google it, but couldn't find anything that answers this question.
Fortunately our matrix to exponentiate is diagonal simplifying matters considerably, as we have $$\mathrm{Tr}\left[ \exp \begin{pmatrix} 5 & 0 \\\ 0 & 8 \end{pmatrix} \right] = \mathrm{Tr}\left[ \begin{pmatrix} \sum_{k=0}^\infty\frac{1}{k!}5^k & 0 \\\ 0 & \sum_{k=0}^\infty\frac{1}{k!}8^k \end{pmatrix} \right] = e^5+e^8$$ where the exponential of a _matrix_ $A$ is defined as $$\exp(A)=\sum_{k=0}^{\infty}\frac{1}{k!}A^k$$
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "linear algebra, matrices" }
What is the next step BIOS takes after "Checking NVRAM"? > **Possible Duplicate:** > Is my new Graphic Card cause for my PC hanging? My PC hangs at `Checking NVRAM` . So I want to know what is the next step taken after `Checking NVRAM` by BIOS so that I can find a solution to my problem.If u give me a complete list, that would definitely help.
Here are two resources that explain the startup process from power on and what the BIOS is doing, hopefully this is what you were looking for. How Computers Boot Up by Gustavo Duarte System Boot Sequence by PC Guide
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "memory, motherboard, bios" }
Where can I find logs that will provide information about an ec2 shutting down I am launching an EC2 through a cloudformation template but it keeps shutting down after a few minutes, possibly some restrictions my company may have in place. I don't have any indication why it is shutting down though, are there logs anywhere I can look at to find out? Thanks
First, have you verified that it's not a startup error in your own stack? Check the stack status, and if it says "rollback complete" the error is yours. Generally this is caused by a bad cloud-init script, and they can be a pain to diagnose, because the logs go away when the instance terminate (another answer tells you how to retrieve the system log, but it's only one of the logs used during startup). To verify whether it's an automated process that shuts down the log, you can use CloudTrail (assuming that you have access). You're looking for a `TerminateInstances` event that references your instance; the event details will show the name of the user that took the action.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "amazon web services, amazon ec2, aws cloudformation" }
Mandatory file apdu error: 6283 upon read. File invalidated I'm attempting to read EF_LOCI(Location Information) file from a USIM. 1.I'm selecting the MF ->00A40004023F00 <-622C8202782183023F00A50980017183040001575B8A01058B032F0602C6099001408301018301818104000201069000 2.Now selecting DF TELECOM ->00A40004027F20 <-622C8202782183027F20A50980017183040001575B8A01058B032F0602C6099001408301018301818104000006DF9000 3.Finally select the EF_LOCI file: ->00A40004026F7E <-6283 The result is 6283 for some sims. According to the documentation it means the file is 'invalidated'. Which means what exactly?
This Means, A file will not be longer available for any function except for the SELECT and the REHABILITATE functions unless the file status of the EF indicates that READ and UPDATE may also be performed (that will be set during the EF Creation). File could be Invalidate because of Many reason. For Detail Please refer < (annex C).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "smartcard, javacard, apdu" }
Integration by parts: $\int x\ln x^2 \,dx$ Problem: $\int x\ln x^2 \,dx$ So what I did first was make $u = \ln x^2$ and $dv = x$ Then I solved by getting the derivative of $u$ and the anti derivative of $dv$ and I got $du = 1/x^2 $ and $v = x^2/2$ then I did the formula $$\int udv = uv - \int vdu$$ which then after plugging in the numbers and simplifying got me $$ \frac{ x^2}{2}\ln x^2 - \frac{1}{2x} +C$$ Is this the right way to do the problem and answer?
First note that $\ln(x^2)=2\ln(x)$. Now we have $$u=2\ln(x), \ \ du = \frac{2}{x}dx, \ \ dv=xdx, \ \ v=\frac{x^2}{2}$$ Integration by parts tells us that $$\int\\! 2x\ln(x) \, \mathrm{d}x=2\ln(x) \cdot \frac{x^2}{2}-\int\\! \frac{2}{x} \cdot \frac{x^2}{2} \, \mathrm{d}x$$ $$=\ln(x) \cdot x^2-\int\\! x \, \mathrm{d}x$$ $$=\ln(x) \cdot x^2-\frac{x^2}{2}+C$$
stackexchange-math
{ "answer_score": 2, "question_score": -1, "tags": "calculus, integration, logarithms, indefinite integrals" }
How can I detect an mass change of an mysql row value? How would I detect an mass change in an value in an databse? Here's how it looks the first day: USERNAME FOLLOWERS timmy.s 125 john.doe 458 alice.m 1543 jay.boo 1949 And the second day: USERNAME FOLLOWERS timmy.s 125 john.doe 458 alice.m 1683 jay.boo 1963 So as you see, **alice.m** got over a 100 followers for one day. So, then I would display some usernames that are "trending" and she will be first, even if **jay.boo** still has more followers from her. Is there an good way to do this?
Figured it out, thanks to Gordon Linoff. I would have an third and fourth column containing last day's followers and last month's followers. Then, every day it will be calculated what is the difference: 1. Get the difference between today and yesterday 2. Get the difference between today and last month 3. Combine 1. and 2. 4. Sort the numbers by size (ie. 75 will be before 43 and 21) 5. Show the first 3 usernames that have the highest increase rate Also, this calculation will apply only for users with an follower number of `website users /4 - (website users /10)` and all of that `/ 100` or more
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, sql" }
Custom permissions on viewset Im trying to find a way to create custom permissions on a viewset. Im want to implement somthing like this : class ActivityViewSet(viewsets.ModelViewSet): queryset = Activity.objects.all() serializer_class = ActivitySerializer if request.method == 'PUT': permission_classes = (permissions.IsOwner) elif request.method == 'LIST': permission_classes = (permissions.IsAdmin) else : permission_classes = (permissions.AllowAny) IE : sorting permissions by method. (the above code doesnt work cause "request" isnt recognized) Couldn't find any use in the "Custom permissions" section of the documentation, but maybe Im just blind. (overriding BasePermission? how? who? where?) Thanks :)
Viewsets use `action` to determine HTTP a verb and permissions invoked from `get_permissions` method, so you can override it: class ActivityViewSet(viewsets.ModelViewSet): queryset = Activity.objects.all() serializer_class = ActivitySerializer def get_permissions(self): if self.action == 'update': return IsOwner() elif self.action == 'list': return IsAdminUser() else : return AllowAny()
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "django, django views, django rest framework, http method" }
как правильно указать диапазон генерации для (0;1) с тремя знаками после запятой? как правильно указать диапазон генерации для (0;1) с тремя знаками после запятой используя функцию rand()?
Если я верно понял, что вам нужно - (rand()%1000)/1000.0 Еще вариант - округлять до трех знаков, типа round(rand()*1000.0/RAND_MAX)/1000.0
stackexchange-ru_stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "c++, случайные числа" }
Zend Framework 2 unit testing using CodeCeption We are currently using CodeCeption to do some acceptance testing, but I would like to also add unit testing to the current setup. Has anyone done Unit testing in Zend Framework 2 project using CodeCeption? And if so, how did you set up the environment?
Found this in codeception docs: < There is an example in this github project: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "unit testing, zend framework2, codeception" }
Look at the question and see me Some can be forgiven for thinking I watch you, but in fact you are the one watching me. I suppose I keep an eye on the mathy fellow, but that just makes me a little bit gooey. I guess I don't lead but I can be led, though sometimes I have crystallizing moments. without light I am out of sight however, with a magnet I can get real funky. To give your answer you would key, but you would get little feedback without me.
You are > A (computer) monitor Some can be forgiven for thinking I watch you, but in fact you are the one watching me. > A monitor can be one who watches, but in this case, I'm looking at my monitor right now I suppose I keep an eye on the mathy fellow, but that just makes me a little bit gooey. > Not entirely, sure, but I'm guessing the mathy fellow is the CPU? I guess I don't lead but I can be led, > LED monitors though sometimes I have crystallizing moments. > Or liquid crystal monitors without light I am out of sight however, > You can't see anything if the monitor produces no light with a magnet I can get real funky. > Especially if you're a CRT monitor, as magnets will distort the picture To give your answer you would key, but you would get little feedback without me. > I won't know I'm right until I see a response to this on my monitor :)
stackexchange-puzzling
{ "answer_score": 4, "question_score": 3, "tags": "riddle" }
Get list element by position I want to give a number and return the element of this position. List _lab_ = `(R K K K K)` and I want to know if something like this `(position 1 lab)` exists on lisp. Like in C `return lab[1]`.
In Common Lisp the operator that gets the n-th element of a list is called `nth` (see the manual): (nth 2 '(a b c d)) ; returns C A related operator is `nthcdr` that returns the rest of the list starting from the n-th element: (nthcdr 2 '(a b c d)) ; returns (C D)
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 9, "tags": "lisp, common lisp" }
How to output some log to console when developing flex application? I'm new to flex, and trying to write some demo applications. Now I have a very newbie question: How to output some log to console(or somewhere else I can see) in a flex application? In other language, I can use: System.out.println("mylog"); console.log("mylog"); But I don't know how to do the same in flex.
You have several options here: * `trace()` * Flex loggers * Flex-console (uses `MiniDebugTarget`)
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 13, "tags": "flash, apache flex, debugging, logging" }
Bash - Send commands to a CLI I am writing a script in bash (on Linux) and I need to send some commands to a command line interface but I don't know how to do it. To open the CLI : myserver# ovirt-shell [options] Then I'm in a new shell where I execute some commands to get back informations : [oVirt shell (connected)]# list hosts > hosts.txt<br> [oVirt shell (connected)]# list vms > vms.txt So I would like to execute ovirt-shell and send my commands (list vms/hosts) directly in my script, in "silent-mode". How can I do this ?
Since the program reads from stdin, you can pipe the commands to stdin: ovirt-shell <<EOF list hosts list vms EOF An alternative is to store the commands in file and execute it like this: ovirt-shell -f filename
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "linux, bash, shell" }
Show content only for organic traffic I want to show some content only for visitors from search engines, can you help me please ? :) I already have this php, but it show only for google.com but I want whole google and yahoo :) if(substr((trim($_SERVER['HTTP_REFERER'])), 0, 23) == " { echo "Show what I want"; }
As a starting point, consider using stripos as an efficient way of testing if a string contains another string: if (stripos($_SERVER['HTTP_REFERER'], '.google.') !== false || stripos($_SERVER['HTTP_REFERER'], '.yahoo.') !== false) { echo "Show what I want"; } There are plenty of variations on the google and yahoo domains (e.g. google.co.uk) so it is up to you how strict you want the matching to be.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "php" }
Which is the best character encoding for Japanese language for DB, php, and html display? i just want to know about the language transation for the Japanese, 1) Which is the best encoding for the database mysql 2) Which/how can i print that in HTML page. ? thanks in advance.
UTF-8 without a doubt. Make everything UTF-8. To put UTF-8 encoded text on your web page, use this within your HEAD tag: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> As for MySQL, put the following into your my.cnf (config) file: [mysqld] collation_server=utf8_unicode_ci character_set_server=utf8 default-character-set=utf8 default-collation=utf8_general_ci collation-server=utf8_general_ci If you're getting garbage characters from the database from queries executed by your application, you might need to execute these two queries _before_ fetching your Japanese text: SET NAMES utf8 SET CHARACTER SET utf8
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 4, "tags": "php, mysql, unicode, character encoding" }
Javascript: What is reportProgress in Http Services? What does reportProgress do in Javascript, specifically we are using Angular Typescript. Trying to locate document information on this. return this.httpClient.request<ProductResponse>('get',`${this.basePath}/api/Productcy/GetProductBNumber`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); Background: Using Angular to call Net Core APIs, using Swagger Codegen IO Proxy Generator.
You need to use reportProgress: true to show some progress of any HTTP request. If you want to see all events, including the progress of transfers you need to use observe: 'events' option as well and return an Observable of type HttpEvent. Then you can catch all the events(DownloadProgress, Response..etc) in the component method. Find more details see <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, angular, typescript, api, swagger codegen" }
Why am I getting "ArrayIndexOutOfBoundsException: 0"? The problem seems to be within my `for` loop when I am trying to place the value of `temp` into `int[] unDupe` at the `i` position. I get the error: > 'Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at main.Main.main(Main.java:33)' public static void main(String[] args) { Scanner input = new Scanner(System.in); int[] unDupe = {}; System.out.print("Enter a number sequence (eg. '1 2 10 20'): "); String dupe = input.nextLine(); String[] dupeSplit = dupe.split(" "); int temp; for(int i = 0; i < dupeSplit.length; i++){ temp = Integer.parseInt(dupeSplit[i]); unDupe[i] = temp; // line 33 } }
You are declaring and initializing the unDupe array with `int[] unDupe = {};` — however this gives it no elements; a zero sized array. As soon as you try to index it with anything `unDupe[i] = temp;` you are exceeding the array size - your index is out of bounds. For an array to even have `unDupe[0]` the array would have to be at least size=1. If you are un-duplicating the input your deDupe array has to be, _at most_ , the same size as the input array `dupeSplit`, so you can declare `int[] unDupe = new int[dupeSplit.length];` after you know the size of dupeSplit. Just declare deDupe later.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -1, "tags": "java, arrays, indexoutofboundsexception" }
Limit access to ajax calls and block crawlers and spiders was wondering how to code a server file for ajax calls ?, example: Class cars, have 2 functions 1. reply with all brands return $database->Listall('brands','cardb'); **_I call it with api.php?mod=list_** 2. reply with all cars in brand return $database->Listall('cars','cardb',"WHERE brand=$brand"); **_I call it with api.php?mod=list &brand=kia_** the problem is that google list these api links in its search directory, + users can also access this page on there own (not throu ajax call) so how can i block this ?
AJAX is just a way to request a page that will return simplified (xml?) content. **Block Google** Use this on your robots.txt and serve your ajax requests from the ajax folder. User-agent: * Disallow: /ajax-folder/ **Use`_POST` on ajax requests and send a "secret"** Have your AJAX requests send along a "secret" variable and, on requests that don't have that variable just re-direct them to another page.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "php, jquery, ajax" }
Canvas image cannot show all and is clipped can only show part of the image I got the image shown but can only show part of the image. I'm wondering if there is any way to show the image as a whole! var canvas=document.getElementById("Mat_canvas"); canvas.addEventListener('keydown',doKeyDown,true); var canvt=canvas.getContext("2d"); var img_obj=new Image(); img_obj.onload=function(){ //canvt.align='center'; canvt.drawImage(img_obj,0,0); };
You can resize your canvas in the image onload callback: var canvas=document.getElementById("Mat_canvas"); canvas.addEventListener('keydown',doKeyDown,true); var canvt=canvas.getContext("2d"); var img_obj=new Image(); img_obj.onload=function(){ //canvt.align='center'; // resize the canvas to the same size as the source image canvas.width=img_obj.width; canvas.height=img_obj.height; canvt.drawImage(img_obj,0,0); };
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html, image, canvas, show" }
Root of an exponential equation Let $0 \le a \le 1$ and $-\infty < b < \infty$. I am looking for a solution of the exponential equation. $$ a^x + abx = 0. $$ I guess closed form expression of the root in terms of $a$ and $b$ may not be there. In that case, an asymptotic expansion of the root in terms of $a$ and $b$ would be just as fine.
Note that $$ \begin{align} a^x+abx&=0\\\ abx&=-e^{\log(a)x}\\\ abx\,e^{-\log(a)x}&=-1\\\ -\log(a)x\,e^{-\log(a)x}&=\frac{\log(a)}{ab} \end{align} $$ Thus, we can use the Lambert W function to get $-\log(a)x$: $$ \begin{align} -\log(a)x&=\mathrm{W}\left(\frac{\log(a)}{ab}\right)\\\ x&=-\frac1{\log(a)}\mathrm{W}\left(\frac{\log(a)}{ab}\right) \end{align} $$ $\mathrm{W}(x)$ has real values for $x\ge-\frac1e$. For non-negative $x$, there is one real branch. For negative $x$, there are two real branches (which coincide at $-\frac1e$).
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "algebra precalculus, asymptotics, roots" }
How to get Image Name or Id from docx file using Open xml in C#? I am using Mvc.Net API with open XML. I need to replace multiple images in .docx file.I replace the images in current scenario but I don't get any Id or Name of the Image at my code side so facing difficulties to replace those images. Here is my code List<ImagePart> imgPartList = doc.MainDocumentPart.ImageParts.ToList(); foreach(ImagePart imgPart in imgPartList) { string Id=doc.MainDocumentPart.GetIdOfPart(imgPart); byte[] imageBytes = File.ReadAllBytes(ImagePath); BinaryWriter writer = new BinaryWriter(imgPart.GetStream()); writer.Write(imageBytes); writer.Close(); } Can I get the name of Image in ImagePart?
I would do something like this: List<ImagePart> imgPartList = doc.MainDocumentPart.ImageParts.ToList(); foreach(ImagePart imgPart in imgPartList) { var imageId = document.MainDocumentPart.GetIdOfPart(imgPart.Id); byte[] imageBytes = File.ReadAllBytes(ImagePath); BinaryWriter writer = new BinaryWriter(imgPart.GetStream()); writer.Write(imageBytes); writer.Close(); } Also This answer could help you
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net mvc, docx, openxml sdk" }
Does ehcache restore order while retrieval Say I have a `List<List<someObject>> someList {{A,B},{C,D}}`. `'A'` being the first element and `'B'` being the second element in the first list element and so on. Using `ehcache`, I stored the `List<List<someObject>> someList` in the `ehcache` with some key. During retrieval, does `ehcache` guarantee the order in which the list is retrieved i.e `{{B,A},{D,C}}` is possible?? or it will always be {{A,B},{C,D}}. Note: The order of the outside list is maintained...but the order of the inner lists is reversed `ehcache` internal implementation doc any??
You're asking about a property of the `List`, and a decent `List` implementation will maintain the order of the elements even after serialization. That's not a problem for ehcache or any other third party library. Note that ehcache usually stores the cache data in RAM. In case it lacks enough RAM space, it may flush the data into disk (previous configuration). So, looks like you're retrieving the list and reversing it. Note that you're working with the exact same object reference, so even if you don't _store it back_ into ehcache, the state of the `List` is still affected. More info: * Ehcache. Storage Options.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "java, spring, spring mvc, ehcache" }
how to stop progress indicator after downloading a pdf There is a link on my page to a pdf file. Clicking on the link takes a really long time, so I'd like to throw up a progress indicator gif showing that it is something that takes a while. But how do you hide the indicator once the pdf has been generated on the server side and finished downloading? (basically your browser now says you are opening a pdf file and asks you what to do) at this point is there an event that fires or anything I can poll to check to hide the progress indicator?
JavaScript does not have access to information on what's being downloaded. The only thing you can do is load the PDF in a Iframe and hook up the onload event on the Iframe. Even then the event will fire when the PDF starts loading, not when it is complete. **EDIT** : kalendae has alternate answer. If you have server-side access you can set a cookie with the response and poll for its value on the client. See: <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "jquery" }
Example of morphism of irreducible varieties with reducible fibre Suppose $f: X \to Y$ is a morphism of irreducible affine or projective varieties. Does it then always follow that $f^{-1}(p)$ is irreducible for any point $p \in f(X)$? I think it's not true, and I'm trying to find a counterexample. Thank you!
A common example is $\operatorname{Spec}(\mathbb{C}[x,y,t] / \langle xy - t \rangle)$ over $\operatorname{Spec}(\mathbb{C}[t])$. Here, the fiber over $t=0$ is reducible.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "algebraic geometry, affine varieties, projective varieties" }
angle of twist of gear relative to another gear why the torque is negative in this case ? the question ask for determine the angle of twist of gear C with respect to B . We have to 'fix' the B , and determine the twist of C ? So , imagine that we cut off the shaft and gear , now only left with gear B and gear C connected by a shaft . So , when B is fixed , the gear C rotate , with the direction of torques pointing to the left ( by using right hand grip rule ) , So , the finger point towards B , so it's negative ? ![11](
Negative and positive are essentially arbitrary and are really just to differentiate the directions of the moments and forces. You can chose your positive y direction to be facing down for example, if that's how you want to arrange your coordinates. The standard orientation is right and up are both positive coordinates. If we assume they are using standard coordinates; then it should be negative using the right hand rule. You yourself said when using the right hand rule that your thumb pointed left. That is generally considered the negative x direction, therefore the moment is considered negative.
stackexchange-engineering
{ "answer_score": 2, "question_score": 0, "tags": "mechanical engineering" }
Can we call a java function from the html text-box? I'm doing a web project using jsp,mysql,ajax using netbeans and mysql. I'm having 3 textboxes, 2 is for taking the input from the user. The 3rd textbox should show the product of 2 input values. How to do this? Should i make a ajax call or can i call a java function in the 3 textbox. The code is <input type="text" value="" name="quantity"/> </td><td><input type="text" value="" name="price"/> </td><td><input type="text" value="" name="total"/> In the value attribute of the textbox named "total" can i call a java function? something like `value="getTotal()"`,but if i can how can i access the other two values. Otherwise should i make a ajax call?
Hi friend no need to go java function...You can do simply client side <td><input type="text" value="" name="quantity" onblur="Calculate()"/> </td><td><input type="text" value="" name="price" onblur="Calculate()"/> </td><td><input type="text" value="" name="total"/> <script type="text/javascript"> function Calculate() { var txt1 = document.getElementById("quantity"); var txt2 = document.getElementById("price"); var txt3 = document.getElementById("total"); if ((txt1.value != "") && (txt2.value != "")) { txt3.value = parseInt(txt1.value) * parseInt(txt2.value); } } </script> Hi friend one more thing total textbox should be read only or you can use label.... thanks
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "javascript, mysql, ajax, jsp, netbeans" }
How to set multiple classes in my case? I am trying to setup multiple conditions in my ng-class in my app. I have something like <div id='wrapper' ng-class="{red: !isBlue(), highlight ? 'yellow' : 'black'}" ng-show="test">Test</div> JS $scope.highlight = false; My problem is that I got syntax error on the ng-class condition. Syntax Error: Token ';' is unexpected, expecting [}] at column 48... I am not sure how to fix it. Can anyone help me about it? Thanks!
you can use multiple classes like this, you need to add separate classes for `highlight` and `!highlight` <div id='wrapper' ng-class="{'red': !isBlue(), 'yellow':highlight ,'black':!highlight }" ng-show="test"> Test </div> here is a Demo Plunker (ng-class) * * * you have another alternative `ng-style` with this you can achieve something like u tried, <div id='wrapper' ng-style="{color: (highlight ? 'yellow' : 'green')}" ng-show="test">Test</div> here is the Demo Plunker (ng-style)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "html, css, angularjs, class" }
Two Column's tables align on each other I want two columns having `table` on top of another with proper margin or padding just like you see on pages created by facebook users. All I can get is this: < Please see the screenshot: !enter image description here Please see the red question mark. I want proper adjustments of alignment of tables like facebook user's created pages. Please help!
I've updated the provided fiddle with a CSS-only way of doing this: < .latest_posts_bit{ list-style: none; margin: 0; padding: 0; -moz-columns: 2; -webkit-columns: 2; columns: 2; } .latest_posts_bit li { display: inline-block; width: 100%; } I used the columns property from CSS3 to do it, so your mileage may vary. For example, it won't work on IE earlier than 10, and uses vendor-prefixes to work on other browsers. See < for more information on browser support.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css" }
Aggregated dict from pandas dataframe My Pandas df is below. I wish to convert that to aggregated key-value pair. Below is what I have achieved and also where I am falling short. import pandas as pd import io data = """ Name factory1 factory2 factory3 Philips China US Facebook US Taobao China Taiwan Australia """ df = pd.read_table(io.StringIO(data), delim_whitespace=True) df.set_index('Name').to_dict('index') {'Philips': {'factory1': 'China', 'factory2': 'US', 'factory3': nan}, 'Facebook': {'factory1': 'US', 'factory2': nan, 'factory3': nan}, 'Taobao': {'factory1': 'China', 'factory2': 'Taiwan', 'factory3': 'Australia'}} My expected output is : {'Philips': {'China', 'US'}, 'Facebook': {'US'}, 'Taobao': {'China', 'Taiwan', 'Australia'}} is there someway to aggregate!
Let us try `stack` with `groupby` `to_dict` out = df.set_index('Name').stack().groupby(level=0).agg(set).to_dict() Out[109]: {'Facebook': {'US'}, 'Philips': {'China', 'US'}, 'Taobao': {'Australia', 'China', 'Taiwan'}}
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "pandas" }
How can I cut off tip of a cone? I have a cone and I want to cut of top piece of it. How can I make cut face flat?
In orthographic mode `Numpad-5` invoke the knife tool `K`, press `C` for angle constrained, and `Z` for cut through. Space or Enter to confirm the cut. After that you only need to remove the vertex on the tip. !enter image description here
stackexchange-blender
{ "answer_score": 8, "question_score": 4, "tags": "modeling, edit mode" }
Detect lock release in couchbase? Here's what I want to do: try to lock a few documents if any lock fails: unlock any docs we've locked so far wait until all locks are cleared retry from beginning do something However, I don't know how to efficiently wait until all locks are cleared. I can't find anything in the couchbase docs, other than using an "infinite" loop that checks if the lock attempt returns a temporary failure error. Is there any good way to wait the correct amount of time before retrying? (plus some random time to avoid repeated conflicts) Waiting 15+ seconds before retrying isn't really that user-friendly.
There is not directly. Two possible optimizations could make it a bit more efficient though. One is that you could, at the app level, have a scheme whereby if you can't acquire the lock you maintain a record with waiters on that lock so only the topmost one or two are trying to acquire the lock. Two is that you probably should use an exponential backoff retry to efficiently retry on the lock. If you really want to get sophisticated, you could build and train a model around a negative exponential on when the lock is most likely available. This is where you'd poll more frequently as the "deadline" approaches and the math for that is described with a negative exponential function.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "couchbase" }
ZOTAC IONITX-F-E drivers for windows 7 (32 / 64) I bought this Zotac Motherboard like 4 years ago, and can't find the drivers for it. i've looked high and low and found nothing so far. Can anyone give me a hand, or point in me in the right direction. I've tried windows automatic update, and it installed funky video drivers that really don't work well with the motherboard. Note: I obviously don't have the box/disc anymore. !enter image description here
From Zotac ION ITX-F-E Nvidia Chipset Driver for Vista/Win7: Driver download link < **Zotac ION ITX-F-E Nvidia Chipset Driver for Vista/Win7 description** Chipset: MCP7A-ION CPU Socket: BGA 437 Dimensions: 6.7in x 6.7in - 170mm x 170mm Form Factor: Mini ITX FSB: 533 MHz Memory Size: Up to 4GB RAM Memory Slots: 2x 240 pin DDR2 DIMM Memory Type: DDR2 667/800 Onboard Audio: 5.1 Onboard LAN: 10/100/1000Mbps Onboard Video: GeForce 9400M Package Contents: 3 SATA cable 1 SATA power cable 1 WiFi antenna 1 WiFi bracket PCI Express x16: 1 Power Connector: 20 Pin RAID: 0/1/0+1 SATA: 3 + 1 eSATA USB: 10 (6 on back panel, 4 via pin header) Video Ports: D-Sub + DVI-D + HDMI Other drivers at Zotac ION ITX-F-E Drivers and Zotac ION ITX-F-E Nvidia Chipset Driver For Windows Vista,Windows 7 x64
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "windows 7, drivers, 64 bit, 32 bit" }
mysqli_query returns unexpected output I am a beginner programmer and am having a little trouble getting information from database through `mysqli_query`. I first connect to the database and then attempt to get the information from the table cbo which is inside the database. I then print out what results from the query which is not the information from the table. Instead this is what I get. mysqli_result Object ( [current_field] => 0 [field_count] => 8 [lengths] => [num_rows] => 12 [type] => 0 ) Here is the code I am using. Dump just echos the variable. <?php $con = mysqli_connect("localhost", "root", "harvard", "cbo projections"); if ( mysqli_connect_errno() ) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM cbo"); dump( $result ); ?>
`$result` is just an object that contains the resultset. You have to fetch data from it. Read mysqli_fetch_assoc or mysqli_fetch_array **EXAMPLE:** if ($result = mysqli_query($link, $query)) { while ($row = mysqli_fetch_assoc($result)) { //Display fields here according to your table structure } mysqli_free_result($result); } You could do something like while ($row = mysqli_fetch_assoc($result)) { $records[]=$row; } This will create an array named records that will contain all your fetched rows and then you can later access that array and process accordingly
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, mysqli" }
Visual help for recognizing classes in eclipse When my project grows too big, it also get harder to recognize the growing number of classes. I'm looking for a plugin for eclipse, that makes it easier to differentiate the classes by assigning icons or colors to them. Alternatively I'm looking for any tools, plugins or advice to see through the jumble of classes. (Currently I'm only using packages for grouping classes)
You should be using packages to the full extent. That means, whenever you find that at least 2 classes in an already existing package share a common aspect, think about moving them into yet another sub package. Over time, this can lead to quite long package names like `org.eclipse.product.addon.technology.ui.someview.listeners`. As those are not easy to browse, use the compressed package name display of Eclipse, which allows you to replace any package path by an arbitrary string (only for display in the package explorer). So your very long package names get shortened like here: !enter image description here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java, eclipse plugin, highlighting, visual assist" }
"sayHello(View v)" method in Android "Using a Messenger" Example I was trying to understand the "Using Messenger" in Bound Service example in Android Documentation. The example had a method named **sayHello(View v)**. I could not quite understand how the method is called and why it takes a view as a argument. I hope the question can be useful to others and community will take the question positively. Thanks.
You could define an 'android:onClick="method"' in layout.xml This calls the method with parameter "View" of your activity You may check this QA, too How exactly does the android:onClick XML attribute differ from setOnClickListener?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, android service" }
Java Generic inheritance I am trying to implement some code that starts with a parent who has a generic variable, and then the child inherits it. public class Parent <A>{ private A a; public Parent (A a){ this.a=a; } } public class Child <A> extends Parent<A>{ private A a; public Child (A a){ this.a=a; } } I'm getting a compile error stating > `constructor Parent in class Parent<A> cannot be applied to given types; A`
You need to explicitly invoke the parent's constructor from the child's constructor: public class Child <A> extends Parent<A> { public Child (A a) { super(a); } }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, generics, inheritance, compiler errors" }
FXML CustomMenuItem Example I'm having a hard time finding an example of a CustomMenuItem in FXML. Based on the API docs, I was trying this: <SplitMenuButton fx:id="dwnldBtn" text="Download" maxWidth="10000" maxHeight="10000" prefHeight="10000" GridPane.columnIndex="0" GridPane.rowIndex="3" onAction="#handleDownloadBtn"> <items> <CustomMenuItem > <button text="Download All" onAction="#handleDownloadAllBtn"/> </CustomMenuItem> </items> </SplitMenuButton> But it seems this is syntactically wrong. I want to use a button within a CustomMenuItem, because (unlike a regular MenuItem) a button can be resized (MenuItem lacks properties like maxWidth).
See Javadocs. `CustomMenuItem` has a property called `content` that determines the node displayed in the menu item. <CustomMenuItem> <content> <Button text="..." onAction="#..."/> </content> </CustomMenuItem>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javafx, fxml" }
how to map Class to a Hash and vice versa I've got a class, like this one: class A attr_accessor(:field2) attr_accessor(:field1) end What's the best way to produce a Hash out of it with keys and values taken from the class instance? And what's the best way to populate the instance of class A with values from that Hash? ===== I'm probably looking for something similar to JavaBeans introspection that would give me the names of the data object fields, then execute logic based on this info. Ruby is a very modern flexible and dynamic language and I refuse to admit that it will not let me do things that I can easily do with Java ;-) ===== In the end I found out that Struct is the best option: a = {:a => 'qwe', :b => 'asd'} s = Struct.new(*a.keys).new(*a.values) # Struct from Hash h = Hash[*s.members.zip(s.values).flatten] # Hash from Struct
Something to start playing with: a = A.new a.field1 = 1 a.field2 = 2 methods = a.public_methods(false).select { |s| s.end_with?("=") } attributes = Hash[methods.map { |m| [m, a.send(m)] }] => {"field1"=>1, "field2"=>2} If you want a more fine-grained detection of pairs getter/setter: methods = a.public_methods(false).group_by { |s| s.split("=")[0] }. map { |k, vs| k if vs.size == 2 }.compact Regarding the second question: attributes = {"field1"=>1, "field2"=>2} a = A.new a.each { |k, v| a.send(k+"=", v) } => #<A:0x7f9d7cad7bd8 @field1=1, @field2=2> However, it would appear you want to use something like Struct or OpenStruct.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, ruby" }
Different inputs but able to generate consistent outputs across different SHA engines Say I'm feeding in few thousand bits data (INPUT AAAA) into both SHA256 & SHA3 256 engines at the same time. (Both engines using different hashing architecture) and hence it will generate different 256-bits of output, lets say SHA256 generate **ABCD** while SHA3-256 generate **EFGH**. I'm curious about if we can try to find the alternative input (INPUT BBBB) later that can generate the same HASH output like above (SHA256 generate ABCD & SHA3 256 generate EFGH).
In short, this will be not be possible, even if we only use one secure hash function rather than two. You seem to be describing a sort of dual second-preimage attack where we need to find two inputs that clash over two separate hash functions. A secure hash function will be resistant to such attacks. As such for either SHA2 & SHA3, it will not be possible to find another input that makes a desired output. I believe that even SHA1 is only weak in terms of collision resistance. See here for further details.
stackexchange-crypto
{ "answer_score": 2, "question_score": 0, "tags": "sha 256, sha 3" }
What background colors would correctly describe level of importance of item on the list I have a list of customers. They are( from least to to most important): Regular customer, VIP customer, Small company, Medium company, Large company. I list them in this manner: !enter image description here I would like to know what background colors for every row so User of the system will associate it correctly in his/her mind. It should be transparent for sure but I don't know what colors to choose. Shades of grey?
You are probably asking for colors to communicate too much information. Also, having five different background colors for the rows in your table will be too messy and hard to read. I would suggest something else, like: * A star system from one to five stars. * Different icons to represent different types of customers. I like the second option, because it potentially conveys more information than just "which customer is most important". You could, for example, have an outline of a person for a regular customer, a person with a star for a VIP customer, and then three sizes of buildings for the corporate customers.
stackexchange-ux
{ "answer_score": 0, "question_score": 0, "tags": "gui design, color scheme" }
Update 10.10 server under VMWare I'm using Ubuntu Server 10.10 under VMware Workstation 7.1.3 and I wonder how to update ubuntu server via terminal since I don't have any GUI.
to make system upgrades you need to type `sudo apt-get update` to get the information about new updates from your repository and to download and install the upgrades you need to type `sudo apt-get upgrade` . If you want this in a single command you could just add `&&` like this: `sudo apt-get update && sudo apt-get upgrade` you need to type in your root passwd to be able to install updates.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 0, "tags": "10.10, server, command line, updates" }
UITabBar functionality without UITabBarController I have this problem, I've got a navigation-based application, and on the one of the detail view i need to have UITabBar, which will display some UITableViews. Since apple documentation says "you should never add a tab bar controller to a navigation controller" it make quite a problem, i've found this sample: link text, it's working, but after picking one of the table view, the UITabBar disappears.
Now that you are not using a TabBarController for showing the tableviews (as mentioned in the link), have you made sure that the table views or any other views you are adding when a tab is tapped are correct size? You are adding a subview or bringing it to top so the table view is probably covering your tab bar.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "iphone, xcode, uinavigationcontroller, uitabbar" }
Tab Index is Reset in UpdatePanel I'm currently having an issue where an updatepanel does an async postback and loses the tab order when the partial postback occurs. When you run through the tabs the tab order works correctly, but then you press a button and the partial postback occures the tabindex is reset. Is there any non-javascript solution to this. If not, what would the javascript solution be?
You might try putting this at the end of the code that is handling your button click event: ScriptManager.SetFocus(DirectCast(sender, Control)) This would put the focus back on your button when the page loads.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "asp.net, html, vb.net, updatepanel, tabindex" }
jQuery .each() not equivelant to calling a method directly on the selector? I've never had this issue before, so I'm somewhat lost. I'm getting two different results using essentially the same underlying code. The first way is this: $(".myClassSelector").append(somejQueryObject); The second way, which doesn't appear to work the same, is this: $(".myClassSelector").each(function() { $(this).append(somejQueryObject) }); The second example only appends somejQueryObject to the last .myClassSelector found.
My guess is that with the first approach jQuery internally clones the jQuery object for each of the matched elements of the selector, while with the second it just keeps appending the same object (thus removing it from earlier appended elements). Try this: $(".myClassSelector").each(function() { $(this).append(somejQueryObject.clone()) });
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "jquery, css selectors" }
Excel charts, moving horizontal axis I'm asking for help with an Excel charting problem concerning the horizontal axis. In this example, you can see that I've set labels to "Low," so they appear along the bottom. But the horizontal axis and its tick marks -- I can't figure out how to move them to the bottom. I'm aware that I could set "Horizontal axis crosses" to -0.16, but that produces a different effect. I just want to move the axis line. I can supply a workbook with this chart and its data. Example of what I have and what I'd like
I do not think the real X-axis could be moved down. But as a workaround, we may create another line to shown as X-axis. ![enter image description here]( 1. Add a colomn, set the value as 0. 2. Right click the chart > Select Data > Add a series in chart. 3. Right click the chart again > Change Chart Type > Combo, set Line and tick seconday Axis for this new series. ![enter image description here]( 4. Set No Line for previous X-axis (Horizonal Axis). ![enter image description here]( 5. Add the gridline (Such as Primary Major Vertical or Minor Major Vertical) for this chart, this action could make the chart more readble. ![enter image description here]( 6. Set No Line and no Lable for the Secondary Vertical (Values) Axis. ![enter image description here](
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "microsoft excel, charts" }
Failed to compile lua in windows phone 8 system We are working on IOS and Android with cocos2dx we have lots of lua script in our codes, and it working well in the IOS and Android. now we plan porting the app to Windows Phone 8 or Windows RT. But we get stuck by compiling lua in windows phone 8 system. It looks as if lua depends on some win32 API which are not supported in windows phone system. The compilation errors are: > undeclared identifier 'LoadLibraryA' > > undeclared identifier 'GetModuleNameA' So, anyone has some ideas?
If you change the first non-comment line in the Makefile to `PLAT=generic`, lua will compile without shared library support (that means you will not be able to load `.dll` with the `require` command) and lua will compile without any link errors. If you need to use C-libraries then add them statically to the lua binary by adding them to the `preloadedlibs` array in `linit.c`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "windows phone 8, lua, cocos2d x" }
What is meant by the term "dirty object"? I see the term "dirty" or "dirty objects" a lot in programming. What does this mean?
A dirty object is an object that has changed in its content, but this content has not been synchronized back into the database/disk. It's a typical situation of desynchronization between a cache and a storage.
stackexchange-stackoverflow
{ "answer_score": 70, "question_score": 42, "tags": "dirty data" }
Sinon, nested stubbing I am trying to stub out a module and the return inside of it and having a little trouble. Here is what I have var CrowdControlGet = sinon.stub(); var CrowdControl = sinon.stub().returns({ get: CrowdControlGet }); this does not seem to work, but when I just have var CrowdControl = testHelpers.stub() it works fine, how do i get it to return a get inside which is also a stub? Thanks!
Have you tried like this: var CrowdControlGet = sinon.stub(); sinon.stub(CrowdControl, function () { return { get: CrowdControlGet // or just sinon.stub() } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, sinon" }
Разница между декларациями массивов - имя до или после указания размерности в квадратных скобках Читаю книгу по java и показано два типа массивов: int [] a; и int a []; В чём разница между первым и вторым массивом?
Они равноправны, но первый из них лучше соответствует стилю Java. Второй же — наследие языка Си (многие Си-программисты переходили на Java, и для их удобства был оставлен и альтернативный способ). ИСТОЧНИК
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "java, массивы" }
how to get the back data from a django view using ajax my ajax is : $('#save').click(function(){ $.post(" function(data){ alert(data); }); }) and the django view is : def sss(request): return HttpResponse('ddddddddddd') how to get some data from the view 'sss' thanks
a hack to do cross domain scripting is to read the data in using urlopen and returning the data you receive while on domain1 import urlllib2 def getdata(req) redirectstr = " #make call to domain2 resp = urllib2.urlopen(redirectstr) return HttpResponse( resp.whatever() )
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jquery, ajax, django" }
Unix - Shared Libraries Error When I type `tmadmin -v` I get this error: tmadmin: error while loading shared libraries: libgpnet.so: cannot open shared object file: No such file or directory `libgpnet.so` is in my `lib` folder. Is there something I need to set so that `tmadmin` look in my `lib` folder?
You can check if the path to `lib` directory is present in the `LD_LIBRARY_PATH` environment variable. If it's not you can add it as: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/lib
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "unix, shared libraries" }
Getting undefined method `reject' error in a Rails 3.2 app In a rails app view the following works fine: <%= bc.items.uniq.collect{|g| g.display_name}.join(", ") %> However, I am trying to collect only items that have an id that includes numbers up to and including 23. I can't seem to get the syntax right. The following produces an error. <%= bc.items.uniq.collect{|g| g.display_name(false)}.join(", ").reject{g.id > 23} %> Error msg: undefined method `reject' Can I use 'reject'?
1. You need to put `.reject` before you `.collect` and `.join`, as you need to work with the Array of objects, `.collect` will return an array of strings from what I can infer, and `.join` will make it a string. 2. You need to make `g` the argument to the block. This should work; <%= bc.items.uniq.reject{|g| g.id > 23}.collect{|g| g.display_name(false)}.join(", ") %>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ruby on rails, ruby on rails 3, ruby on rails 3.2" }
Suppose $\sum |a_n|$ converges. Is it true that $\lim_{n\to\infty}n|a_n|=0$? > **Question** : Suppose $\sum |a_n|<\infty$. Is it true that $\lim_{n\to\infty}n|a_n|=0$? * * * Suppose not. Then for some $\epsilon>0$ and for every $N\in{\bf N}$, there exists $n\geq N$ such that $$ |a_n|>\frac{\epsilon}{n}. $$ This is far from enough to conclude that $\sum |a_n|=\infty$. I think there might be counterexamples to the statement. Other than this I don't see what could be useful here. Note that the monotonicity assumption has been dropped from this classical problem: Series converges implies $\lim{n a_n} = 0$
For a counterexample, take the sequence $$a_n=\cases{\frac 1n & if $n$ is a square\\\0& otherwise}$$
stackexchange-math
{ "answer_score": 9, "question_score": 4, "tags": "real analysis, sequences and series" }
Date Time Function PHP This Screenshot Date Time My Laptop.. ![enter image description here]( This Screenshot My Script Result ![enter image description here]( This My Syntax <?php session_start(); $time = date('Y-m-d, H:i:s'); echo $time; ?> Why not same.. Please Help Me.. Sorry My English Language Is Bad And I'm Newbie
here is something you need to see .... <?php $date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru')); echo $date->format('Y-m-d H:i:sP') . "\n"; $date->setTimezone(new DateTimeZone('Pacific/Chatham')); echo $date->format('Y-m-d H:i:sP') . "\n"; ?> <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php" }
How to change the disk interface type for my Windows 8.1 guest on KVM I recently setup a Windows 8.1 VM with KVM and virt-manager. I initially set the disk interface to be IDE, but I'd like to change it to virtio. However, if I just change the interface in the configuration, I have to boot into Startup Repair, which is unable to resolve the driver issue. I have already installed the latest virtio drivers in Windows. Does anyone know what else I have to do to change the interface type after I've already installed Windows?
Because you probably don’t have any device connected via the VirtIO storage controller, Windows didn’t install this specific driver. To work around this issue, create a small temporary disk image and connect it to your VM via VirtIO. Start it up and Windows will install the driver. After that, you should be able to switch the boot disk’s configuration to VirtIO, too.
stackexchange-superuser
{ "answer_score": 3, "question_score": 2, "tags": "windows, windows 8.1, virtualization, linux kvm, virtio" }
How to change TextFiled widget background color when focus I have a TextField widget which has default background color red. I want to change the background color to blue when the TextFiled is focused. But I can't do that. There are three relative properties about the color I have tried. filled: true, fillColor: Colors.red, focusColor: Colors.blue, The result is only filled is set to true, the fillColor worked and the focusColor never work. Can you tell me what to do?
You need to use a FocusNode on your TextField and a color variable to change the color: **Declarations** FocusNode _textFieldFocus = FocusNode(); Color _color = Colors.red; @override void initState() { _textFieldFocus.addListener((){ if(_textFieldFocus.hasFocus){ setState(() { _color = Colors.blue; }); }else{ setState(() { _color = Colors.red; }); } }); super.initState(); } **Widget** TextField( decoration: InputDecoration( fillColor: _color, filled: true ), focusNode: _textFieldFocus, ),
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "flutter, textfield" }
What is an Angular Material guideline to place Cancel button Where should Cancel and Create buttons be placed by Angular Material guidelines? Should it be rather in the bottom right, but before "Create" button like "Cancel | Create" that would be placed in the right bottom corner or it should be placed after "Create" like "Create | Cancel"?
As you can read in the material design spec > Action button arrangement As indicated in the Dialog design article, buttons within the mdc-dialog__actions element are arranged horizontally by default, `with the confirming action last`. > > In cases where the button text is too long for all buttons to fit on a single line, the buttons are stacked vertically, `with the confirming` `action first`. > > MDC Dialog detects and handles this automatically by default, reversing the buttons when applying the stacked layout. so the 'create' button should be placed at the end, or first, it depends on its dimensions.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "angular material, material design, user experience" }
How to get width of the container in which my view is added in Android I have a `ImageView` object inside a `LinearLayout`. I'm setting an animation to the `ImageView` which will move image view from point x to y. Now, starting point should be right corner of parent container. My question is , how do i get the dimension of the container in which the view is present. I don't see `view.getParent().getWidth()` kind of method in view hierachy.
Perhaps you don't need to because you can use % for animation like this: <set xmlns:android=" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="150" />
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 13, "tags": "android, view" }
How can I make conditional wait methods in a one function? This is the most known way to make the wait function public BaseFunction(WebDriver driver) { this.driver = driver; wait = new WebDriverWait(this.driver, 30); } public WebElement waitUntil(By element) { return wait.until(ExpectedConditions.visibilityOfElementLocated(element); } but I want to make a function that takes expected conditions as a parameter. I need to select whether is visibilityOfElementLocated or invisibilityOfElementLocated. I don't want to duplicate the functions.
You can rewrite your `waitUntil` method to take the condition as parameter like this: public WebElement waitUntil(Function<WebDriver, WebElement> condition) { return wait.until(condition); } Then you can call it as either baseFunction.waitUntil(ExpectedConditions.visibilityOfElementLocated(element)); or baseFunction.waitUntil(ExpectedConditions.invisibilityOfElementLocated(element));
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, selenium, selenium webdriver, automated tests" }
Highjack or prevent UITableView didSelectRowAtIndexPath I am trying to find a way to prevent or highjack `didSelectRowAtIndexPath:`. When a user selects a row in the tableview I want first throw an alertview saying "Data will be removed from CD if you do this." "We will be syncing the data to the server should you continue". The user clicks yes continue. I want to prevent the new cell from being selected until the syncing completes. Should the syncing fail I want to pop an alert telling the user it failed and then stop `didSelectRowAtIndexPath:` from firing, thus preventing the new cell they touched from being selected. Should the sync be successful I then want `didSelectRowAtIndexPath:` to be called. Would the best way be to highjack `willSelectRowAtIndexPath:`?
Implement the delegate method `-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath` and return `nil` for the relevant indexPath This will stop the relevant cell being selected. From the docs for `UITableViewDelegate` > Return Value An index-path object that confirms or alters the selected row. Return an NSIndexPath object other than indexPath if you want another cell to be selected. Return nil if you don't want the row selected.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "objective c, ios, uitableview, didselectrowatindexpath" }
How to create a new SQL Database on different drive I have installed SSMS 2014 recently on my new machine, installations are in C: but my C: is not having that much enough space, so I need to create the new database on D:. Please help me on how can I do that ?
you can set the path of .mdf, and .ldf file while creating the new databse. See the Red Arrow pointer. You can choose here your D drive path. Steps:- Open SQL Server Management Studio >> Right Click on Database >> Choose New Database >> Then below dialog box will be shown. !enter image description here
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 4, "tags": "sql, sql server, tsql, sql server 2005, ssms" }
Low quality posts bug I opened a question (bug report) earlier this day about LQ Posts bug (getting same posts multiple times), but I've deleted it, beacause I realized that those posts can be very similar, not the same. Later, I saw other posts to appear twice, but I don't have any proof of that. Maybe I'm not the only who noticed this, because I reached 2000 rep today, there are other people who reviews posts for a longer time than me. * * * Here's another bug: I noticed 3 times that my reviewed-posts count is getting lower and lower. I have screenshot evidences here: > !Before: count at 514 \(6:25 PM\) > !After: count at 474 \(8:32 PM\)
This was an issue due to our review task invalidation scheduled task. Basically it looks for tasks completed too fast - however the issue here is that it wasn't in sync with the client side check. After the next build review items will no longer be invalidated incorrectly.
stackexchange-meta
{ "answer_score": 7, "question_score": 9, "tags": "bug, status completed, review, low quality posts" }
Qual a diferença entre Toolbar.axml e Tabbar.axml? Estou começando a trabalhar com Xamarin no Visual Studio 2017, e alguns coisas mudaram. Na parte de android quando eu vou em layout eu deparo com os dois arquivos Toolbar.axml e Tabbar.axml, gostaria de saber quais deles representam o MainPage (a pagina principal) e qual a diferença entre os dois?
Bem, como ninguém respondeu, então provavelmente a maioria das pessoas que acessaram também não sabe. Estudando aqui a documentação descobrir que esses dois arquivos Toolbar.axml e Tabbar.axml eles são responsáveis apenas pelos itens que irá compor o menu ou a parte superior do meu App especificamente no android, pois o menu podemos editar diretamente em nossa mainpage para ser aplicado de forma geral, que nesse caso será o nosso arquivo principal, a mãe do projeto, nele teremos a parte de layout e lógica de nossa aplicação. E a parte visual do mainpage ela não possui um designer, toda a inserção de labels e demais componentes é tudo feito na unha(via script). Espero que tenho sanado a dúvidas daqueles que ainda não tinham esse conhecimento.
stackexchange-pt_stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#, xamarin, visual studio 2017" }
Magento - Create an Attribute and Applied it to specified product type I have created an attribute for my extension from this tutorials - > < It's the best one I have found on the google. Acutally I also created a custom type for product, type name is "custom_product", label is "custom product". After I added the attribute, I found it applied to every product type, so how can I just applied it to "custom product" type? So when it only displayed in new "custom product" page? Thanks.
Use this: $this->addAttribute('catalog_product', 'custom_product', array( 'type' => 'int', 'label' => 'Custom Product', 'input' => 'select', 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => true, 'comparable' => true, 'visible_in_advanced_search' => true, //this is the line that adds it to a type of product 'apply_to' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE.','.Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, 'group' => 'General', )); Check the class `Mage_Catalog_Model_Product_Type` for all available types and pick yours. You can add as many types as you want separated by comma.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, magento, magento 1.7" }
flexslider images not centered I'm using javascript/css-based flexslider as an easy way to incorporate a "slide show" into a simple web page. However the "current" image is not centered within the flexslider div box; and a piece of the "previous" image is still visible to the left of the "current" image (example of the problem). Any thoughts on what I have done incorrectly?
Try adding the following as options in your slider function : $('.flexslider').flexslider({ animation:"slide", controlsContainer: ".flex-container", itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding. itemMargin: 0, //{NEW} Integer: Margin between carousel items. }); Change tjhe itemWidth to the container width, i.e : 844px Cheers
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "css, flexslider" }
Is there a way to get a list of all the words in the solr spellcheck index? I'm using Solr's SpellCheckComponent with IndexBasedSpellChecker. Wondering if there's a way to get an output of all the words in the dictionary. Might help us catch some of the misspellings on our site.
yes, there is. IndexBasedSpellChecker, according to the doc: "The IndexBasedSpellChecker uses a Solr index as the basis for a parallel index used for spell checking. It requires defining a field as the basis for the index terms " So it just uses one field you choose from the index. To enumerate all terms on a field you use the Terms component and you set _terms.fl_ to that field. If you have lots of terms, you could play do some scrolling with _terms.lower_ , _terms.limit_ and _terms.upper_ to get the info in multiple calls.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "solr, spell checking" }
Does the convex hull of a sphere contain every point on its surface? Sorry if this is an obvious question but I have not been able to find a straightforward answer for it. My intuition tells me this is correct, and have confirmed that the scipy convex hull algorithm will return all samples used to generate a Fibonacci sphere as hull vertices. I am not a math person, but a coder trying to test the performance scaling of a script, so if someone could confirm this (with a proof if you're feeling generous) I would much appreciate it. Thank you.
Recall these two pertinent facts about the norm/length function: \begin{align*} \|x + y\| &\le \|x\| + \|y\| \\\ \|\lambda x\| &= |\lambda| \|x\|, \end{align*} where $x$ and $y$ are vectors and $\lambda$ is a scalar. The unit ball is defined by $\\{x : \|x\| \le 1\\}$. Suppose $x$ and $y$ lie in this ball. We wish to show that the line segment between $x$ and $y$, i.e. all points of the form $\lambda x + (1 - \lambda) y$ where $\lambda \in [0, 1]$, also lies in the ball. We have, \begin{align*} \|\lambda x + (1 - \lambda)y\| &\le \|\lambda x\| + \|(1 - \lambda)y\| \\\ &=|\lambda| \|x\| + |1 - \lambda|\|y\| \\\ &\le |\lambda| + |1 - \lambda| \end{align*} When $\lambda \in [0, 1]$, then $\lambda, 1 - \lambda \ge 0$, so $$\|\lambda x + (1 - \lambda)y\| \le \lambda + 1 - \lambda = 1,$$ which is what we wanted to show.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "general topology, geometry, convex analysis" }
Group By to find differences between elements of table in SQL? I have a table with items indices, scores and years. I would like to count each incident where a person's score went up between two years (table is sorted by date), so that for the following table: person_index score year 3 76 2003 3 86 2004 3 86 2005 3 87 2006 4 55 2005 4 91 2006 I will get an output of person with index 3 with 2 changes, and person 4 with 1 change: person_index times_changed 3 2 4 1 I'm using MySQL 5.7
Join the table by itself on the condition _a person's score went up between two years_ : select t.person_index, count(*) times_changed from tablename t inner join tablename tt on t.person_index = tt.person_index and tt.year - t.year = 2 and tt.score > t.score group by t.person_index See the demo
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql, group by" }
Windows Workflow Foundation 4 (WF4) ReHosting I've been looking at the possibility of ReHosting a WF4 Workflow to be used to debug running Workflows. All the posts and samples I've seen regarding WF4 Rehosting are using a WPF application to initially Host the Workflow, and then use the WorkflowDesigner in ReHosting it. Is there any way to Rehost a Workflow that was hosted in a non WPF application, like ASP.Net MVC?
The WorkflowDesigner is basically a big WPF control so you cannot host it in an ASP.NET application. Neither can you in a Silverlight application. If you need to expose the designer over an internet app you would have to either create your own designer or use something like terminal server/Citrix.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "windows, hosting, workflow foundation, workflow foundation 4" }
BigQuery PHP simple query example Can someone provide a simple example showing how to run a simple query using BigQuery (using the latest client library files) and PHP (Would like to see how the credentials are provided, what all client library files to be used and how to query and provide other details)?
The library has lots of example and also the linked question has some answers. You can also check out the other questions on the php+google bigquery tag combo. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, google bigquery" }
How to paste multiple strings into .net .resx files? I have many .resx files used for translations in a large site. To get the translations done, I copy and paste the content of each resx file into a spreadsheet. The spreadsheet comes back from the translator with the new language appended as an extra column. I've tried copying the column from the spreadsheet and pasting into the value column in the resx file but it won't work. I'm now reduced to cutting and pasting thousands of individual phrases from the spreadsheet to the resx file. There must be a better way. Is there?
Instead of using a spreadsheet, we use ResEx. This allows the translator to directly produce the .resx file.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": ".net, localization" }
JFreeChart disable zooming Is there an easy way to disable zoom in/out feature for XYPlot which is drawn in ChartComposite ? Overriding the zoom methods for XYPlot will be a solution but I wonder if there is an easy way..
Try getYourChartPanel().setDomainZoomable(false); getYourChartPanel().setRangeZoomable(false); See setDomainZoomable()) and setRangeZoomable())
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 5, "tags": "java, jfreechart" }
why would ssh work the first, second, and third time but time out on the fourth? I would like to be able to use `ssh`, but I end up getting an timeout intermittently. Here is how I can reproduce the error on the server in question: $ ssh <user>@<server> ls # returns contents as expected $ ssh <user>@<server> ls # " " " " $ ssh <user>@<server> ls # " " " " $ ssh <user>@<server> ls # times out ssh: connect to host <server> port 22: Connection timed out if I wait about 10 minutes or so, it will work again for the first three times. The system administrators have not been able to identify the issue.
It is probably a connection rate limit, imposed by the platform's equivalent of `iptables`. Three connections per minute is the most common setting, which looks suspiciously like what you're seeing.
stackexchange-serverfault
{ "answer_score": 5, "question_score": 2, "tags": "ssh, timeout" }
Mondoarchive, can I slow down write speed, and can I have it take less cpu resources? I want to backup a remote webserver live using mondoarchive, but it takes too much cpu and bandwidth which results in web requests timeout. Can I have it slow down write speed and make it take less cpu, regardless if its slower to backup?
You could try with nice and ionice which allow you to set a lower process priority (for cpu and disk scheduling, respectively). Example usage: ionice -c 3 nice mondoarchive -optionA -optionB If necessary, you can also change the priority of an already running backup using ionice (for disk priority) and renice (for cpu priority).
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "linux, backup" }
I need to convert this function from C# to VB.net - Convert INT to multi character string I need to convert this function from C# to VB.NET for use in SSRS report. This function should take a number/INT and return a multi character string. So 26 would be simple Z but 27 would = AA 78 = AAA 79 = AAB and so on Function to convert: public static String getColumnNameFromIndex(int column) {     column--;     String col = Convert.ToString((char)('A' + (column % 26)));     while (column >= 26)     {         column = (column / 26) -1;         col = Convert.ToString((char)('A' + (column % 26))) + col;     }     return col; }
If you're being **LAZY** and i mean lazy you can use < Here's the output for you: Public Shared Function getColumnNameFromIndex(column As Integer) As String column -= 1 Dim col As String = Chr(Asc("A") + (column Mod 26)) While column >= 26 column = (column \ 26) - 1 col = Chr(Asc("A") + (column Mod 26)) & col End While Return col End Function
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -9, "tags": "c#, vb.net" }
Youtube API - Channel Comments Moderation is there any way how to get all video comments for given channel through Youtube API v3? I need it to manage classic comment moderation. Many thanks for all ideas and tips! Best, Jakub
There's no support for video comments in v3 of the API. You can still do this in v2 however but it is now deprecated. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "youtube api, youtube javascript api, youtube data api" }
Can I use locate's functionality to find symlinks faster? I've just read: How to find all symbolic links pointing to any file/directory inside a given directory but that is pretty slow. Now, on typical Linux systems, a filesystem database-of-sorts is maintained, which can be searched using `locate`, rather than iterating the entire filesystem. Is it possible to utilize that database - as-is or with a tweak to the search procedure - to get symlinks pointing into a given directory? Or symlinks in general?
None of the updatedb implementations I've seen look at the target of symbolic links, or even store the file type. So no, the information isn't the database. Storing symlink targets in a form that's efficient to search would be a significant change to the database format. You could reuse the directory traversal code from updatedb, but the part about the database format, and the locate-equivalent interface would be completely new work.
stackexchange-unix
{ "answer_score": 1, "question_score": 0, "tags": "symlink, locate, updatedb" }
How to prove $f\equiv 0$ $\forall x\in [a,b]$?$\quad$($f''+pf'+qf=0$ with $f(a)=f(b)=0$) Define $f \in C^{2}[a,b]$ satisfying $f''pf'qf0$ with $f(a)f(b)0$, where $p\in C^{0}[a,b]$ and $q\in C^{0}[a,b]$ are two functions. If $q\leq0$, can we prove $f\equiv 0$ $\forall x\in [a,b]$ ? **My try:** If $f\not\equiv 0$, without loss of generality, we assume that the maximum of $f$ on $[a,b]$ is greater than zero, while notating $f(x_0)\displaystyle\max_{[a,b]} f$. Then we have $f(x_0) > 0$, $f'(x_0) 0$ and $f''(x_0) \leq 0$. I figured out that if we alter the condition $q\leq0$ into $q(x)<0$ there evidently exists contradiction. But how to analyze further with the condition $q\leq0$? Can we still find contradiction if $q(x_0)0$ and $f''(x_0)0$ ? Any ideas would be highy appreciated!
The following is based on the classical proof of the maximum principle. Let $L(f)=f''+p\,f'+q\,f$. If $L(f)>0$, then your argument shows that $f$ must be identically $0$. But we have $L(f)=0$, not $>0$. What can we do? Take $M>0$ such that $M^2+M\,p(x)+q(x)>0$ for all $x\in[a,b]$ and let $\epsilon>0$. Then $$ L(f+\epsilon\,e^{Mx})=\epsilon\,e^{Mx}(M^2+M\,p(x)+q(x))>0\quad\forall x\in[a,b]. $$ Then $$ \max_{a\le x\le b}(f+\epsilon\,e^{Mx})=\max\bigl(f(a)+\epsilon\,e^{Ma},f(b)+\epsilon\,e^{Mb}\bigr)=\epsilon\,e^{Mb}. $$ Letting $\epsilon\to0$ gives the desired result.
stackexchange-math
{ "answer_score": 2, "question_score": 5, "tags": "real analysis, ordinary differential equations, continuity" }
How to make Firefox search only part of selected link text? Instead of making Firefox search the whole sentence of the link, how do I make searching part of highlighted text? !Screenshot 1 Is there any `about:config` properties can be change to make it more like Google Chrome as below? !Screenshot 2
I found the following link: which shows someone with the same problem. They discovered that it was a bug introduced to firefox recently, which has a bugzilla entry at: < According to a post on that thread: This issue is verified fixed on Firefox 31 Beta 1 So I imagine you will have to update firefox when possible, or download a beta for now.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "google chrome, firefox" }
Implement a cross-thread call check I need to check that a method is called from the same thread that instantiated the class similar to the feature implemented by a WinForms Control. How can achieve this? is the following example valid? public class Foo { int ManagedThreadId; public Foo() { ManagedThreadId=Thread.CurrentThread.ManagedThreadId; } public void FooMethod() { if (ManagedThreadId!=Thread.CurrentThread.ManagedThreadId) throw new InvalidOperationException("Foo accessed from a thread other than the thread it was created on."); //Method code here. } } Im not so sure that storing the ManagedThreadId is enough to achieve this. If i store a reference to the Thread, can this create problems to the GC or to something else?
The `ManagedThreadId` should be fine for this task, the MSDN documentation for `Thread` states that it doesn't vary over time. After looking at the reference source for the WPF window verifies its not used across threads, I think it is also okay to keep a reference to the `Thread` your class is instantiated on, as that's what it does: storing a `Dispatcher` which in turn keeps a reference to its `Thread`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "c#, multithreading" }
How to get the existing AKS using compute target How to get the existing AKS from the notebook that I have already added to AML. Create the cluster attach_config = AksCompute.attach_configuration(resource_id=resource_id) aks_target = ComputeTarget.attach(workspace=ws, name=create_name, attach_configuration=attach_config) aks_target.wait_for_completion(True)
List all ComputeTarget objects within the workspace: Please follow the below link. < you can do like as shown below. from azureml.core.compute import AksCompute, ComputeTarget aks_name = 'YOUR_EXISTING_CLUSTER_NAME’ aks_target =AksCompute(ws, aks_name)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "azure machine learning service" }
How to see the date that Salesforce license was assigned to an user? I have been scrolling a lot, and I would like to know if there's a way to know the date of the license assignment, i. e. to see if I provide a Salesforce license on july 9.
Well there is the user's Created Date. However it is possible that you upgraded the user from one license type to another. In that case you might find info on that in Setup Audit Trail if it happened in the last 6 months.
stackexchange-salesforce
{ "answer_score": 1, "question_score": 0, "tags": "licenses" }
send $_FILES to other function how send $_FILES to other function? <?php function save(how get $_FILES["img"] ??) { //$img = $_FILES["img"]; How get $_FILES["img"] ?? $user_file = $_FILES['img']['name']; $file_temp = $_FILES['img']['tmp_name']; $new = "new/"; move_uploaded_file($file_temp, $new .$user_file.''); echo "<br><b>OK<b>"; } if(isset($_POST['SEND'])){ save($_FILES["img"]); } ?>
The actual variable is `$_FILES`; `$_FILES['img']` is a value stored within that array. You can't pass that value to a function and store it in something named `$_FILES['img']`, but you wouldn't really want to. Name it something like `$img`, and use that: function save($img) { $user_file = $img['name']; $file_temp = $img['tmp_name']; $new = "new/"; move_uploaded_file($file_temp, $new .$user_file.''); echo "<br><b>OK<b>"; }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php" }
How to use AwesomeWM signals in lua? I want to execute a method when one of my `wibox.widget.textbox` widgets is clicked, and according to the documentation I should use the `button::press` _signal_. However I didn't find anything about these signals, I can't even figure _if it is a native lua thing of if they are tied with AwesomeWM._ Thus, I don't know how to implement them. Any help would be appreciated. (Please note that I have barely no knowledge in lua). Sample code: mywidget = wibox.widget.textbox() mywidget:set_align("right") -- I want to execute awful.util.spawn_with_shell("pavucontrol") if the widget is clicked
Probably something like this. The `button::press` signal needs a callback which is called with the parameters listed in the docs you linked. Untested: local box = wibox.widget.textbox(...) local box_pressed = function(lx, ly, button, mods, find_widgets_result) // some code ... end box:connect_signal("button::press", box_pressed)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "lua, awesome wm" }
migrate cocoa touch project to cocoa I used the codes below to access the variable in the project appDelegate =(AppDelegate *)[[UIApplication sharedApplication] delegate]; UIApplication *app=[UIApplication sharedApplication]; appDelegate.myInt=1; It works. But when I try to migrate the project to Cocoa, I found there is no way to do the same functions as above. How can I use delegate concept to access the global variables (not use 'extern NSInteger myInt') Welcome any comment Thanks interdev
Have a look at the NSApplication class documentation
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "cocoa" }
Is separate boostrap js plugin file is required? I am using twitter bootstrap in my project and i am a beginner for bootstrap. I want to know that if i downloaded **bootstrap.js** and **bootstrap.css** and after that i want to use bootsrap js plugin like **carousel** , **popover** etc then i have to download a separate js file for each plugin or not ? And if yes than is there any way to download a single **bootstrap.js** which cover all js plugins and boostrap.css which cover all js plugin css ?
you could do that either way the generic `bootstrap.js` and `bootstrap.css` contains the entire bootstrap tools and widgets Alternativly, you could create your own bootstrap with only the things you need on < and yes there is a way - < 2 lines of code and you got bootstrap
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, twitter bootstrap" }
Find the extrema of the implicit function $f(x,y,z(x,y)) = x^2 + y^2 - z^2 = 0$ > Find the extrema of the implicit function $f(x,y,z(x,y)) = x^2 + y^2 - z^2$ Of course, I start with calculating the partial derivatives by implicit differentiation. $$\frac{\partial z}{\partial x} = \frac x z$$ $$\frac{\partial z}{\partial y} = \frac y z$$ Which yields that the only feasible stationary point is $(0,0)$. By the general formula of the function, $z = 0 $. But now we have a problem. Since $z = 0$, no partial derivatives at this point exist. We could try to check if $(0,0,0)$ is an extremum straight from the definition, but we don't have the formula for $z$. I need to find the extremum of $z$. How do I proceed form here?
You know that : $$ x^2 + y^2 = z^2 $$ $$\frac{\partial z}{\partial x} = \frac x z$$ $$\frac{\partial z}{\partial y} = \frac y z$$ We have that : $$ \nabla z = ( \frac {x}{ \sqrt{x^2 + y2}} , \frac {y}{ \sqrt{x^2 + y2}}) $$ So apart from $0$, $\nabla z \neq 0$. Thus, on $\mathbb R^*$, there is no critical point. Moreover, You have that * $ O := (0,0,0) $, * $ E := \\{ x,y,z \,| x^2 + y^2 = z^2 \\} $, $$ O \in E $$ Finally, if we take a look at a point $$ A = (\epsilon,\epsilon,\sqrt 2 \epsilon) $$ for a given, small $\epsilon$, we find that $$ A \in E$$ and $A_z = \sqrt 2 \epsilon > 0$. We have proven that the origin is a minimum of the function, since you can get as close as you wish from $0$ and you will always be higher than the origin: $A_z > 0$. So yes, your function is $ \mathcal C^1( \mathbb R^2 / \\{(0,0)\\})$ thus you can't derivate at $0$, but you can still proove it is a maximum, because the function is continuons on $\mathbb R^2$.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "calculus, multivariable calculus, derivatives, implicit differentiation" }
Trim a cell with VBA in a loop I'm trying to use the trim function without success. After searching for the solution on this forum and other sources online I have seen many different approaches. Is there no simple way of trimming a cell in VBA? What I want is something like this: Sub trimloop() Dim row As Integer row = 1 Do While Cells(row, 1) <> "" Cells(row, 2) = trim(Cells(row, 2)) row = row + 1 Loop So that when there is a value in column A (1) the value in column B (2) should be trimmed of any extra spaces. I just cant get this to work for me. Appreciate any help/tips! Regards Jim
So i made the code a bit accurate and mistakeproof and it worked. So i can recommend you to double check, if you have correct row and column values, because you probably targeting wrong cells. (cause your code is working) Sub trimloop() Dim row As Integer Dim currentSheet As Worksheet Set currentSheet = sheets("Sheet1") row = 2 Do While currentSheet.Cells(row, 1) <> "" currentSheet.Cells(row, 2).Value = Trim(currentSheet.Cells(row, 2).Value) row = row + 1 Loop End Sub
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "vba, excel" }
Use supercomputer to run a program I wrote a c++ program using some libraries called linbox, givaro, gmp. Now because my computer is to slow I want to run my program on a supercomputer. I am not very familiar with networks and my programming skills are not very high. I managed to upload the data that the program uses and the c++ program itself. But of course the supercomputer has not the libraries I need and so I can not compile/link. Can you tell me how can I proceed to get my program working or can you give me a good reference where I can learn to run c++ programs on supercomputers? I am using the supercomputer brutuswiki.ethz.ch/brutus/Getting_started_with_Euler
If the hpc doesn't contain required libs, you have 2 options: 1. Ask the admins to install the required libs 2. Build a static executable, which contains all the libs. If possible to go with option (2), just compile it on your machine, then upload to the hpc and run as is. I suspect unless you have mpi/pgas as part of your code, that the performance gain would not be great - supercomputers for the most part are a cluster of "ordinary" nodes, with fast interconnects. Being able to run concurrently is what makes an app take advantage of hpc.
stackexchange-unix
{ "answer_score": 3, "question_score": -2, "tags": "network interface, system programming" }
Can I have tooltips as well as a legend for one set of datapoints? The example linked here shows that tooltips relies on the manipulation of the `label` attribute, which I am currently using as the legend. How do I go about implementing this?
The tooltip doesn't rely on the label. You can use the label in the tooltip, but you don't have to. Just follow the examples and if you have a specific problem, come back here (and create a fiddle if possible).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, flot" }
Starter and smack-packs Is making a starter a good idea when using a larger activator pack from Wyeast? Should you smack the packet and add it to the starter, or add it after it swells?
# Making a starter is generally a good idea ## It doesn't really matter when you add the contents It's the same process going on in the pack as in the starter. The smack pack contains some sugars and a little yeast nutrient, making it essentially a starter on it's own. It will get you to about the half number of cells needed for a 5 gallon batch.
stackexchange-homebrew
{ "answer_score": 3, "question_score": 8, "tags": "yeast, techniques, starter, smack pack" }
Read email messages from Android app Is it possible to read email message from any mail inbox in Android application without relying on accounts configured in Email application and without relying on any Android intent? If that is possible, how to do it (either via IMAP or POP3)?
< port of javamail which does IMAP and MIME so far.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "java, android, email" }