INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Windows: Run PHP via command line from htdocs I'm trying to run PHP via the command line (Windows 7), however it's a pain tuping the full path to PHP every time. I tried using mklink mklink /D "c:\xampp\php\php" php however that doesn't seem to have done the trick, it just tells me when I type `php` that it's not a recognised program or command...
Add `c:\xampp\php` to your `PATH` environment variable. See here: How to set the path in Windows 7
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "windows 7, command line, php" }
on append() do something Is it possible to add some kind of an event/handler when an element is appended to the DOM...? .click(), .change(), .keyup() etc. alike... I need to get the height of an element as soon as it is appended and then set the height to another element
You can override the default append method and cause it to trigger a custom append event. Then bind a handler to an element for that event: < (function($) { var origAppend = $.fn.append; $.fn.append = function () { return origAppend.apply(this, arguments).trigger("append"); }; })(jQuery); $("div").bind("append", function() { alert('Hello, world!'); }); $("div").append("<span>");
stackexchange-stackoverflow
{ "answer_score": 67, "question_score": 29, "tags": "jquery" }
Javascript: Is it possible to call an object from array by its name? I have created an array like this contacts = [bob,ryan,468] Assume that bob and ryan are objects having more than one properties. I know I can call an array by its position, say, `contacts[1]` or `contacts[0]`. Is it possible to call the bob object by its name? Is there any default method to do this in javascript or should I write my own solution? **PS: I am totally new to Javascript.**
Well to be able to do this: contacts = [bob,ryan,468] `bob` and `ryan` have to be defined somewhere before that line. Something like this: var bob = { name: 'Bob', age: 42 }; var ryan = { name: 'Ryan' }; var contacts = [bob,ryan,468]; Instead of using `contacts[0]` and `contacts[1]` you could also just use `bob` and `ryan` to access them. You are asking for 'call the bob object by its name'. Objects in JavaScript don't have a name. You can have a variable that contains the object (or at least a reference to it) like `var bob = {};`. Or what do you mean by it's name? Hope this helps :)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, arrays, object" }
chess style pattern I'd like to create a pattern like in the picture for `i` rows and `j` columns: This code does not work for every case. var z = 0 for(var i = 0;i<s;i++) for(var j = 0;j<o;j++,z++) color = (z%2==1?"white":"gray"); !chess You can play with it here.
Try this, adding together i and j rather than using a third variable: for (var i = 0; i < s; i++) for (var j = 0; j < o; j++) color = ( (i + j) % 2 == 1 ? "white" : "gray" );
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "javascript, math, modulo" }
Extract pattern using regex I have the following strings: Name-AB_date, Name-XYZ_date, Name-JK_date, Name-AB_gate_date, Name-XYZ_gate_date, Name-JK_gate_date I need a regex in PHP that will match the following substrings in each of the above strings AB, XYZ, JK, AB, XYZ, JK I am currently using this the `regex`: (?<=Name-)(.*)(?=_) However in the case of Name-AB_gate_date, Name-XYZ_gate_date and Name-JK_gate_date It is returning AB_gate, XYZ_gate and JK_gate How do I get it to just match the following in these three strings? AB, XYZ and JK Permlink: <
`.*` is greedy by default. Change `.*` in your regex to `.*?`. You could try this regex also, (?<=Name-)[^_]*(?=_) OR Without lookahead. (?<=Name-)[^_]*
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php, regex" }
Isolation in Google App Engine What isolation do I get when running an application in Google App Engine? It's clearly a pretty high density environment. Do I get my own threads? Or could it be that the thread I use to process my request may have just been used by another company? I realise, if they have got security right, this shouldn't be a concern of mine. I am primarily interested to know how it works.
Some details of the runtime are here. In short, your application is run on some number of instances. Each instance consists of a dedicated process with its own sandboxed runtime environment (a Python interpreter or JRE). Runtimes aren't shared between apps.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "google app engine, isolation, multi tenant" }
How to convert mysql query to laravel? **Here my sql code:** SELECT favorites.id_user, specialities.specialities, university_datas.university_name FROM ( ( ( favorites INNER JOIN programs ON programs.id=favorites.id_program ) INNER JOIN specialities ON programs.id_specialities=specialities.id ) INNER JOIN university_datas ON programs.id_univer=university_datas.id ) WHERE id_user=2; I try with phpmyadmin and i get needed result but I can't convert to laravel
$get_fav = DB::table('favorites') ->join('programs', 'favorites.id_program', '=', 'programs.id') ->join('specialities','programs.id_specialities', '=','specialities.id' ) ->join('university_datas','programs.id_univer','=', 'university_datas.id') ->where('favorites.id_user', Auth::user()->id) ->select('favorites.id_user', 'specialities.specialities', 'university_datas.university_name') ->get();
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "php, mysql, laravel" }
Will drinking too much of beer increase the size of belly? Someone told me that drinking beer will increase the size of our belly. Is it true? Since I don’t drink beer, I don’t have any idea about that.
Most beer has a lot of calories. Just like any other calorie intake, if you consume more than you burn, you will gain weight. So, yes, drinking "too much" beer will "increase the size of belly". What "too much" means, however, is dependent on your other habits. The typical "(beer | pot) (belly | gut)" is usually "Abdominal Obesity" which, by definition, means obesity in the abdominal area specifically, i.e. the belly.
stackexchange-beer
{ "answer_score": 0, "question_score": 0, "tags": "health" }
Component instantiation and registration when extending abstract classes It is my understanding that a component that extends an abstract class is properly instantiated by SCR but it isn't saved into the service registry. It is saved only if it implements an interface. Is this correct?
The default is to use the directly implemented interfaces of the component implementation class for the service types. If the component implementation class extends a class, the interfaces implemented by the super class are not considered as part of the component implementation's default service types. To look up the type hierarchy for all interfaces would not be useful in that common interfaces, like Serializable, would be included in the default service types. So either have your component implementation class redeclare the desired interfaces of the super class, or use the service property of the Component annotation to explicitly declare the service types for the component.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, osgi, declarative services" }
Weeding out lengthy Durations I only want to keep durations less than 10 minutes long. my current code is as follows: Duration = DateDiff(ss, TimeBegin, TimeEnd) TimeBegin and TimeEnd are in TIME format. Obviously Duration right now comes back as: 00:00:07 That's where I'm running into trouble. Can I use a statement that looks like this: <= 00:10:00 or <= '00:10:00' Essentially I want: Duration = (Datediff(ss, TimeBegin, TimeEnd) *ONLY IF LESS THAN 10 MINUTESg) I already state earlier in the query that if no result is returned to create a NULL, so when a duration is Greater than 10 minutes, I just want it to be ignored as if it didn't exist.
`DateDiff(ss, TimeBegin, TimeEnd)` gives you the difference in seconds. Just use a `Case` statement to return the value only if that's under 600 (`...ELSE Null` is implied): set @Duration = CASE WHEN DateDiff(ss, @TimeBegin, @TimeEnd) < 600 THEN DateDiff(ss, @TimeBegin, @TimeEnd) END;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql server, datediff" }
Почему этот код не выводит значение атрибута на страницу? Значение созданного атрибута data-a должно выводиться в элемент с классом out. Этого не происходит. Почему? let el = document.querySelector('.one'); el.setAttribute('data-a', '168'); document.querySelector('.out').innerHtml = el.getAttribute('data-a'); <div class="one">TEXT</div> <div class="out">out</div>
Найдите 3 отличия)) let el = document.querySelector('.one'); el.setAttribute('data-a', '168'); document.querySelector('.out').innerHTML = el.getAttribute('data-a'); <div class="one">TEXT</div> <div class="out">out</div> А чтобы не делать таких ошибок - используйте _IDE_ с автодополнением
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, html, dom" }
RXJS - Angular : Two Observable<booleans> should return Observable<boolean> I want to evaluate two `observable<boolean>` and I would like to save the flow in another `observable<boolean>`. I tried `combineLatest(obs1$, obs2$);` but it generates an `observable<[boolean, boolean]>`. Is there a better function than `combineLatest` to evaluate both observables and returns another `observable<boolean>`?
I think you could use `forkJoin` here and you'll need to map these two observables into one value using `map` operator. forkJoin([observable1, observable2]).pipe( map(([bool1, bool2]) => { return bool1 & bool2; }) );
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "angular, rxjs, combinelatest" }
Is there possibility to tweak the json output in karate? Is there a possibility to tweak the output 1 to output 2 *def dataset = databaseMethods.runJsonQuery(result, query) Then print dataset output 1 : [{"Account no :"123", "Key" : "9989"}, {"Account no :"345", "Key" : "9889"},{"Account no :"569", "Key" : "9989"}] expected output what i require : { "recordset": [ [{"Account no :"123", "Key" : "9989"}, {"Account no :"345", "Key" : "9889"},{"Account no :"569", "Key" : "9989"}] } if possible can you give solution I am doing POC to adapt the karate framework for integration (api + database) automation in my company.
Yes, read the docs: < But this specific case is very simple: * def output2 = { "recordset": "#(output1)" } Also note that Karate is almost like JS, so you can even do this. * def output2 = {} * output2.recordset = output1
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "karate" }
Are carnival-style games still available in Taiwanese night markets? In Show them the door: Taiwan's netizens ashamed of loutish tourists, there's mention of a Taiwanese night market game: > The doors, with their paper panels punched through, resembled a popular night market game in which players punch out panels on a grid of small boxes to win a prize behind. **Are carnival-style games still available in Taiwanese night markets?** I'm especially interested in anything more "traditional" or specific to Taiwan, such as the game described. I went to the Shilin night market (described as the most "touristy" of them), and I don't think I saw carnival-style games.
They definitely still exist - they're more common in the southern part of Taiwan, but if you're looking in Taipei, the one near Fu Jen University had quite a bunch last time I went. <
stackexchange-travel
{ "answer_score": 2, "question_score": 9, "tags": "culture, taiwan, entertainment" }
Geometry Nodes: How to get Single Value at Index? How to Get Single Value at Index? Filed at Index node not working, cos it is working with non-single values aka fields (thanx cap) ![enter image description here](
You can use the Transfer Attribute node to get a single value when using a single value as input for index or nearest position: ![Transfer single attribute value](
stackexchange-blender
{ "answer_score": 5, "question_score": 4, "tags": "geometry nodes" }
How to link a static library in Visual C++ 2017? Trying to set up libtins on windows. Im relatively new to Visual studio and most of the documentation on the matter was for older versions. I was able to get the include files set up with the project but linking the .lib's was problematic and i cant seem to configure it properly. The properties menu seems pretty convoluted as im used to doing most things compiler related configurations from a command line.
In the Solution Explorer, right click on the project, select Properties. Expand to Configuration Properties > Linker > Input. Add the .lib file to Additional Dependencies. Do this for both the Release and Debug configuration.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "visual studio, visual c++" }
Rabbitmq MQTT topic rights I am using RabbitMQ 3.6.12. Users are connecting thought MQTT and writing to different topics. How is it possible to restrict MQTT user rights to specific topics? Currently everything is allowed: ![enter image description here]( I am aware of this documentation, but honestly I cant figure out, what to set: < I tried to set "my-test-topic" in write regexp, but then the client gets disconnected when it tries to write to this topic.
Found an solution. The following configuration will allow the user to write/read only to topics that start with ex-foo ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "rabbitmq" }
Microsoft enterprise library exception handling block using log4net I am bound to use log4net due to management decisions. Is it possible for me to use log4net just for logging within Enterprise Library Exception handling block?
Yes, just write a custom handler. We show how to do it in the Extensibility labs (labs 1 and 2).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, asp.net, logging, log4net, enterprise library" }
How to set IP to network interface? I want to set IP to each network interface in my PC. I use following command that I call from my C++ code. netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric Because `netsh` needs adapter's name I used `GetAdaptersInfo` to get all adapters. The problem is that `GetAdaptersInfo` returns name as GUID and not as, for example, "Local Area Connection 4" that is what `netsh` requires. My questions are: 1. Can I set ip according to MAC and not "Local Area Connection"? 2. If (1) is cannot be done, so how to convert `GetAdaptersInfo->AdapterName` which is GUID to "Local Area Connection"?
I found how to get the friendly name that can be passed to `netsh`. As this post says we need to use `GetAdaptersAddresses` and not `GetAdaptersInfo`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, networking, ip" }
What's the download size of Restore and Update for iPad via iTunes? If you plugin your iPad to your PC and choose to reset it, and iTunes wants to Update and Restore your iPad, how much data will it download?
1.8 GB for iPad (2016-1-22). The downloaded file is actually located in `\AppData\Roaming\Apple Computer\iTunes\iPad Software Updates` The location on Windows 10 is: C:\Users\<user_name>\AppData\Local\Packages\AppleInc.iTunes_xxxx\LocalCache\Roaming\Apple Computer\iTunes\iPad Software Updates
stackexchange-apple
{ "answer_score": 2, "question_score": -1, "tags": "itunes, ipad" }
How do I update DataGridView on parent form in C# How do I update a property on a parent form from a child form in C#?
If there is no parent child relation between the forms then you could have a look at the accepted answer to this SO question: < In this question it is about accessing a public method in an other form, so you could easily change that to a property.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#" }
Sphinx (via SphinxQL) match without asterisk, but not with asterisk I have an index in Sphinx, one of the words in this index is an article number. In this case `04.007.00964`. When I query my index like this: `SELECT * FROM myIndex WHERE MATCH('04.007.00964')` I have one result, this is as expected. However, when I query it like this: `SELECT * FROM myIndex WHERE MATCH('*04.007.00964*')` I have zero results. My index configuration is: index myIndex { source = myIndex path = D:\Tools\Sphinx\data\myIndex morphology = none min_word_len = 3 min_prefix_len = 0 min_infix_len = 2 enable_star = 1 } I'm using v2.0.4-release What am I doing wrong, or what dont I understand?
Because of min_word_len = 3 The first query will be effectivly: SELECT * FROM myIndex WHERE MATCH('007 00964') So short words are ignored. (indexing and querying) Edit to add: And "." is not in the default charset_table, which is why its used as a seperator. However "*04" is not stripped, because it 3 chars, but then there is nothing to match, because "04" will not be in the index (its shorter than the min_word_len) ... so its a unfortunate combination of word and infix lengths. Can easily fix it by making min_word_len = 2 Edit to add: or adding '.' to charset tables, so that its no longer used to separate words, therefore the whole article number is used - and is longer than both min_word_len and min_infix_len)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "search engine, sphinx, wildcard" }
Find all inputs belonging to a particular KNN class I have created a KNN based classification algorithm using sklearn Python. The algorithm has created 4 classes named "1","2","3","4". I want to give a list of inputs to the algorithm and predict in which class out of the four classes they might belong and print out the list of only those inputs belonging to class "1" Trying to use: review_3 = ["Loop","Loop No.", "Customer Tag"] review_3 = vectorizer.transform(review_3) print(type(review_3)) L = [] for i in review_3: if (knn.predict(i)==1): L.append(i) print(L) Algorithm correctly classifies the output classes but unable to get the required list. Here required output is L= ["Loop","Loop No."]
Got the required output by converting a list out of predicted outputs. The input list and predicted list together create a dictionary. The values are compared for each keys according to required class name then to get the required list out back.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, list, machine learning, output, knn" }
Lightweight python wiki engine with pluggable auth system I need to add wiki to my Tornado webapp. i'm new to python so i would like it not too intimidating to be learned and integrated and can use my existing authentication system, hence the lightweight. it would be better if can use mongodb backend. I already take a look at moin-moin and it seems too complex(?). any other alternative?
Have a look at Hatta. Overwrite `WikiRequest.get_author()` method to plug your authentication system. But it uses mercurial repository to store the data.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "python, wiki engine" }
Is there a way to find questions that have close votes but are not closed yet? _I have recently passed 3000 reputation points on Super User_. In my opinion there are not enough people to vote on closing on Super User so stuff that should be closed get two or three votes and then gets so old that no one notices them. I would like to be able to view questions that someone voted to close during the last XX hours (where XX is something between 24 and 31.4152). Is this possible?
Right now it's only possible for moderators and users with more than 10K reputation.
stackexchange-meta
{ "answer_score": 7, "question_score": 9, "tags": "discussion, feature request, vote to close" }
Mongoose array document I'm new with mongodb and mongoose. I want to know if I can make an array with two sub-documents and insert only in sub-documents if I want to and how can I access the sub doc? var User = mongoose.Schema({ username: String, password: String, UserToken: String, //here is what I want to do messagesArray: { FromUserid: String, messege: String } });
you just have to wrap the messagesArray with a `[]` var User = mongoose.Schema({ username: String, password: String, UserToken: String, messagesArray: [{ FromUserid: String, messege: String }] }); See all the data types accepted by mongoose, <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "node.js, mongodb, mongoose" }
Ruby bundle open, set $EDITOR I am trying to use the command line to open the the jquery-rails gem. I am using the command: `bundle open jquery-rails` and I am getting the message returned: `To open a bundled gem, set $EDITOR or $BUNDLE_EDITOR` Forgive me if this is totally newb, but how do I set my text editor Notepad++ like the message is telling me to? I am using windows vista/Rails 3.1 Thanks for any advice.
Because you mentioned Notepad++ I suppose you are working with Windows. You need to set an environment variable called `EDITOR` containing the path to Notepad++.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 8, "tags": "ruby, windows, ruby on rails 3, rubygems, bundler" }
JPQL to select entity based on grandchild attribute I am trying to select an entity `A` that has a `B` that contains a list of `C` where the value `C.d` must match a parameter. My entities look like this: @Entity class A { @GeneratedValue @Id private Long id; @Column(name="B") @OneToOne(cascade=CascadeType.ALL) @MapsId private B b1; } @Entity class B { @GeneratedValue @Id private Long id; @OneToMany(mappedBy="b2", cascade=CascadeType.ALL) private List<C> cs; } @Entity class C { @GeneratedValue @Id private Long id; @ManyToOne @JoinColumn(name="B") private B b2; private String d; } My naive approach on selecting my entity look like this: `SELECT entity FROM A entity WHERE entity.b1.cs.d = :d` How should the query be structured?
Should be: SELECT entity FROM A entity INNER JOIN entity.b1.cs CSList WHERE CSList.d = :d Read about INNER JOIN in JPA. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, jpql" }
Include wordpress theme in a custom php page I need to include a custom PHP page in Wordpress. So what I need to do is just to show this custom php page using the Wordpress theme installed on that Wordpress. Does not mind which theme is up, the custom php page will have to be shown under any theme is installed in that moment. How do I do it in Wordpress? I am new to Wordpress development. Thanks
Creating a custom php page that will be able to be viewed in any theme (and have the theme applied) would be _considerably difficult_. Each wordpress page calls specific theme functions of that particular theme, as well as referencing files of that theme to generate header, footer, css files, javascript files, etc.. Your custom page would need to plan for all of these contingencies, for _each possible theme_ used. Here's a alternative solution: inject PHP code **directly** into a standard wordpress page via this plugin < Meaning: you make a normal wordpress page, but are able to add php to it. When this page is rendered, the proper page template is used, and all the theme references are taken care of for you.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "php, wordpress" }
SWT Syntax highlighting widget Anyone know of an SWT widget that can be a text editor with support for syntax highlighting? I'm aware of the StyledText widget but I'm hoping that somebody has already written some libraries so one can just specify the keywords that should be highlighted.
Indeed, the general principle of syntax highlighting are using the **StyledText** Widget. !StyledText Widget The **JavaSourcecodeViewer** is a more advanced example. !alt text The **JavaViewer** is even more detailed (source code).
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 8, "tags": "java, swt" }
Fail an actor if a Future call fails I am executing something in a future call. I will return the result to the sender on successful completion or fail the actor if the future call fails. Which will be handled by the parent where a RoundRobinPool with a supervisor strategy is implemented. Here is the code snippet. private def getData(sender: ActorRef): Unit = { dao.getData().mapTo[List[Data]].map(result => sender ! result) .onFailure { case e: NullPointerExcetpion => { println("+++++++ Throwing exception") // throwning the exception from here doesn't cause the supervisor to restart this actor throw t } } // throwing the exception from here makes the supervisor strategy to take action throw new NullPointerExcetpion } How can we make the actor fail if the future returns an exception ? Cheers, Utsav
The problem is that the `onFailure` callback is thrown from an arbitrary thread, and not the one the actor is running on. What you can do is pipe the result to yourself, and then throw: case class MyFailure(e: Throwable) def receive: { case MyFailure(e) => throw e } private def getData(sender: ActorRef): Unit = { dao .getData() .mapTo[List[Data]] .recover { case e => MyFailure(e) } .pipeTo(self) } Or as @jrudolph suggested: def receive: { case Status.Failure(e) => throw e } private def getData(sender: ActorRef): Unit = { dao .getData() .mapTo[List[Data]] .pipeTo(self) }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "scala, akka" }
Django Caching on Heroku, but Not when developing I want to disable caching on my Django project when developing, but have it enabled when deployed on Heroku. Here's my current cache settings: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': os.path.join(PROJECT_ROOT, 'cache/'), } } I understand that that the below code will not cache on development: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', } } My question is: How do I combine these two settings to dummy cache on my local machine, but cache on Heroku?
You'll need to set up a local settings file for your project while you're developing (just make sure you don't deploy your local settings!) - this StackOverflow answer will help.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "django, caching, heroku" }
Allow site members to create public views As a site owner, I can create views and mark them as 'public' - however site members can't (by default). How do I add this particular capability to a group? I don't want them to be able to change the default view.. Just for them to be able to share views that they have created.
Management of public views requires the Manage List permission. You can create a custom permission level or use one of the out-of-the-box permission levels that includes the Manage List permission: Full Control, Design, Manage Hierarchy are a few Keep in mind that Manage List also enables users to manage list columns or delete the list altogether
stackexchange-sharepoint
{ "answer_score": 3, "question_score": 1, "tags": "permissions, view" }
retrieving value from array print_r($array) results I retrieved some values from database and got the following result while using print_r: Array ( [122] => Array ( [p_name] => Tony Hutson [p_image] => profile_image/profile_61323166474.jpg [pid] => 42 [sid] => 122 [stitle] => sfcxdggf [audio] => audio_file/audio_61324302202.mp3 [s_description] => ?mnlmkl bvnbmnmmn, bnbmn [s_image] => sermon_image/image_41324302202.jpg ) [count] => Array ( [count] => 2 ) ) How can I retrieve the value of count?
echo $array['count']['count'];
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "php, multidimensional array" }
Visual Studio 2010 and Windows 2000 Apparently visual studio 2010 built DLLs do not support Windows 2000. Is there a way to build with Windows 2000 support? If not, I want to down convert my solution to compile in Visual Studio 2008. I have the solution downgraded, but the project files seem to be tricky. I believe they have changed the format quite a bit between versions. How would I go about downgrading the project files?
The compatibility problem and the workaround is described in this KB article. There is no down-conversion option to go from a .vcxproj to a .vcproj. Perhaps the changed filename extension is the strongest hint, but the project file format was changed dramatically in VS2010. The build plumbing was completely changed to support building with msbuild.exe. You'll have to recreate the project from scratch in VS2008.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 6, "tags": "visual studio 2008, visual studio 2010, visual c++, windows 2000" }
making colorbar with scientific notation in seaborn I am plotting the following heatmap in seaborn. the dataframe is read from the foll. csv file: < ax = sns.heatmap(df, linewidths=.1, linecolor='gray', cmap=sns.cubehelix_palette(light=1, as_cmap=True)) locs, labels = plt.xticks() plt.setp(labels, rotation=0) locs, labels = plt.yticks() plt.setp(labels, rotation=0) How can I modify the colorbar numbers so that they 160000 shows up as 1.6 with a 10^5 on top of colorbar. I know hot to do this in matplotlib but not in seaborn: import matplotlib.ticker as tkr formatter = tkr.ScalarFormatter(useMathText=True) formatter.set_scientific(True) ax.yaxis.set_major_formatter(formatter)
Pass your `formatter` object through the `cbar_kws`: import numpy as np import seaborn as sns import matplotlib.ticker as tkr formatter = tkr.ScalarFormatter(useMathText=True) formatter.set_scientific(True) formatter.set_powerlimits((-2, 2)) x = np.exp(np.random.uniform(size=(10, 10)) * 10) sns.heatmap(x, cbar_kws={"format": formatter}) ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 4, "tags": "python, pandas, matplotlib, seaborn" }
Adding encoded chars to the url breaks htaccess Here's my code: RewriteEngine on RewriteRule page/(.*) index.php?url=$1 [NC] When I access _page/ = works just fine When I access _page/http%3A%2F%2Fgoogle.com%2F_ = server reports 404 Martti Laine
Apache returns a (somewhat non-intuitive) 404 in cases when you have encoded slashes in the request, but do not have `AllowEncodedSlashes` set to on. To confirm this is the case, check your error log, which likely contains an entry like this: > found %2f (encoded '/') in URI (decoded='/page/< returning 404
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "url, .htaccess, character encoding, encode" }
Remove rings to wash? Do I need to remove my wedding-band, which I wear every day, to wash for Hamotze or morning Negel vasser? What about other rings?
The Shulchan Aruch (OC 161:3) writes: > צריך להסיר הטבעת מעל ידו בשעת נט"י ( ואפילו הוא רפוי) (ב"י) ואפי' אינו מקפיד עליו בשעת נטילה, הואיל ומקפיד עליו בשעה שעושה מלאכה, שלא יטנפו (הרא"ש פ' תינוקת) (ונהגו קצת להקל אם הוא רפוי, אבל יש להחמיר, כי אין אנו בקיאים איזה מיקרי רפוי).‏ > > (My translation): You must remove your rings at the time of washing, even if you do not care to remove it while washing, since you care to remove it while working so it doesn't get dirty. Some are lenient because the ring is loose, but it is proper to be stringent because we cannot determine how loose is loose enough for the water to get through. Summary: if you would take off your ring while working in dirt or something to keep it clean and safe, than you must remove it for washing. It is hard to determine how loose is loose enough to allow the water through. Therefor it is proper to always remove one's rings for washing.
stackexchange-judaism
{ "answer_score": 12, "question_score": 10, "tags": "halacha, netilat yadayim washing, chatzitzah, jewelry" }
How do I configure Asterisk to use G729 on a trunk with FreePBX I've successfully got the channel from phone->PBX working on G279. I'm just trying to get the PBX->trunk to also be G279. I did this by using FreePBX and putting in allow=g729,ulaw into each extension. As I'm using FreePBX and no asterisk expert I wanted to avoid editing sip.conf if possible. The question is, how can get the same effect for the trunk?
I am assuming that you have g729 codec module at this point. In your trunk configuration page, in PEER Details fields add disallow=all allow=g729 Make sure you do it in the same sequence as above. Also do the same in USER Details if you have any entry in this field.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 1, "tags": "asterisk, freepbx" }
Is it possible to use libraries written in an old version of swift in a project with a newer version of swift? I'm working on a project in Swift 3. However, many libraries are still using Swift 2.3. Is there a way of making use of them in my project as they are? Since it's possible to use Objective C libraries in Swift, I figure there's a chance.
Maybe this reference from Apple answers the question: unfortunately it would seem to be impossible: > First, Swift 2.3 and Swift 3 are not binary compatible so your app's entire code base needs to pick one version of Swift. <
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "ios, swift" }
Timespan type cannot be mapped correctly when using Servicestack CsvSerializer I am trying to convert list of objects to comma seperated string through SerializeToCsv method of Servicestack. However, i realized that timespan cannot be converted correctly. Forexample, my timespan value is 19:00:00, however it converts as PT19H. You can see the code below. I can convert timespan to string by adding string property and change timespan to string at runtime in object, however i thought that there would be better way in Servicestack and could not find anything on internet. Thanks in advance! public string Convert() { var data = _table.Get(); CsvSerializer.UseEncoding = PclExport.Instance.GetUTF8Encoding(true); var csvStr = CsvSerializer.SerializeToCsv(data); return csvStr; }
This is the default serialization of TimeSpan which uses the XSD duration format, e.g. 19 hours = `PT19H`, i.e. a Period of 19 Hours. You can change the serialization format with: JsConfig.TimeSpanHandler = TimeSpanHandler.StandardFormat;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "csv, asp.net core, servicestack, timespan" }
Dividing by epsilon and taking the limit of epsilon to zero In deriving the joint distribution of two order statistics, there is the following step (F(x) is the Cumulative Dist Function at x, f(x) is the PDF at x): $$ F(x-\epsilon)^{n-s}\times[F(x+\epsilon)-F(x-\epsilon)]\times [F(y-\epsilon)-F(x+\epsilon)]^{s-r-1} \times[F(y+\epsilon)-F(y-\epsilon)]\times (1-F(y+\epsilon))^{r-1} $$ then, we divide by $\epsilon$ and take $\epsilon \to 0$, which yields: $$ F(x)^{n-s} \times f(x)\times [F(y)-F(x)]^{s-r-1} \times f(y) \times (1-F(y))^{r-1} $$ since $$ \lim_{\epsilon \to 0} \frac{F(x+\epsilon)-F(x-\epsilon)}{\epsilon} = f(x) $$ My question is, there are two expressions using this epsilon to get $f(x)$ and $f(y)$, which means that its more like dividing by $\epsilon^2$? I am confused on this point, is it that we can ignore this since $\epsilon$ is going to zero anyway?
You're right, this is wrong; the second expression is essentially the limit of the first expression divided by $\epsilon^2$ (up to two factors of $2$, as Henry pointed out).
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "probability theory, proof writing, epsilon delta, order statistics" }
How to hide space for image when no images found in the server? I have data aggregator, organize the data from different source by specific manner. Sometimes the images given in the source type is not available or the source refused to serve the images. In this case, I want to remove the space given for image tag. Is it possible? !enter image description here I want to hide the highlighted area space when no image found or serve refused to serve the image.
The best way to do that would be to use the `onerror` function. Something like this: `<img src="image_not_found.jpg" onerror="this.style.display = 'none';" alt="">` You can find out more about it here < **edit** Even though this will work for all the browsers, using the `onerror` attribute will make your HTML invalid since it is not part of the `img` attribute list. An article on the pros and cons for using this attribute. <
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "html, css" }
Not able to connect on Mongodb Atlas port I'm using an M0 GCP instance. I can connect to the cluster using this string: 'mongodb+srv://my_user:my_pass@my_cluster-mbsnz.gcp.mongodb.net/db?retryWrites=true&w=majority' I'm trying to use another client where I need to pass host and port, but I can't connect. I tried telnet to the port 27017, but for some reason I'm not able to connect directly on the port. curl curl: (7) Failed to connect to my_cluster-mbsnz.gcp.mongodb.net port 27017: Connection timed out or telnet my_cluster-mbsnz.gcp.mongodb.net 27017 Trying 185.82.212.199... ^C -> After a long time waiting What might be wrong ?
`+srv` urls use a DNS seed. On atlas, you can click into the cluster and you should be able to see the urls for your primary & your secondaries and use those urls to connect. You should also be able to use `nslookup` to get that info using part of that connection string, but it's probably simpler to just look up the urls through the UI. < > In order to leverage the DNS seedlist, use a connection string prefix of mongodb+srv: rather than the standard mongodb:. The +srv indicates to the client that the hostname that follows corresponds to a DNS SRV record. The driver or mongo shell will then query the DNS for the record to determine which hosts are running the mongod instances.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 5, "tags": "mongodb, mongodb atlas" }
Check length of string literal at compile time I would like to check length of my string literals at compile time. For now I am thinking about the following construction, but can't complete it: #define STR(s) (sizeof(s) < 10 ? s : /* somehow perform static_assert */) void foo(const char* s) {} int main() { foo(STR("abc")); // foo("abc") foo(STR("abcabcabcabc")); // compile time error: "String exceeds 10 bytes!" }
This is C++, where there are superior options to macros. A template can give you the exact semantics your want. template<std::size_t N> constexpr auto& STR(char const (&s)[N]) { static_assert(N < 10, "String exceeds 10 bytes!"); // < 11 if you meant 10 characters. There is a trailing `\0` // in every literal, even if we don't explicitly specify it return s; } The array reference argument will bind to string literals, not pointers (that can trip your macro), deduce their size, and perform the check in the body of the function. Then it will return the reference unchanged if everything checks out, allowing even for continued overload resolution.
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 15, "tags": "c++" }
Receiving "The requested operation requires elevation" when updating printer drivers Today all users trying to print to a shared printer from the server are receiving a prompt to update printer driver. A UAC prompt appears and asks for Admin credentials. Once the credentials have been entered the driver begins to install, but then an error message from NtPrint.exe states that The requested operation requires elevation. Nothing seems to resolve this issue. I suspect that logging in as the admin and updating the driver might work, but that task would be daunting with 40 computers. Is there any fix for this, so that the users can simply enter the admin credentials themselves and install the driver, or perhaps not require admin credentials to install? Please let me know. Thanks!
So, I found a post here to disable UAC through GPO. After applying this and having the users reboot they can now install the drivers needed. There are a few users getting a weird issue in which they can install without error, but the driver never gets applied, so they end up in some strange drive install loop. I believe this is due to a rogue GPO from the old IT guy, so I'll consider this issue resolved.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "windows 7, drivers, printer" }
jQuery not working as expected on page reload I have written a jQuery-script, which should run after the page has loaded completely. It should jump down to the end of the page, hide a div and scroll up with an animation after a little delay. This is my Code: < If I run it from jsFiddle, it works as expected. If I open it locally in Chrome or Safari (Not tested in FF, Opera and IE) it works as expected too. The problem is, that if I am trying to reload the page, it won't scroll in any way, but runs everything else as expected. Could the two .scrollTop() kill each other? $('html,body').scrollTop($siteheight); $('#loader').fadeOut(); $('html,body').delay(2000).animate({scrollTop: 0}, 600);
This may be silly but I don't see it wrapped in a document ready function $(document).ready(function() { //insert code here }); Here is the updated jsfiddle.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery, scroll, scrolltop" }
Paint for Gas Stove The photo shows an older gas stove that is chipped (black spots). Is there a good paint (preferably from Home Depot or Lowe's) that should be used for this type hot environment? # UDPATE: This stove is for a rental unit and this tenant is really tough on gear. They pay for repairs, but a sensible approach would take this into account ![enter image description here](
Most home centers have porcelain chip repair products. Sheffield and Rustoleum are a couple of popular brands. It is supplied in a small bottle with a brush built into the cap similar to automotive touch-up paint. It will cover the chip and prevent the steel from rusting. The repair will be visible, but less obvious.
stackexchange-diy
{ "answer_score": 2, "question_score": 0, "tags": "paint, stove" }
MSBuild: How to conditionally use one of two targets with same name? I've seen some answers to a similar question but not exactly the same and not with positive luck trying to use suggested solutions... so I'm trying something like this: <project> <target name="foo" Condition="'$(Configuration)' == 'Debug' "> <Message Text="=== RUNNING FOO DEBUG TARGET ===" /> </target> <target name="foo" Condition="'$(Configuration)' == 'Release' "> <Message Text="=== RUNNING FOO RELEASE TARGET ===" /> </target> </project> ... but I'm finding that it doesn't appear to be possible to have two targets with the same name working properly under these conditions. One will negate the other. How can I do this?
Provide a wrapper target, that depends on both targets. The both will be called, but only the one matching the condition will actually do something. <Project> <Target Name="foo" DependsOnTargets="_fooDebug;_fooRelease"/> <Target Name="_fooDebug" Condition="'$(Configuration)' == 'Debug' "> <Message Text="=== RUNNING FOO DEBUG TARGET ===" /> </Target> <Target Name="_fooRelease" Condition="'$(Configuration)' == 'Release' "> <Message Text="=== RUNNING FOO RELEASE TARGET ===" /> </Target> </Project>
stackexchange-stackoverflow
{ "answer_score": 21, "question_score": 9, "tags": "visual studio, msbuild" }
more space under the website without any reason i've a simple html page but there's a space under the footer which I don't know where it comes from I've tried to resize the body , the wrapper and the container but the same result
get rid of the height in line 487 of style.css: .copyright { font-family: 'GESSUniqueLight-Light'; color: #1c2d54; font-size: 13px; width: 130px; /* height: 120px; */ float: left; margin-left: 450px; margin-top: 70px; }
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": -2, "tags": "css" }
Dyanmic fragment that changes activity by static buttons I'll start by showing what I'am trying to do with a picture, please take a look !enter image description here As you can see I have three buttons that are in the main activity, when i press BTN_1 i want the fragment to initialize an activity lets call it Activity_A that has it's own layout and functions, same with BTN_2 and BTN_3 , each button starts a different activity, the buttons are static, they stay there forever. Basically its one activity that is static that hold inside it a dynamic fragment that is dynamically changed to different activity's I'm kind of lost here so any help would be more than thankful: tutorials,Code example,hints Thanks a lot.
Assuming you are using API11+, I think you will be well served by the "Action Bar with Tabbed Navigation" pattern. Google explains this pattern here, complete with example code. If you need to support versions older than Honeycomb, you can do the same thing with ActionBarSherlock. The basic idea is that you have a single activity with tabs that are automatically placed appropriately based on screen size. When a tab is hit, you can handle and respond by loading an appropriate Fragment into the content area of your app.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, android fragments" }
React; How to get the width of React-Alert adjust based on the alert text I'n my react app, i'm using `react-alert`. The problem i'm having is the width seems to be fixed thus having the text wrap. I'm trying to have the width adjust it's length based on the length of the containing alert message and not wrap the text. How do i go about doing that? // React Alert import { Provider as AlertProvider } from "react-alert"; import AlertTemplate from "react-alert-template-basic"; // Alerts Options const alertOptions = { timeout: 5000, position: 'top center', } ReactDOM.render( <React.StrictMode> <Provider store={store}> <AlertProvider template={AlertTemplate} {...alertOptions}> <App /> </AlertProvider> </Provider> </React.StrictMode>, document.getElementById("root") ); serviceWorker.unregister();
Two ways you can get around this: 1. Use your own template instead of `react-alert-template-basic`. It's a simple template file that you can keep in your codebase. You can copy all the things from `react-alert-template-basic` except `width` (which is set to `300px`) and you're good to go. 2. Keep using `react-alert-template-basic` but override CSS. You'll have to use `!important` to override as they are using inline styles. Like this #__react-alert__ div div div { width: auto !important; }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "reactjs, alert" }
How I can use Apply or Map with If? I have list of objects: list = {{1, 1, 0.05, 0.05}, {2, 2, 0.05, 0.05}, {13, 13, 0.05, 0.05}}; list = {{x,y,Vx,Vy},{x,y,Vx,Vy},...}; And object = {10, 10}; I want when I change position of object the objects from the list to follow the first object. I try with this: If[object[[1]] < #1 && #3 > 0, list = {#1,#2,-#3 ,#4}, list = {#1,#2,#3,#4}] &@@@list If[object[[1]] > #1 && #3 < 0, list = {#1,#2,-#3 ,#4}, list = {#1,#2,#3,#4}] &@@@list If[object[[2]] < #1 && #4 > 0, list = {#1,#2,#3 ,-#4}, list = {#1,#2,#3,#4}] &@@@list If[object[[2]] < #1 && #4 < 0, list = {#1,#2,#3 ,-#4}, list = {#1,#2,#3,#4}] &@@@list and works but only the first cycle. I know that I can do this with: If[object[[1]] < list[[1, 1]] && list[[1, 3]] > 0, list[[1, 3]] *= -1].... But is very slow and not look nice :). And doesn't work completely correct.
Perhaps: list = list /. {x_, y_, vx_, vy_} -> {x, y, Sign[#[[1]] - x] vx, Sign[#[[2]] - y] vy}& @ object ### Edit There is however a small subtlety: if your list is composed by exactly four sublists, the pattern `{x_, y_, vx_, vy_}` will match the whole list of lists. So, for avoiding this edge case, a good practice is to use pattern tests. I will write the four of them, but in your case one will suffice list /. {x_?NumericQ, y_?NumericQ, vx_?NumericQ, vy_?NumericQ} -> {x, y, Sign[#[[1]] - x] vx, Sign[#[[2]] - y] vy} &@ object
stackexchange-mathematica
{ "answer_score": 8, "question_score": 5, "tags": "list manipulation" }
Подключить и вызвать функцию из файла .js В консоль выводит > функция is not defined <!DOCTYPE html> <html> <head> <title>Function</title> <script src="js/function.js"></script> </head> <body> <button type="submit" onclick="check()">Check value</button> </body> </html> //Файл function.js function check(){ var value=prompt("Please enter the value:", 0); var message= (value > 0) ? "1": (value <0) ? "-1": (value==0) ? "0"; alert(message); } Подскажите, в чем проблема?
У вас данное предложение синтаксически некорректно var message= (value > 0) ? "1": (value <0) ? "-1": (value==0) ? "0"; Попробуйте его исправить следующим образом var message= (value > 0) ? "1": ( (value <0) ? "-1": "0" );
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript" }
sorting not all of columns in datagridview It is possible to sort a `DataGridView` by clicking on one of its `ColumnHeaderCell`. But I would like one column, containing the index of each row, to remain fixed. What I mean is that when I click on another column header the grid rows should be sorted on the content of that column, all except the first column that contains the index of rows. Sorry! I can't post image!
If you mean that you want to **break** the rows: No you can't do that without re-creating them completely. A Row is a unit with its Columns and they can only move as one. However if you want one column to always contain the visible row number you'll simply have to re-fill that column after each sort: private void dataGridView1_Sorted(object sender, EventArgs e) { dataGridView1.SuspendLayout(); int yourindex = 0; // whichever column your index is at foreach (DataGridViewRow row in dataGridView1.Rows) row.Cells[yourindex].Value = row.Index; dataGridView1.ResumeLayout(); } Note: By doing this you will lose the ability to re-create the original sort order. This may not be a problem. If it is you need to include an extra column called 'key' or 'old order' or whatever.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "c#, datagridview, columnsorting" }
how to save id of one table to another table in codeigniter? i want to save id of one table to another table how should i write the model and controller. For example : I have a database like this tbl1: (id,content,time,date,category) tbl2: (id,tbl1_id,category_detail)
$tbl1Data = array( 'id' => '', 'content' => 'Hi, content will be here', 'time' => date("H:i:s"), 'date' => date("Y-m-d"), 'category' => 'Electronics' ); $this->db->insert('tbl1',$postData); $recordId $this->db->insert_id(); $tbl2Data = array( 'id' => '', 'tbl1_id' => $recordId, 'category_detail' => "alskjdflkajsdlk falsjdflka lsdkfj as", ); $this->db->insert('tbl1',$postData);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, codeigniter" }
Determine in and out momentum in shell momentum balance How to decide what is in momentum and what is out momentum in using shell momentum balance? My main motive is to understand why at 25:26 in the balance equation at < the professor is doing $\tau_{xy}|_{x} - \tau_{xy}|_{x+\Delta x} $ and not the other way round? Even on wikipedia, < it isn't written what is in and what is out. If you consider always that the ground/wall kind of releases momentum then consider this < at 17:26 where in is taken as being released from the center of the circular pipe and not the walls.
We made an assumption at the start that $ \tau_{xy} $ means momentum flows in x direction which means the "in" is in the x direction. So as long as "in" is taken in the positive x, y, z direction for appropriate coordinates the analysis w'd be right. **Reference Book:** Transport Phenomena Textbook by Edwin N. Lightfoot, Robert Byron Bird, and Warren E. Stewart Page 43 ![enter image description here](
stackexchange-engineering
{ "answer_score": 0, "question_score": -1, "tags": "fluid mechanics, chemical engineering" }
If $\hat{f}$ is a real function, then $f$ is even. I have the following exercise: Let $f \in C(\mathbb{R})\cap \cal{L}^1$. Show that: $$\hat{f}(\xi) \in \mathbb{R} \;\;\forall \xi \in \mathbb{R} \iff f \text{ is even.} $$ I did the ($\Leftarrow$) part just using basic properties of Fourier and change of variable. But my problem is at the ($\Rightarrow$) part. My attempt: $$\overline{\hat{f}(\xi)}=\hat{f}(\xi)$$ $$\overline{\frac{1}{\sqrt{2\pi}} \int_{\mathbb{R}} f(x)e^{-ix\xi} \, dx} = \frac{1}{\sqrt{2\pi}} \int_{\mathbb{R}} f(x)e^{-ix\xi} \, dx$$ $$\frac{1}{\sqrt{2\pi}} \int_{\mathbb{R}} f(x)e^{ix\xi} \, dx =\frac{1}{\sqrt{2\pi}} \int_{\mathbb{R}} f(x)e^{-ix\xi} \, dx$$ $$\int_{\mathbb{R}} f(x)e^{ix\xi}\,dx=\int_{\mathbb{R}} f(x)e^{-ix\xi}\,dx$$ $$\int_{\mathbb{R}} f(x)e^{ix\xi}\,dx=-\int_{\mathbb{R}} f(-y)e^{iy\xi}\,dy$$ And I'm failing to conclude $f(x)=f(-x) \forall x \in \mathbb{R}$ from this... Any help would be appreciated.
Essentially you have $f$ and $g$, where $g(x)=f(-x)$, and $$\int_{\mathbb{R}} f(x)e^{ix\xi}dx=\int_{\mathbb{R}}g(x)e^{ix\xi}dx.$$ By the Fourier inversion theorem we have $$\int_{\mathbb{R}}\left(\int_{\mathbb{R}} f(x)e^{ix\xi}dx\right)e^{-i\xi y}dy=\sqrt{2\pi} f(y)$$ and $$\int_{\mathbb{R}}\left(\int_{\mathbb{R}} g(x)e^{ix\xi}dx\right)e^{-i\xi y}dy=\sqrt{2\pi} g(y).$$ Therefore, $f=g$.
stackexchange-math
{ "answer_score": 1, "question_score": 3, "tags": "fourier transform" }
Unable to install pygame on Python via pip (Windows 10) Currently unable to install **Pygame** via pip: pip install pygame Getting this message: ![]( Concerned by it being termed an EOF error, is this an error in the module itself?
There's `dev` versions available as of now. Get them via pip install pygame==2.0.0.dev6
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 5, "tags": "python, pip, pygame, python 3.8" }
How is it possible to know what caused an exception In the code I am implementing I have __except(EXCEPTION_EXECUTE_HANDLER) { return false; } And there is an execution path when the exception occurs How can I know why the exception happened while debugging? Use `GetExceptionInformation`?-Can it print the exception or give me exception`s data?
In Visual Studio, you can go to `Debug > Exceptions` (in the menu). There's a checkbox for each exception type which enables you to break execution when the exception is thrown.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c++, windows, visual studio 2010, exception" }
JQuery, getting value of checked radio button, why is this not working? I am trying like below to get the value of a checked radio button but it just keeps giving undefined. I am using Firefox on Ubuntu so I don't know if its some weird quirk of the browser or what, I would appreciate any advice as this is driving me crazy: <input name="tagRow_ddd" type="radio" value="p"> <input name="tagRow_ddd" type="radio" value="r"> alert($('input[name=tagRow_ddd]:checked').val()) Jfiddle: <
that's exactly the output it should give. the `:checked` selector only finds checked elements... you haven't any. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, radio button" }
How does this recursive function come to this output? Can someone explain the output for this recursive function? Thank you! function test(a) { while (a > 0) { a -= 1; test(a); console.log('after first invocation: ' + a); } } test(3);​ Output: after first invocation: 0 after first invocation: 1 after first invocation: 0 after first invocation: 2 after first invocation: 0 after first invocation: 1 after first invocation: 0
Well the code does 100% what you tell him to do! loop 1 : value of a is 3, is it bigger then 0? Yes! 3 - 1 = 2 (why not a-- ...) call function test(2) is 2 bigger the 0? Yes! 2 - 1 = 1 call function test(1) is 1 bigger the 0? Yes! 1 - 1 = 0 call function test(0) is 0 bigger then 0 ? NO! console.log(('after first invocation: ' + 0) I don't think i have to do it for every output but I think you get the point?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, function, recursion" }
Can't load Action Helpers in Zend-framework application I'm trying to create an Action Helper, but I'm havin't a hard time loading it and I'm getting this error: `Message: Action Helper by name Usersession not found` In my controllers action method, where i'm trying to call this helper, I have this: Zend_Controller_Action_HelperBroker::addPath('/helpers/'); Zend_Controller_Action_HelperBroker::addPrefix('Helper'); $userSession = $this->_helper->getHelper('Usersession'); $this->view->session = $userSession->eendersWat(); I'd actually prefere to load my helpers from bootstrap.php, but wasn't able to figure that out neither. My helpers are located in `application/controller/helpers`. My helper filename is `Usersession.php` and the class is called `Helper_Usersession` Any ideas why this isn't working?
I use something like the following in `Bootstrap`: protected function _initHelperPath() { Zend_Controller_Action_HelperBroker::addPath( APPLICATION_PATH . '/controllers/helpers', 'Application_Controller_Action_Helper_'); } The helper class is then named `'Application_Controller_Action_Helper_Usersession'` and the file is located in `application/controllers/helpers/Usersession.php` Of course, this presumes you are using `Application_` as your application namespace. In your case, it appears that you are using an empty application namespace and none of my wordy `Controller_Action_` infix, so your's would be something like: protected function _initHelperPath() { Zend_Controller_Action_HelperBroker::addPath( APPLICATION_PATH . '/controllers/helpers', 'Helper_'); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "zend framework, helper, autoload" }
How does hornetq persist messages? We are in the process of planning our server machine switch. While we are doing the switch, we need to be able to continue to receive traffic and save the JMS messages that are generated. Is it possible to move the persisted message queue from one JBoss 7.1.1/HornetQ to another?
You can use export journal / export data... or you can use bridges to transfer data. You should find some relevant information at the documentation on hornetq.org
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "jboss, hornetq" }
SQL - Select inside Select My skills with SQL are simple, so i'm not sure how to do this.. Here it goes. Lets consider this. Table A ID Name LastNameID 1 Jonh 23 2 Helen 19 Table B ID LastName 23 Bauer 19 Summers . SELECT ID Name LastNameID FROM TableA How can i add another Select inside that one that will return the LastName from Table B based on the LastNameID in Table A. In this case i usually use a simple function with the Programming language that i use to do that for each returned Row. But i think its time to do that with SQL alone. Any help is appreciated.
You just need to join the tables using the LastNameId field: SELECT TableA.[Name] AS FirstName, TableB.LastName FROM TableA INNER JOIN TableB ON TableA.LastNameId = TableB.LastNameId
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "sql" }
EXCEL: Count of Column Items For Every Distinct Item In Another In my Excel sheet, I have 2 columns. Names of restaurants, and ratings for each one. For each rating, a new row is created, so of course a restaurant name occurs multiple times. Restaurant Rating McDonalds 8 McDonalds 7 Red Robin 5 Qdoba 7 Etc. How can I get the number of times each rating happens for each restaurant? We'll say rating goes from 1-10. I want it to look like this: Restaurant 1(rating) 2 3 4 5 6 7 8 9 10 McDonalds 889 22 45 77 484 443 283 333 44 339 Any help is appreciated!
Using Pivot Tables: Use a pivot tables to set your rows at "Restaurant" and your columns as "Rating" and your values as "Count of Rating" Using Countifs: ![Using Countifs](
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "excel" }
JOIN a table by SELECT subquery with LIMIT 1 and WHERE clause matching column values outside of it I'm trying to JOIN a table with a subquery to limit data to only 1 last row, matching certain values from other FROM or JOINed tables: SELECT t1.column1, t1.column2, t2.column1, t3.column2 FROM table1 t1 JOIN ( SELECT column1 FROM table2 WHERE t1.column2 > table2.column1 ORDER BY table2.date DESC LIMIT 1 ) t2 JOIN table3 t3 ON t2.column1=t3.column2 Getting an error: Unknown column t1.column2 in 'where clause'. Seems I can't address other columns inside the subquery. Is what I'm trying to do possible? If so, what am I doing wrong / what other way could I try this?
The solution for me was: SELECT t1.column1, t1.column2, t2.column1, t3.column2 FROM table1 t1 JOIN table2 t2 ON t2.id = ( SELECT id FROM table2 WHERE t1.column2 > table2.column1 ORDER BY table2.date DESC LIMIT 1 ) JOIN table3 t3 ON t2.column1=t3.column2 More info on: CROSS/OUTER APPLY in MySQL <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, join, subquery" }
Laravel access JSON object in controller I have this array in the controller after the submitted form holds in variable `$product`. [ { "id": 2, "name": "nancy", "cost": 34, "quantity": 0, "barcode": 12345, "category_id": 2, "created_at": "2020-07-05T16:04:10.000000Z", "updated_at": "2020-07-09T04:06:09.000000Z" }, { "id": 5, "name": "jk", "cost": 100, "quantity": 2, "barcode": 147258, "category_id": 2, "created_at": "2020-07-08T20:34:56.000000Z", "updated_at": "2020-10-18T13:09:16.000000Z" } ] How can I access the properties in objects like `id`, `name`, `barcode` ?
If you want to make it as array of array. $products = json_decode($products, true); // Return array of array. foreach($products as $product){ echo $product['name']; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "laravel" }
Mod url write rules in .htaccess Need help to create mod url write rules in .htaccess < where Cat and subcat will change according to category and sub category.
Try this in your .htaccess RewriteEngine On RewriteCond %{THE_REQUEST} /marketplace/([^/]+)/([^/]+)/\?city=([^&]+)&area=([^&\s]+) [NC] RewriteRule ^ /marketplace/%1/%2/%3/%4? [NE,NC,R,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^marketplace/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /marketplace/$1/$2/?city=$3&area=$4 [QSA,L,NC]
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, apache, .htaccess, mod rewrite, url rewriting" }
How to assign values to a vector in pairs of 10 in R? I want to assign in pairs of 10 elements of a vector to a certain value. How can I do that without manually writing out an assignment for each 10th element? X_mean <- 4.5; X <- matrix(1, nrow=40, ncol=2); X[1:10,2] <- 0 - X_mean; X[11:20,2] <- 3 - X_mean; X[21:30,2] <- 5 - X_mean; X[31:40,2] <- 10 - X_mean;
After you create your matrix `X` and vector `X_mean`, you could do: X[,2] <- rep(c(0,3,5, 10) - X_mean, each = 10)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "r" }
How to highlight each line using ACE Editor in Angular TypeScript? I use ACE Editor in my Angular5 project. As you can see I want to validate allow and deny email in the editor. I want to highlight each line that is duplicated. ACE Editor can be highlighted each line like that? Please see this picture
Use the **addMarker** to add highlight to the lines you want to show a highlight. Range = ace.require('ace/range').Range; editor.session.addMarker( new Range(from, start_pos, to, end_pos), "show-highlight", "fullLine"); Here start_pos and end_pos are the lines you would like to highlight. Add CSS to the class "show-highlight" .show-highlight { position:absolute; background: yellow; //Specify the color you would like to use }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "angular5, ace editor" }
Excel Power Query; How to merge values and pivot the questions I have a user who has done a survey twice. I would like to have a new table where instead of one user value per question the user is represented twice in the first column, and the other columns are the questions with the answers filled out on to the user lines. I am just not succeeding. What should I exactly do? !
Assuming question text remains constant try the following and feedback on any problems. I have used the example from your screen shot link. ![Data layout]( New query > from table > ![Data from table]( Then pivot question column using answer column as values as ensure aggregation method is max. ![Pivot answer]( Check if output is as expected (duplicates are removed) ![Result](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "excel, pivot, pivot table" }
What is the difference between gravity="center" and textAlignment="center" and centralHorizontal="true" I have a question about Layout Arrangement in Android. Seems to me `gravity="center"` and `textAlignment="center"` do the same thing? How about `centralHorizontal="true"` ?
For practicality purposes, textAlignment and gravity are equivalent, except that textAlignment is a member of the View Class and the gravity is a member of TextView class. layout_centerHorizontal defines how a view should be placed in relation to it's parent view, while the former two deal with how the view should lay out it's subviews.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "android, layout" }
Language of ambiguous words Consider an ambiguous context-free grammar $G$. Define $A(G)$ the set of ambiguous words, meaning: $$A(G) = \\{u\in L(G) \mid u \text{ has at least two derivation trees for }G\\}$$ Can we say something about $A(G)$ in the general case? In particular, is $A(G)$ a context-free language?
The standard example that context-free languages are not closed under intersection can also be used as a counter-example for the language of ambiguous words. Construct unambiguous grammars for $\\{ a^n b^n c^m \mid m,n\ge 1\\}$ and $\\{ a^m b^n c^n \mid m,n\ge 1\\}$. Take the union of these grammars in the common way. The union language is of course context-free, but the ambiguous strings are in the intersection, which is not context-free.
stackexchange-cs
{ "answer_score": 8, "question_score": 6, "tags": "formal languages, context free, ambiguity" }
How to calculate it? :$|V_p|(1∠0^\circ-1∠-120^\circ)=\sqrt{3}|V_p|∠30^\circ$ I saw this math formula in the circuit system. It said $$|V_p|(1∠0^\circ-1∠-120^\circ)=\sqrt{3}|V_p|∠30^\circ$$ Does anyone know how to calculate $|V_p|(1∠0^\circ-1∠-120^\circ)$ to $\sqrt{3}|V_p|∠30^\circ$ ? Example of the notation: $$6∠60^\circ=(6 \cos 60^\circ)+j(6 \sin 60^\circ)$$
Simply add them $$1\angle0°=1\cos0°+j1\sin0°=1+j0$$ $$1\angle-120°=1\cos-120°+j1\sin-120°=-\frac12-j\frac{\sqrt3}2$$ $$1\angle0-1\angle-120°=\frac32+j\frac{\sqrt3}2$$ If we isolated the $\sqrt3$, we have $$\sqrt3\left(\frac{\sqrt3}2+j\frac12\right)=\sqrt3\left(\cos30°+j\sin30°\right)=\sqrt3\angle30°$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "calculus, polar coordinates" }
C# populating a column chart with data from an array I'm trying to build a column chart that takes it's data from an array of numbers. Essentially, I have several groups of objects that have a property called Cost. The chart needs to be able to display the spread of the costs of these objects. Since all of the costs are integer based I figured I could place the counts of each cost in an array starting from the lowest cost and going to the highest. I have tried assigning the chart's Data source to my array but it doesn't show anything other than the little marker that says Series 1. Please help. EDIT: I have really only tried `CostChart.DataSource = values //values is the array that has the counts`
int[] arr = new int[]{ 10, 1,2,3,4,5}; Array.Sort(arr); chart1.Series[0].Points.DataBindY(arr); EDIT: You can add this code to change the labels on your X-axis(labels below) to your desired label instead of its default numbering labels. chart1.ChartAreas[0].AxisX.CustomLabels.Add(0.5, 1.5, "test"); chart1.ChartAreas[0].AxisX.CustomLabels.Add(1.5, 2.5, "test2");
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "c#, arrays, charts" }
How can I setup a dual SSH tunnel so that two machines A and B behind firewalls ssh into a central sever such that A can VNC into B? I need to connect via VNC from my machine A to another machine belonging to my friend B. Both of us have no way to open incoming ports - ISPs do not allow tunneling unless you buy a static IP based business plan. Both are linux systems BTW We have a web server with full access, where we can both ssh into. How do we setup a tunnel from either end to teh server so that VNC works? I know how to setup an ssh tunnel between two systems and I believe its not hard to do A->B->C by running ssh first on A to B and then on B to C But I need A->C and B->C rather than A->B and B->C Basically I think I need a proxy server - can this be done with SSH or even some sort of linux networking magic?
Let's say C is the webserver that you both (A: You & B: Your friend) have access to. ### Setup for C: Add gatewayports yes to the config vim /etc/ssh/sshd_config add "GatewayPorts yes" at the bottom so the remote host will listen on the 0.0.0.0 interface instead of the 127.0.0.1 interface GatewayPorts yes ### Setup for B: Forward localhost's "port2" to remote host's (C) "port1" ssh -i auth.pem -R 0.0.0.0:port1:localhost:port2 [email protected] ### Setup for A: No need for forwarding. You can now connect to C's port2 using VNC while actually viewing B's screen.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "ssh, firewall, proxy, vnc, tunneling" }
C++ Compilation error with std::cout and doublification macro I'm compiling the following in MSVC 2012 #define DOUB (i) ((i)+(i)) int _tmain(int argc, _TCHAR* argv[]) { for (int i(0); i <= 10; i++) std::cout << "twice" << i << "is" << DOUB(i) << '\n'; // 22 system("PAUSE"); return 0; } and getting the following error for line 22 : **error C2064: term does not evaluate to a function taking 1 arguments** Can anyone help?
Preprocessor macro definitions care about whitespace: Don't leave a whitespace between the macro name and the parentheses for function-like macros: #define DOUB(i) ((i)+(i)) // ^^^^^^^
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c++, macros, c preprocessor" }
Uint8_to Char array Arduino sketch I am using this sh1 function. Instead of printing the hash value I want to store it in a char array or string for further processing. #include "sha1.h" #include <stdlib.h> void setup(){ Serial.begin(9600); } void loop() { uint8_t *hash; Sha1.init(); Sha1.print("This is a message to hash"); hash = Sha1.result(); for (int j=0;j<20;j++) Serial.print("0123456789abcdef"[hash>>4]); Serial.print("0123456789abcdef"[hash&0xf]); } Serial.println(); delay(1000); }
char digitArray[]= {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; char buffer[40]; for (int i = 0; i<40; i+=2){ buffer[i] = digitArray[(hash[i/2] & 0xF0) >> 4]; buffer[i+1] = digitArray[(hash[i/2] & 0x0F)]; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "arduino, arrays" }
How to turn a list of names to initials I have a list of names that I need to turn to initials only, so for example ['Surname, Name'] would be NS. This is what I have done so far: list_names = [['Johnson, Sarah'],['Hill, Becky'],['Smith, John']] for name in list_names: for name_string in name: split = name_string.split(", ") join = " ".join(split) initials = "" for n in split: initials += n[0].upper() print(initials) I think it's one of the last steps where I'm going wrong, any help is much appreciated Edit: I have fixed the typo now, the names were originally in numpy.ndarray which I then turned into the list called list_names
For splitting i have used .split(", ") comma plus space as is it included in the input list. list_names = [['Johnson, Sarah'],['Hill, Becky'],['Smith, John']] for name in list_names: surname,name=name[0].split(', ') initials=name[0]+surname[0] initials=initials.upper() print(initials) I think you want output in this way: SJ BH JS
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "python, list, names" }
Second order ODE - why the extra X for the solution? Assuming I have the following homogeneous ODE equation: $$a\cdot y'' + b\cdot y' + c \cdot y = 0$$ Why for $(b^2 - 4\cdot a\cdot c=0) \quad $,(meaning, when $m_1=m_2$) then the solution is: $$y = C_1\cdot e^{m_{1}x} + C_2\cdot x \cdot e^{m_{2}x}$$ Why isn't it simply: $$y = C_1\cdot e^{m_{1}x} + C_2 \cdot e^{m_{2}x}$$ ? Also, why did they choose to multiply $C_2$ with $x$? Why not having a totally different approach for the solution when $(m1=m2)$ (e.g. diving the equation with $x$)?
second order differential equation needs two independent solutions so that it can satisfy the two initial conditions like $y(a) = \alpha, y^\prime(a) = \beta.$ when the indicial equation has a repeating root, which happens when $b^2 = 4ac,$ you only get one solution $e^{rx}$ you find the other solution by pretending the repeating root is really two roots $r -\epsilon$ and $r + \epsilon$ coming together to be $r, r$ so that $${e^{(r+\epsilon)x} - e^{(r-\epsilon)x} \over 2 \epsilon }= {e^{rx} (e^{\epsilon x} - e^{-\epsilon x}) \over 2 \epsilon} ={e^{rx}[1 + \epsilon x + \cdots -(1 - \epsilon x + \cdots)] \over 2 \epsilon} = xe^{rx} \mbox{ as } \epsilon \to 0$$ is also a solution. we have also used the fact that the linear combinations of the two solutions $e^{(r+\epsilon)x}, e^{(r-\epsilon)x}$ is again a solution. so we have now two solutions $e^{rx}$ and $xe^{rx}$ when the indicial $am^2 + bm + c = 0$ has a repeating root.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "ordinary differential equations" }
Why doesn't this program segfault? What causes the output "Hello" when I enable -O for gcc ? Shouldn't it still segfault (according to this wiki) ? % cat segv.c #include <stdio.h> int main() { char * s = "Hello"; s[0] = 'Y'; puts(s); return 0; } % gcc segv.c && ./a.out zsh: segmentation fault ./a.out % gcc -O segv.c && ./a.out Hello
It's **undefined behavior** (might crash, **might not do anything** , etc) to change string literals. Well explained in a C FAQ. > 6.4.5/6 > > It is unspecied whether these arrays are distinct provided their elements have the appropriate values. If the program attempts to modify such an array,the behavior is undened.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 2, "tags": "c, pointers, gcc, segmentation fault" }
pandas: concat data frame with different column name Suppose I have this data frame id x y 0 a hello 0 b test 1 c hi 2 a hi 3 d bar I want to concat x and y into a single column like this keeping their ids id x 0 a 0 b 1 c 2 a 3 d 0 hello 0 test 1 hi 2 hi 3 bar And how if I want to give a new name for the concat column? (e.g. 'x' to 'xy')
I don't think `pandas.concat` includes the option to set new `column` names (see docs), but you could assign like so: Starting from: id x y 0 0 a hello 1 0 b test 2 1 c hi 3 2 a hi 4 3 d bar df.set_index('id', inplace=True) pd.DataFrame(pd.concat([df.x, df.y]), columns=['xy']).reset_index() id xy 0 0 a 1 0 b 2 1 c 3 2 a 4 3 d 5 0 hello 6 0 test 7 1 hi 8 2 hi 9 3 bar
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, pandas" }
instant insert/edit I've seen multiple websites on the web where they allow you to manipulate data. (i.e. Insert records, delete records, edit records). The cool thing I've noticed is that when you click remove button, the item removes instantly from the grid. and then it asynchronously goes to a database and removes record from there without bothering a user. For example in a regular asp.net application if you're using gridview you need to wait until database operation is complete, because gridview is a databound control. If you use update panel you still see item in grid until DataBind event fires again. Question: is there any js/.net library that will allow me to add such a functionality to the project out of the box?
Maybe you want to use `WebMethod` on server side + `Ajax` calls on client side (using `jQuery` for example).
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, javascript, asp.net, html, sql" }
3 girls and 3 boys are being arranged in a line such that girls and boys alternate. What is the number of arrangements possible So the way I am trying to solve this is as follows: * Allow the girls to be arranged first : $3!$ * There are 4 spaces that are created for the three boys : $4P3$ (since the order is important $4C3 \times 3!$, which is $4P3$) Therefore total possibilities $=3! \times 4P3 = 144$ Now the answer to the problem is $72$, which is half of my answer. What am I double counting?
If you use your method, than these lines are also accepted too: $$-G-G-G-\Rightarrow BG-GBGB;BGBG-GB$$ For each of the two lines above, there are $3!$ ways to rearrange boys and $3!$ ways to rearrange girls, so you have include $2\times 3!\times 3!=72$ incorrect cases ("$-$" in the line above stands for "empty"). Girls and boys are counted seperately. For each case (girls first and boys first are two distinct cases), the number of ways to rearrange girls is $3!$, the number of ways to rearrange boys is also $3!$. So the answer should be $3!\times\ 3!\times 2=72$.
stackexchange-math
{ "answer_score": 4, "question_score": 0, "tags": "combinatorics, permutations" }
Finding a set in Borel sigma algebra given a set in Lebesgue measurable space This is an exercise question in my Lebesgue Integration course. I feel like I should make use of collection of closed sets but I have no idea where to start. Here is the question: Let $E\in M$ be such that $\mu(E)$ = $0$. Show that there is a $B$ in the Borel $\sigma$-algebra of $\mathbb{R}$ such that $E\subset B$ and $\mu(B) = 0$. Here $(\mathbb{R}, M, \mu)$ is Lebesgue measurable space. Any help would be appreciated.
Since $E$ is measurable, we know that $0 = \mu(E) = \mu^* (E) = \inf m^*(U)$ where $U$ is an open set containing $E$. Thus, for any $\epsilon > 0$ we can find an open $U \supset E$ such that $\mu(U) < \epsilon$. Thus, for any $n \in \mathbb{N}$, there is an open $O_n \subset \mathbb{R}$ such that $E \subset O_n$ and $\mu (O_n) < \frac{1}{n}$. Now take the following set: $$O = \bigcap_{n=1}^\infty O_n$$ $O$ is a $G_\delta$ set, and hence is a Borel set. Additionally, $O$ contains $E$ and has measure $0$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "measure theory, lebesgue measure" }
what is this.element in a jquery function? I was reading an excellent explanation of the jQuery UI combobox by Jörn Zaefferer (here's the link). The fourth line of code reads `var select = this.element.hide()` Jörn says: > The var select references the select element on which the combobox gets applied. To replace the select with the text input, the select is hidden. I am learning jQuery now, and I don't recall seeing **this.element** before. How is it different that just **this**?
Inside a widget, "this" refers to the widget object itself, which contains a property "element". That "element" points to html element for which that widget has been applied.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 13, "tags": "jquery" }
Finding the inverse of $f(x,y) = \left(\frac{x}{y}, x + y\right)$ I have the function $$ f(x,y) = \left(\frac{x}{y}, x + y\right) $$ and I want to find its inverse, $f^{-1}$. I don't know how to proceed since 1) it can't be expressed as a linear function $$ \begin{bmatrix}f_1 \\\ f_2\end{bmatrix} = \begin{bmatrix} ? & ? \\\ 1 & 1 \end{bmatrix} \begin{bmatrix} x \\\ y \end{bmatrix} $$ 2) I can't find a way to express $x$ or $y$ strictly in terms of $a$ and $b$ $$ \begin{split} a &= \frac{x}{y}\\\ b &= x + y \end{split} \hspace{2em} \Rightarrow \hspace{2em} \begin{split} x &= ay\\\ y &= b - x \end{split} $$ Help!
You are almost done. Just substitute your $x=ay$ into $y=b-x$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "multivariable calculus, inverse function" }
Date issue in Firefox I want to parse date in my page to Javascript's `Date`. So I have this in my page <span>01-07-2012 01:04 PM</span> And I have Javascript code that parses this value to date var tagText = $(this).html(); var givenDate = new Date(tagText); alert(givenDate); And here is what I get in different browsers **IE:** > Sat Jan 7 13:04:00 UTC+0400 2012 **Chrome:** > Sat Jan 07 2012 13:04:00 GMT +0400 (Caucasus Standard Time) **Firefox:** > Invalid Date Why Firefox doesn't recognize my date? What I must change to make it work with all major browsers? Here is jsfiddle <
try this: var tagText = $(this).html(); tagText = tagText.replace(/-/g, '/'); var givenDate = new Date(tagText); alert(givenDate);
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "javascript, firefox, cross browser" }
How to call a function from a header file How do you call a function from a source file from a header file? //h.h extern string pic; class takePic { public: void warPic(); void artPic(); void fatePic(); void painPic(); void noPic(); }; // second part of the same header where it calls the function takePic picture; void pictureType() { if (pic == "war") { picture.warPic(); } else if (pic == "fate") { picture.fatePic(); } else if (pic == "pain") { picture.painPic(); } else if (pic == "art") { picture.artPic(); } else { picture.noPic(); } } When I do this it says that the linker is not working. This is the error linker command failed with exit code 1.
What happens if you change void pictureType() to inline void pictureType() You should really tell us the whole error message, and perhaps try searching for that before asking a question.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -3, "tags": "c++, function, header" }
How do I make the Exoplayer controls always visible? A few seconds after the ExoPlayer starts playing, the controls stop showing and a black background appears. How do I make sure that the controls are always visible?
Set `show_timeout` attribute to 0
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 16, "tags": "android, exoplayer" }
How to proceed with evaluating $\int\frac{dx}{\sqrt{9+4x^2}}$ and $\int\tan^2(3x)dx$ 1. $\displaystyle\int\frac{dx}{\sqrt{9+4x^2}}$ 2. $\displaystyle\int\tan^2(3x)dx$ * * * For the first one i'm not sure if I did it correctly, here is what I did: Let $2x=3\tan(t)$, so $x=\frac{3}{2}\tan(t)$ and $dx=\frac{3}{2}\sec^2(t)dt$. So by substitution, $$\begin{align}\displaystyle\int\frac{dx}{\sqrt{9+4x^2}}&=\int\frac{\frac{3}{2}\sec^2(t)}{3\sec(t)}dt\\\ &=\frac{1}{2}\int\sec(t)dt\\\ &=\frac{1}{2}\left(\ln|\sec(t)+\tan(t)| + C\right)\\\ &=\frac{1}{2}\left(\ln\bigg|\frac{\sqrt{9+4x^2}}{3}+\frac{2x}{3}\bigg|+C\right)\\\ \end{align}$$ For the second one, i'm unable to proceed, what I did was $\displaystyle\int\tan^2(3x)dx=\int\frac{\sin^2(3x)}{\cos^2(3x)}dx=\int\frac{\frac{1}{2}(1-\cos(6x)}{\frac{1}{2}(1+\cos(6x)}dx=\int\frac{(1-\cos(6x)}{(1+\cos(6x)}dx$ is this the right way to proceed? Thanks
Put $3x=u $ to get $$\frac{1}{3}\int\tan^{2}\left(u\right)du=\frac{1}{3}\int\left(\sec^{2}\left(u\right)-1\right)du=\frac{1}{3}\tan\left(u\right)-\frac{u}{3}+C=\frac{1}{3}\tan\left(3x\right)-x+C. $$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "calculus, integration" }
Error You have an error in your SQL syntax When I do the following request I get the message : **(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '>= DATEADD(MONTH, -3, GETDATE())' at line 1").** The request is : 'SELECT creationdate ' \ 'FROM panel' \ 'WHERE creationdate >= DATEADD(MONTH, -3, GETDATE())' \ This request works when I remove the WHERE line, however when I replace it (as a test) by 'LIMIT 10' , I get the same error... What I would want to get the last 3 months of records. Some help would be welcome please, thank you.
You're missing a space after `panel`, so MySQL sees `"FROM panelWHERE"`, which certainly is a syntax error: >>> 'SELECT creationdate ' \ ... 'FROM panel' \ ... 'WHERE creationdate >= DATEADD(MONTH, -3, GETDATE())' 'SELECT creationdate FROM panelWHERE creationdate >= DATEADD(MONTH, -3, GETDATE())' # ^ There! Turn 'FROM panel' \ to 'FROM panel ' \ (like you had done with `'SELECT creationdate '` already).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "python, sql" }
Move object using coordinates from other objects Is it possible to move an object using coordinates from other objects? Example (see screenshot): Is it easily possible to move the blue cube in x-direction using the distance from the upper right corner of the green cube and the upper right corner of the right cube? I currently measure the distance with snapping and add the number manually to the x-position of the blue cube in the location panel. ![Screenshot showing the problem](
you might want to have a look at this addon. It lets you do all kinds of things that are usually very simple in more CAD based platforms <
stackexchange-blender
{ "answer_score": 1, "question_score": 1, "tags": "transforms" }
how to change the first value of a select or placeholder? I have a select here: <select name="" id=""> <option disabled hidden selected value=""> default </option> <option value="2">2</option> <option value="3">3</option> <option value="3">3</option> </select> I am trying to make the placeholder or the first value a different color so it looks like a placeholder. I have tried doing things like: select option:disabled { color: red; } select :invalid { color: red; } select option:first-child { color: red; } select { color: grey; } option:first-child { color: red;} None of these have worked so I'm kind of stuck. I don't really want to have to use a trick like making the color transparent and putting a label on top of the select.
To cite this answer, you can't actually style it as it's rendered by the OS. **But** fortunately, in your case, you can add the attribute `disabled` to the placeholder value: it will appear greyed out in the list and won't be selectable which will prevent your users to send the form with the placeholder value without any validation! You can see it in action in this fiddle to test it out (and also see that a bunch of rules are applied to the `option` element but none of them works).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "html, css" }
run a process from script and kill it from another script using PID I want to run a process from script and kill it from another script using PID. I can think of two things to do but I think you can help me get more effective way of doing this. The first one is to store the PID in temp file and read it from the other script. The other way is to save it as environment variable from the first script and use it by the other script. I am very sure there is nicer way of doing this. I used killall and pkill to kill the process by the process name. However, this did not work good. I want to kill it using PID.
I would suggest using the first method you talked about. Creating a temp .pid file with the information on the process is a very common way to track the PID of a running process. It is easy to do in most languages and pretty straightforward. The second could create an issue because depending on what shell you use, that environment variable may be difficult to ensure that it is global and not touched.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "bash, shell, kill, pid" }
How to return rows where there are consecutive values in different rows I have a data-frame in pandas, where 1 appears in different columns (quarters) for every IDs (example given below). The sequence with which 1 appears is different for different IDs. I need to find out how many IDs have, lets say, 1 appeared consecutively in four columns. Example data-frame: IDs q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 1111 0 0 1 1 1 1 0 0 0 0 0 0 1122 0 0 1 0 0 1 0 0 0 0 0 0 1122 0 0 0 0 0 0 0 1 1 1 1 0 The result should be 2. It would be helpful if anyone can provide the code useful in pandas. Thanks in advance.
Here is fun way using `join` and `contains` s=df.set_index('IDs').astype(str).agg(''.join,1).str.contains('1111') s[s].index.nunique() 2
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "python, pandas" }
Use \raisebox with \depth in caption I want to use `\raisebox` in a `caption`. I know that `\protect` is often needed in these situation, but this (and other combinations I have tried) does not work: \documentclass{article} \begin{document} \begin{figure} \caption{\protect\raisebox{\protect\depth}{X}} \end{figure} \end{document} gives ! Missing number, treated as zero. <to be read again> \protect l.4 ...ption{\protect\raisebox{\protect\depth}{X}} While \documentclass{article} \begin{document} \begin{figure} \caption{\protect\raisebox{\depth}{X}} \end{figure} \end{document} gives ! Undefined control sequence. <argument> ...respaces \protect \raisebox {\depth
`\protect` does not help here, because it is `\relax`, when the caption is set in the figure. Also `\depth` is defined locally by `\raisebox`. That allow a trick, if `\depth` is _not_ used otherwise. Instead of an undefined command, `\depth` can be made robust: \let\depth\relax File: \documentclass{article} \let\depth\relax \begin{document} \listoffigures \begin{figure} \caption{\protect\raisebox{\depth}{g}} \end{figure} \end{document} A different way is the definition of a robust macro, with includes the argument: \documentclass{article} \DeclareRobustCommand*{\RaiseBoxByDepth}{% \raisebox{\depth}% } \begin{document} \listoffigures \begin{figure} \caption{\RaiseBoxByDepth{g}} \end{figure} \end{document} > !Result
stackexchange-tex
{ "answer_score": 6, "question_score": 6, "tags": "captions, boxes, robust commands" }
Why does this Qt header file fail to get parsed by moc? I created a new 'C++ library' project in Qt, which has the following header file: #include "Test_global.h" #include <QString> #include <QTcpServer> class TESTSHARED_EXPORT Test : QTcpServer { Q_OJECT public: Test(); ~Test(); signals: void NewMessage(QString); }; (The implementation file is basically empty.) When I try to build the object, I get errors: Test.h:8: error: ISO C++ forbids declaration of ‘Q_OJECT’ with no type Test.h:10: error: expected ‘;’ before ‘public’ Test.cpp:3: error: definition of implicitly-declared 'Test::Test()' So it looks like `moc` isn't processing the file at all. What have I done wrong?
It should be `Q_OBJECT`, not `Q_OJECT`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": -2, "tags": "qt, qt creator, qmake, moc" }
problems with implenting OpenID with Google Apps Domain I am using lightopenID and am still using the example-google.php file included. I have edited the $openid->identity to $openid->identity = ' and everything works fine. When i click the Login With Google button, i get directed to the Google apps domain. I sign in and it ok...but when it redirects back to my localhost where i am testing the script, i get the following error message: No OpenID Server found at [my-google-app-domain] Can anybody explain what is going on here? Thanks
You have to add a few files to your server, and a few lines to your .htaccess file, like this: < Not necessary for regular Google Accounts, only when you want to force them into Google Apps on a specific domain. As for "what is going on here?": I have no idea ?:/
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "openid" }