INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How to show infowindow when clicking the polyine I'm creating a project for my internship, and I have some planes moving on a polyline in google maps as shown here. First I tried to research for a click event when clicking the path symbol but I couldn't find anything because I need a marker. So then I tough when clicking on the polyline, but I can't find anything that works properly and I have almost no experience and that's why I am asking for help. I have 4 of these and I need an event for each one because the infowindows will be different, I guess... var GRU = new google.maps.Polyline({ path: [{lat: 38.771183, lng: -9.131135}, {lat: -23.6276104, lng: -46.6568016}], //Lis - GRU strokeOpacity: 0.1, icons: [{ icon: planeSymbol, offset: '0' }], map: map }); I will appreciate a lot any help you can give to me.
You can add event listener with `addListener`: var handlePolyClick = function(eventArgs, polyLine) { // here you can handle the poly alert('clicked on ' + polyLine.sometitle); }; google.maps.event.addListener(GRU, 'click', function(e) { handlePolyClick(e, this); }); Working fiddle is here. P.S. you can find click's coordinates in `e.latLng` property of an event. Example with infowindow here.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, google maps, google polyline" }
Django get count of related objects with value and add it to an annotation If I want to annotate the number of related objects to each parent object, I would do this: Agent.objects.annotate(deal_count=Count('deal')) If my `Deal` objects have a `closed` boolean, how would I annotate the number of deals marked as closed?
You can work with the [**`filter=…`** parameter [Django-doc]]( from django.db.models import Q Agent.objects.annotate(deal_count=Count('deal', **filter=Q(deal__closed=True)** )) or if you want to annotate with both counts: from django.db.models import Q Agent.objects.annotate( deal_count=Count('deal'), closed_deal_count=Count('deal', **filter=Q(deal__closed=True)** ) )
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "django, django models, django queryset" }
Subversion Pre-Commit Check In a config file for a PHP project, I have some settings that should not go out in production. Can anybody offer some specific examples or help on how to automatically check these fields and make sure their values are not the development/demo settings before the files get committed into subversion? Our IDE is JetBrains PHP Storm, and we use the latest version of subversion. Some of us develop on Linux, while others are on Windows.
**This shouldn't be handled by SubVersion but by build script**. This script should modify or replace development settings into production one during the release process (if automated).
stackexchange-softwareengineering
{ "answer_score": 7, "question_score": 1, "tags": "svn" }
How can I remove chrome opening by default from Flutter? How can I remove chrome opening by default from Flutter? Chrome is opening by default and I have Android Emulator installed
If you use a command line just use **-d** key like: `$flutter run -d $device_id` to determine the device id run `$flutter devices` command. if you use an IDE just select a target device in the IDE's UI.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "flutter, dart" }
Proving $\forall f\in \mathscr F\exists g\in \mathscr F $ so that $g(f(1)) = 2$. Let $\mathscr F$ denote the set of all functions from $\\{1,2,3\\}$ to $\\{1,2,3\\}$. Prove or disprove. (a) $\forall f\in \mathscr F\exists g\in \mathscr F $ so that $g(f(1)) = 2$. (b) $\forall f\in \mathscr F\exists g\in \mathscr F $ so that $f(g(1)) = 2$. (c) Let $f\in \mathscr F$ be define by: $f(1)=2,f(2)=3,f(3)=2$. Find the number of functions $g\in \mathscr F $so that $f(g(f(1))) = 2$.
$(a)$ is true. Just take $g:x\mapsto 2$. $(b)$ is false. If you take $f:x\mapsto 1$, no matter what $g$ is, the image of an element by $f\circ g$ will be $1$. $(c)$ $f(g(f(1)))=2$ $f(g(2))=2$ Since we want $f(g(2))=2$, we have $g(2)=1$ or $g(2)=3$. Then for $g(1)$ and $g(3)$, we can chose any one of the three numbers so you get $2 \times 3 \times 3 = 18$ functions.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "combinatorics, functions, proof writing" }
Replace elements of array with their average Let's say I have a numpy array as such: a = [0, 1, …, i-1, i, i+1, …, j, j+1, …, n] and I'd like to replace of i-th, i+1-th… j-th element with a single one — their average: b = [0, 1, …, i-1, average, j+1, …, n] How would I do that with as compact code as possible?
Slice and concatenate arrays np.concatenate([a[:i], a[i:j].mean().reshape(1,), a[j:]]) Example a = np.array(list(range(20))) i = 5 j = 10 np.concatenate([a[:i], a[i:j].mean().reshape(1,), a[j:]]) array([ 0., 1., 2., 3., 4., 7., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19.])
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "python 3.x, numpy ndarray" }
Update and convert value of a column at the same time without using code server I have a table with following columns: id | title | date 1 | Title A | 15-06-2013 2 | Title B | 25-06-2013 3 | Title C | 05-07-2013 4 | Title D | 19-09-2013 Now I need to change `date` column to Unix `timestamp` so it can be something like this: id | title | date 1 | Title A | 1756346212 2 | Title B | 1883216212 3 | Title C | 1227346212 4 | Title D | 1956436212 Can I use a SQL statement to process the `update` and convert at the same time without using code server? As code server i just need to do this: select each row => covert `date` to unix time stamp => update will be something like that with a SQL statement?
If date is a varchar column, and you want to convert it to unix timestamp, I would do it this way: ALTER TABLE yourtable ADD COLUMN unixdate int; UPDATE yourtable SET unixdate = UNIX_TIMESTAMP(STR_TO_DATE(date, '%d-%m-%Y')); ALTER TABLE yourtable DROP COLUMN date; Please see fiddle here. Or if you just need a SELECT, you could use this: SELECT id, title, UNIX_TIMESTAMP(STR_TO_DATE(`date`, '%d-%m-%Y')) `date` FROM yourtable
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql" }
Android: Access function of an external package I am trying to figure out how access a function in an external program. I currently have this: ComponentName cn1 = new ComponentName("com.htc.android.worldclock", "com.htc.android.worldclock.WorldClockTabControl"); Which will launch the HTC world clock. I would like it, instead of launching the main program, launch the night mode function of the app or full screen clock function of the app. Is it possible? The picture below shows the ui button that launches the function I would like to launch programmatically !enter image description herey.
If HTC world clock program would launch night mode activity when receive other intent or this intent with extra parameter, it is possible. But as you don't know the implement of HTC world clock, so I think it is hard and impossible.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, android intent, package, clock" }
Facebook C# SDK, facebook app on fanpage redirects out of tab after login I am working with the Facebook c# SDK (5.x). I have an app that runs on the fanpage in a tab. so far so good. when I ask for permissions, and i allow them, the user gets redirected to the app, but outside of the fanpage or tab. Is there a way to stay inside the fanpage tab ?
What I did to solve this was to set the CancelUrlPath (in case user dont allow permission) and ReturnUrlPath(in case he does) to the page url/page and application url. Both attributes from CanvasAuthorizer object. var auth = new CanvasAuthorizer(); auth.CancelUrlPath = "PAGEURL"; auth.ReturnUrlPath = "PAGEURL with active TAB"; auth.Authorize(); I guess this the solution for now, since c# sdk dont have a nice support for tab applications. Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "redirect, permissions, facebook c# sdk, facebook page" }
How to reload page after script on Javascript? I'm a newbee in javascript and i need to refresh page when script is done: <script type="text/javascript"> function validateForm() { var x = document.forms["myForm"]["Hostname"].value; if (x == "" || x == null) { alert("Name must be filled out"); return document.location.reload(true); } } </script> But i don't understand how to make it work.
<script type="text/javascript"> function validateForm() { var x = document.forms["myForm"]["Hostname"].value; if (x == "" || x == null) { alert("Please specify a FQDN of your host"); window.location.reload(true); return false; </script> This one works fine. Thanks to all
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html" }
Why do I get this message whenever I open a terminal? I keep getting this strange message when I open a terminal: me@batcuter:~$ Message from syslogd@batcuter at Apr 21 14:10:38 ... such IMContext Message from syslogd@batcuter at Apr 21 14:10:38 ... such IMContext Message from syslogd@batcuter at Apr 21 14:10:43 ... invalid char is given at scim_bridge_string_to_uint (): - Message from syslogd@batcuter at Apr 21 14:10:43 ... valid message: Close the connection. I have no idea what's happening... 1. Where can I read these logs? 2. Should I be afraid of a malicious cyberattack?
There appears to be a bug in SCIM, I have read that you can "disable SCIM by switching execution permission of script /etc/profile.d/scim.(c)sh" - this is probably distribution-specific. The reason that the messages appear on your terminal can be found by inspecting /etc/syslogd.conf. That file also controls which log files the messages are also written to. It is a software fault, not a malicious cyberattack.
stackexchange-unix
{ "answer_score": 1, "question_score": 2, "tags": "logs" }
Outlook auto-archive will the folder structure in my inbox be kept when I do an auto-archive of my inbox or will all emails be moved to one folder? If not how is it possible to achieve this? Thanks in advance,
Outlook AutoArchive retains your folder structure intact in the Archive PST file.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "microsoft outlook 2010, outlook addin, autoarchive" }
For loop to search for occurrence of characters using parameters start & end I'm having trouble setting up a for-loop to search for the occurrences of characters a-z, A-Z, and 0-9 within a string called text. This string is from an input file. My for-loop is set up as: for (char ch = start; ch <= end; ch++) { body } The assignment is I have to create a method named `public static void countChars(String text, char start, char end)` and within this method I have to use a for-loop to search for occurrences of three things: a-z, A-Z, and 0-9. If match is found I have to increment the counter. Then in main I have to invoke the method by calling `countChars(text, 'a', 'z')`, `countChars(text, 'A', 'Z')`, and `countChars(text, '0', '9')`; However, I don't know how to set it up to search for the 3 different types of characters listed above. Any help is greatly appreciated, thanks!
public static void main(){ String text = "your text" count1=countChars(text,'a','z'); count2=countChars(text,'A','Z'); count3=countChars(text,'0','9'); } public static int countChars(String text, char start, char end){ int count=0; for(char ch : text.toCharArray()){ if (ch>=start && ch<=end) count++; } return count; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, for loop" }
Second group homotopy CW complex relative 1-skeleton Let X be a connected complex CW and $X^1$ his 1-skeleton. I want to show that: $$ \pi_2(X,X^1) \cong \pi_2(X) \times \text{ker}(i_*)$$ where $i_*:\pi_1(X^1) \rightarrow \pi_1(X)$ is the induced inclusion function. I think it would be useful to use the exact homotopy sequence, any ideas? Is problem 4.2.11 Hatcher, Algebraic Topology.
As $X^1$ is a connected graph, you know $\widetilde{X^1}$ is a tree which is contractible. Thus $\pi_2(X^1)=\pi_2(\widetilde{X^1})=0$, and the long exact sequence that you mention restricts to a short exact sequence of groups: $$1\to \pi_2(X)\to\pi_2(X,X^1)\to \ker(i_*)\to 1$$ Again as $X^1$ is a graph we have that $\pi_1(X^1)$ is a free group, so ker$(i_*)$ is a subgroup of a free group, hence itself free. Any short exact sequence of groups, where the third term is a free group, will split. Thus the above short exact sequence splits. It remains to show that $\pi_2(X)$ is central in $\pi_2(X,X^1)$. Let $\alpha\in \pi_2(X)$ and $\beta\in\pi_2(X,X^1)$. We show $\beta\alpha\beta^{-1}=\alpha$ diagramatically: ![enter image description here](
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "algebraic topology, homotopy theory, cw complexes" }
How to access a global variable from a WebMethod? I have the following global variable: private ArrayList listSelectedUnavailables { get { return (ArrayList)ViewState["listSelectedUnavailables"]; } set { ViewState["listSelectedUnavailables"] = value; } } I can work with it in every single procedure of the webform. However, I need to use it in a WebMethod that I have in the same WebForm, but it seems not to identify any of the global variables. So: How can I access a global variable from a WebMethod?
A `ViewState` property depends on having a page (.aspx) post back a view state, that's where your "variable" is stored. A `WebMethod` does not include the full page postback (if any post back at all) and so there is no view state for it to read from. Instead you may want to use a session variable like: private ArrayList listSelectedUnavailables { get { return (ArrayList)Session["listSelectedUnavailables"]; } set { Session["listSelectedUnavailables"] = value; } } The session stores the variable in the web server's memory (but related to a specific browser session). This has it's own draw-backs, such as being volatile to a worker process reset, load balancing cosiderations, etc.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, asp.net, ajax, global variables, webmethod" }
Adding sizing handles to drawn object in canvas I have a full screen canvas I am drawing to, and I've set it up to allow the user to drag and drop objects that are within the canvas. I also want to enable them to select an object, and then 'resize handlers' show up (the little circles in the corners) to allow them to click/drag and resize them. I can code this manually by drawing circles in each corner and detect a click, etc.... but was wondering if anyone has any better way to do this? Maybe there's a library out there that already handles this? Any help is appreciated!
There isn't any simpler way than doing it yourself or getting a library to do it for you. I wrote a tutorial here on the use of sizing handles. That should get you started if you plan to make your own.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": "javascript, jquery, html, canvas" }
Selenium: How to verify menu drop down text? I'd like to be able to verify the menu has all the proper dropdown menus with out clicking/selecting, just verifying the id/string of each menu item is ok, I saw from here Selenium: How to select an option from a select menu? how I can select them, but I don't want to select them. Thanks for any help.
I think you could do something like this to verify the element on the page without selecting them, you're xpath would probably vary my example is quite simplified: HTML: <body> <select> <option>One</option> <option>Two</option> <option>Three</option> <option>Four</option> </select> </body> Selenium Test Case: public class HomePageTest { public static HtmlUnitDriver driver; @Before public void setUp() throws Exception { driver = new HtmlUnitDriver(); } @Test public void initiateTest() throws Exception { driver.get(" List<WebElement> elems = driver.findElementsByXPath("//option"); for (WebElement e : elems) { System.out.println(e.getText()); } } @After public void tearDown() throws Exception { driver.close(); } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "java, xpath, selenium" }
Can I change documentclass in the middle of a document? A school I'm applying to requires me to combine my research statement and my CV into a single document. However, my research statement is in the `amsart` document class while my CV is in the `article` document class and I'm having trouble getting it to look at all nice in a single class. Is there a way to change document class part of the way through a document? Alternately is there an easy way to get LaTeX to just concatenate the output of two different files?
No, you cannot change the document class in the middle of a document. One option would be to use the pdfpages package to include your CV in your research statement.
stackexchange-tex
{ "answer_score": 13, "question_score": 12, "tags": "document classes" }
How to bind dates and other variables to php sql query? (MySql) I have several db calls in my site with bind_variables that works fine. But, I can find the correct sign for Date in the documentation, for the command: $query->bind_param("ssi",...); I don't want to do something like: $db->query('SELECT item FROM table WHERE something='.$something); Since this is string manipulation, not binding. (In binding the query is left with the "?" and that makes the queries faster because the DB sees them the same only with different cariables.) If I wasn't very clear, I want to do the same as this only with a date variable type.
Some extra information to my comment given above: > If I do understand correctly have a look at: Using Mysqli bind_param with date and time columns?. It looks like you can just treath it as a string. If you want to do it with `bind_param` it is the only way I know to do it and I don't see any problems. If mysql receives a wrong formatted date it will insert a 0000-00-00 value to your table. Can you tell me what you think could be a problem? If you insert it as a normal query you also use the same syntax as a String.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "php, sql, mysql" }
How to range-check luma in After Effects? Where do I find the luma range clip indicator that I have in Final Cut? ![enter image description here]( ![enter image description here](
You can add a new **adjustment layer** at the top of your composition, with the Levels effect set to the following: * Input Black: `254` * Input White: `255` !Levels effect This will have the result of causing any luma values that were below 254 to become **black** , while anything above it becomes **white**. Here is an example of it over a fractal noise pattern: ### Before !Before image ### After !After image
stackexchange-avp
{ "answer_score": 1, "question_score": 0, "tags": "premiere, after effects, final cut pro x, adobe, final cut pro" }
searching an array of strings in mysql i have an array of strings and i need to search whether the strings of the array exits in database or not. i am using following query: foreach($array as $s) { if(preg_match('/^(\bpho)\w+\b$/', $s)) { $query="select * from dictionary where words REGEXP '^".$s."$'"; $result=$db->query($query) or die($db->error); if($result) { $count += $result->num_rows; } } } but this query taking long time to execute. PLease provide a solution to reduce the searching time
Combine all the search strings into a single regular expression using alternation. $searches = array(); foreach ($array as $s) { if (preg_match('/^(\bpho)\w+\b$/', $s)) { $searches[] = "($s)"; } } $regexp = '^(' . implode('|', $searches) . ')$'; $query="select 1 from dictionary where words REGEXP '$regexp'"; $result=$db->query($query) or die($db->error); $count = $result->num_rows; If `$array` doesn't contain regular expressions, you don't need to use the SQL `REGEXP` operator. You can use `IN`: $searches = array(); foreach ($array as $s) { if (preg_match('/^(\bpho)\w+\b$/', $s)) { $searches[] = "'$s'"; } } $in_list = implode(',', $searches); $query="select 1 from dictionary where words IN ($in_list)"; $result=$db->query($query) or die($db->error); $count = $result->num_rows;
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, mysql, arrays" }
What determines whether the reputation amount on my profile's Reputation tab is green or white? On my User Activity page, within the Summary tab, a Reputation section is shown, listing the four most recent posts (all answers) of mine that have been voted up/down. Three of these posts have a reputation amount listed in a box with a green background. At first I thought that meant the answer was accepted. But the fourth entry (the most recent one), shows a reputation box with a white background... the problem there being that I know this answer is accepted, too. ![enter image description here]( What determines whether that box is white or green?
Almost correct. The Reputation section of the Summary tab shows **Recent** reputation activity. If you notice from the reputation amount, and your own reputation audit trail, you'll see that you specifically _gained reputation from that answer being accepted_ recently. That is what the green reputation box indicates. The Microsoft Edge answer is accepted, but wasn't accepted recently. You gained +10 reputation from an upvote on an answer that was accepted long ago. Only reputation gained recently via acceptance of one of your answers will cause that reputation box to turn green.
stackexchange-meta_stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "support, reputation, profile page" }
ldap filter work on JXeplorer, but no in php i have this filter: > (&(DomainLogin=ara*)(&((!(DomainLogin=ara_test_7))(!(DomainLogin=ara_test_8))(!(DomainLogin=ara_test_10))(!(DomainLogin=ara_test_11))))) if i use this filter on JXplorer work fine and i find the result, but if i use a php ldap_list i have this error: > Warning: ldap_list() [function.ldap-list]: Search: Bad search filter <? $f="(&(DomainLogin=ara*)(&((!(DomainLogin=ara_test_7))(!(DomainLogin=ara_test_8))(!(DomainLogin=ara_test_10))(!(DomainLogin=ara_test_11)))))"; $g=ldap_list($conn,$page->ldap_search_dn,$f,array(),false,10); print_r(ldap_get_entries($conn,$g)); ?> why?
Try this filter: `(&(DomainLogin=ara*)(&(!(DomainLogin=ara_test_7))(!(DomainLogin=ara_test_8))(!(DomainLogin=ara_test_10))(!(DomainLogin=ara_test_11))))`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, ldap" }
Elastic Search in general I'm completely new to Elastic Search or to searching in general. I tried to figure out how it is working but I'm not sure if I understood it right. Is it right, that I for example get a JSON with my data, I have to index it with elastic search and don't have to care about another database in general? I mean, I don't have to create a database by myself? I hope I could explain I am struggling with..
Yes, ElasticSearch can not only work without external database but even act as a database system itself in the sense that it may store the original JSON document that has been indexed. You can retrieve all the data you are sending to the server when the document has been found either by search query or by its ID as in normal key->value document database. The data is available in _source field. This is not necessary for indexing and searching, and can be turned off for storage space conservation, but is turned on by default.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "elasticsearch" }
How compose GraphQL query for github How to present this string as a GraphQL query curl -H "Authorization: bearer token" Help me please
You can follow "Forming Calls with GraphQL", which involves "Creating a personal access token for the command line" to get a token. Your header should then be: `Authorization: bearer xxx`, with `xxx` being the token you have generated. As a concrete example: "Get started with GitHub GraphQL API".
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "authentication, github, graphql, github api v4" }
How does Google Map API authenticate users? They put a limit on the amount of map views, geocodes etc that can be done each day but in the documentation I can't find anywhere where they actually list how it is authenticated. My guess is it has to be one of the following: * Website url * Ip address * Google account If anyone knows, that would be really useful.
In fact, there are various way Google is identifying the requests that are done, and most of the time the way it is done is related to your use case. **For general use and using the 'free' version:** You can track the usage by specifying an API key even if it's not necessary anymore. The requests are managed by URL (referer) and by IP address. **For general use but with needs to buy additionnal quota:** You need to use an API key to track the use and you might want to declare URI using the dedicated portal (called console), see: < **For Business users:** You will need to include the key inside the script reference to the control, see: < Also, here is a summary view of what should be used depending on the type of service you're using as an Enterprise customers: <
stackexchange-gis
{ "answer_score": 5, "question_score": 3, "tags": "google maps, geocoding, google maps api" }
Load ruby script into another ruby script I need to define a function in a script that is loading another script, and use it in the script being loaded. For example: main file: require 'file' def FunctionA() #define function here end file.rb: FunctionA() I cannot move the definition to the file being included. Is there any way I can do this?
For the use case presented in your question right now, just move `require 'file'` to the end. def FunctionA() #define function here end require 'file'
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ruby" }
how to convert ISO 8601 date if day goes before month? I have date '1987-24-06T00:00:00.000+06:00' where format is 'Y-d-m', when i try to strtotime('1987-24-06T00:00:00.000+06:00') //return false it return false because of day before month. If I do strtotime('1987-11-06T00:00:00.000+06:00') // return 563133600 it works fine. Is there any option to make it work?
As mentioned @El_Vanja, I used createfromFormat, so my code looks like $date = '1987-24-06T00:00:00.000+06:00'; $dt = \DateTime::createFromFormat("Y-d-m\TH:i:s.uP", $date)->format('Y-d-m H:i'); // 1988-12-06 00:00
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -3, "tags": "php, date" }
iOS app - users updating wait time I am building an iPhone app in which users (or employees) will be able to go to restaurants and update/give an estimate of the waiting time at that location. To do something like this, would it be most efficient to use an XML webpage and parse the data that is currently there and update that value with the user's input then reload the XML database? Obviously any user should be able to update the site so it needs to be done from a web-server. Also, if anyone knows of a similar example for this, that would be spectacular! Thanks for your help,
you can take a textfield in which you can fill the value and then send it onto the web server through XML or JSON web service and the other users can see the update from the web service.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, xml, interaction" }
return an array instead of a tuple from a NumPy function I have the following code: return atleast_1d(0.4*P2), atleast_1d(k_uni) My function returns a tuple. What is the quickest way to make this return as an array?
This return statement creates a tuple, consisting of 2 arrays. return atleast_1d(0.4*P2), atleast_1d(k_uni) You'd get a tuple if you did return 1, 2 return [1,2,3],{'one':1} etc I'd suggest calling the function with x, y = foo(...) Now the 2 arrays defined in the return statement are assigned to 2 variables. You can combine them in what ever way that works (depends on their shape). np.array((x,y)) np.concatenate((x,y)) etc Note that I am actually giving those functions a tuple. I could have written it as a list. The issue isn't how the function returns a tuple, but how you want to combine 2 arrays into one.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "python 2.7, numpy, scipy" }
AHK copy and paste script not copying correctly I'm trying to create a program that copies a string of text then pastes it, but for some reason it won't copy and CopyWait 5 always times out Backspace:: MouseMove, 500, 325 Click down MouseMove, 1245, 325 Clipboard = Send, ^c ClipWait 2 msgbox, %Clipboard% Click up Click sleep, 100 clip1=%Clipboard% Send, %clip1% Any ideas on how to fix this and what I'm doing wrong?
The `MouseMove` / `Click` / `MouseMove` looks like you're shading the text you want to copy? Does ^c work normally in the program you are copying from if the mouse button is still held down? (you can check that manually)...because in the script above, the mouse click is not released until after the copy command--I would have expected the `Click up` statement follow the second `MouseMove`, before clipboard is cleared, although I don't think it should really have an impact either way in most programs, it might be something to try. MouseMove, 500, 325 Click down MouseMove, 1245, 325 Click up On a side note, you can also save/restore the clipboard if you don't want your script to permanently modify it... lastClipboard=%clipboardAll% Clipboard = ; (code that modifies the clipboard goes here) clipboard=%lastClipboard%
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "windows, windows 10, autohotkey, copy paste" }
How to compare two columns of matrix in r and output the column name in a new vector **I have a matrix with 2 columns and 1000 rows** first second 1 0.96 1.34 2 0.67 1.22 3 1 0.87 .. 1000 12 11 I want to compare the two columns for every row of matrix and output the value in a new vector with values either "first" or "second" My output should be second second first .... first I want to do this in R What I have tried so far in R if(data[2] > data[1]) "second" else "first" This is returning a vector of only 1 value. Please help
You need the vectorized version of if/else. The matrix version: ifelse(data[,2] > data[,1], "second", "first")
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "r, matrix, vector" }
How to convert real-time video streaming to chunk for P2P sharing I am trying to implement a real-time video streaming broadcasting system, and using P2P technology to save the bandwidth of streaming server. I am using Wowza Streaming Engine to implement my streaming server. So the streaming server will receive real-time streaming of my camera. And I am using VLC library to receive a real-time rtsp streaming on my custom android app. Now I have to do the second part: ""Convert the streaming to chunk for P2P sharing. (server -> client(P2P))."" But I dont know how to generate the chunk from the streaming. Can anyone give me some suggestion for how to do this or some open source exit? And is this the correct way to do the p2p streaming system?
You can use **ffmpeg** to produce media segments. Eg: `ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a libfaac -f segment -segment_list out.list out%03d.ts` Source: ffmpeg official documentation
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "streaming, vlc, p2p, wowza" }
Get prototype method I have a problem. My code: function Param(){ this.name = 'sasha' this.method = function(){ return this.name + 'native method' } this.pro= function(){ debugger // Param.prototype.method() //undefined proto method bad!! // this.__proto__.method() //undefinedproto method Object.getPrototypeOf(this).method() //undefinedproto method } } Param.prototype.method = function(){ console.log(this.name + 'proto method') } var param= new Param; param.pro() Help get the method prototype with this.name = 'sasha' ... He works like this `Object.getPrototypeOf(this).method.call(this);` Perhaps there is an alternative?
The very simple solution: `this.method()`. That's just polymorphism. If you want to be sure that you use a method from the prototype, you have to get it explicitly (through any of the 3 ways that you've shown), but then you also need to explicitly invoke it on the current instance by using `.call(this)`. There's nothing wrong with that. If you want to define a `pro` method that does exactly what the `.prototype.method` does, you can simply directly assign it: this.pro = Param.prototyp.method(); then `param.pro()` will invoke that prototype method on the instance with the name as well.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, oop, prototype" }
Python Inheritance: what is the difference? Given a parent class 'A' Class A(object): def __init__(self,a,b): self.a = a self.b = b What is the difference between making a subclass 'B' among the below options Option 1 Class B(A): def __init__(self,a,b,c): self.a = a self.b = b self.c = c Option 2 Class B(A): def __init__(self,a,b,c): A.__init__(self, a, b) self.c = c
In this case, none. But what if `A.__init__` did loads of complex logic? You don't want to have to duplicate all that in B. An enhancement on Option 2 is to use the `super()` function: class B(A): def __init_(self,a,b,c): super(B, self).__init__(a, b) self.c = c
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python, inheritance, subclass" }
Get overall sum of all databases size in a SQL Server I want to calculate how much space my databases are using in a server. I could use `sp_spacefiles` or query `sys.databases` table but that would give me separate results for each database and I would have to copy that into an excel sheet and calculate the sum from there. Is there a direct way of doing it in T-SQL? Thanks.
You can query `master.sys.master_files`: SELECT CONVERT(DECIMAL(10,2),(SUM(size * 8.00) / 1024.00 / 1024.00)) As UsedSpace FROM master.sys.master_files This will give you a total in GB. `Sys.Master_files` is a server-wide view that lists every file in every DB. It's available from SQL Server 2005 onward.
stackexchange-stackoverflow
{ "answer_score": 29, "question_score": 14, "tags": "sql, sql server, database, tsql" }
Formatting of XML created by DataContractSerializer Is there an easy way to get DataContractSerializer to spit out formatted XML rather then one long string? I don't want to change the tags or content in any way, just have it add line breaks and indentation to make the XML more readable? <tagA> <tagB>This is</tagB> <tagC>Much</tagC> <tagD> <tagE>easier to read</tagE> </tagD> </tagA> <tagA><tagB>This is</tagB><tagC>Much</tagC><tagD><tagE>harder to read</tagE></tagD></tagA>
As bendewey says, XmlWriterSettings is what you need - e.g. something like var ds = new DataContractSerializer(typeof(Foo)); var settings = new XmlWriterSettings { Indent = true }; using (var w = XmlWriter.Create("fooOutput.xml", settings)) ds.WriteObject(w, someFoos);
stackexchange-stackoverflow
{ "answer_score": 96, "question_score": 57, "tags": "c#, xml, formatting, datacontractserializer" }
pySpark .reduceByKey(min)/max weird behavior I have the following function: minTotal = numRDD.reduceByKey(min).collect() maxTotal = numRDD.reduceByKey(max).collect() A sample from my dataset that is acting strangely: (18, [u'300.0', u'1000.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'1000.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0', u'300.0'] The min is reported as: 1000 and Max as 300 Very odd to me all my other key/values are reporting correctly except for this one. Not sure what is going on here.
Forgot that they are unicode and they will be evaluating as strings not their numeric form. So you need to convert to float to get the correct answer.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache spark, pyspark" }
Rails: How to create an url shortener? I'm not sure if `url shortener` is the right name for it, because most of the search results point toward things like `bit.ly`. So, here is what I want: Given url strings like: Turn it into avc.com firstround.com svpg.com medium.com paulgraham.com No subdomain, no subdirectory, no `/`. I can do something like `url.split('://')[1].split('/')[0]`, but cannot get rid of the `www`, and I'm wondering if there is a better way of doing it?
You can use the URI module and then use a regexp to parse out the first www. Like def host(url) uri = URI.parse(url) uri.host.sub(/^www./, '') end
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ruby on rails" }
Activity-Dialog-Activity. The Dialog is shown when pressing Back button in second Activity I have a `Dialog` instance which is shown when clicking a button in an `Activity`. In the dialog there is another button. I call `startActivity(intent)` when clicking this button in the dialog. So, I have an `Activity`, `Dialog`, `Activity`. When I click back in the second activity, the dialog is shown. I want to show the first activity, not the dialog. How can I do this without calling `startActivity(intentToFirstActivity)` in the second `Activity`?
Simply call `dialog.dismiss() in your`Dialog`when you start the next`Activity` //dialog creation // set onClick @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(MyActivity.this, NextActivity.class); startActivity(i); dialog.dismiss(); } If this isn't working then please edit and post the `Dialog` code that you have.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android" }
Shopify Webhook not triggering when creating an order through API When I create an order through the orders API the webhook for orders/create does not fire, however, if a real order comes through the store the webhook successfully fires. Does anyone know how I can use the orders API to create an order and have the webhook trigger?
Order hook for shopify triggers every-time, sometimes even multiple times and it triggers for order-update too when order is created. There must be something wrong that you were trying. You can use logger to write down to a file with extension ".txt". So that you can know how many times web-hook is triggered or it's triggered or not. You can use this: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, api, shopify, webhooks" }
Div on td with the same color I have a div on and they both have the same color with opacity. The result is that the color of the div is darker than the color. How can I prevent it? <td align=center style="background-color:rgba(0,150,0,0.3);"> <div style="background-color: rgba(0,150,0,0.3);"> </div> </td>
It's darker because you have opacity and can see the `td` background coming through. You could either: * Remove the `div` style (it's not needed if you already have the background on the parent `td`) * Add a solid background behind the `div` (see below) * * * <td align=center style="background-color:rgba(0,150,0,0.3);"> <div style="background-color:#fff;"> <div style="background-color: rgba(0,150,0,0.3);"> </div> </div> </td>
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "html, css" }
call route in another route (cron job testing) I have route like this: Route::get('cron_job/{param1}/{param2?}', function($param1 = NULL, $param2 = NULL) { //do something here; echo "Im'm here with param". $param1; }); I use this route for cron jobs and it works OK. But now, I want to try it with another route to test it with loop, like this: Route::get('test_cron_job', function() { do { $param = 1; // here I just want to call $param++; } while ($param <10) }); How to do it? In cronjob I use: links -dump But how to call it inside another route in route.php to test it?
Let try: Route::get('test_cron_job', function() { do { $param1 = 1; // here I just want to call redirect('/cron_job/'.$param1); $param++; } while ($param <10) });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, laravel, laravel 4" }
Is there a formula to tell how many conformers of a molecule to generate? Let's say we want to generate conformers of molecules (e.g., ligands for docking in a protein pocket). Is there a formula, like a function of the number of rotatable bonds, to decide how many conformers (maximum) to generate for a given molecule ?
I haven't seen any rigorous benchmarking or guidelines. Consider that the total number of conformers goes up like $3^n$, where $n$ is the number of rotatable bonds, and ~3 is the approximate number of symmetrically unique conformers for each rotatable bond. For small molecules with <3-4 rotatable bonds, using 100 conformers seems to be enough (i.e, only a small deviation from the crystal structure geometry). There's a more complete discussion in Ebejer's paper "Freely available conformer generation methods: how good are they?": _J Chem Inf Model._ **2012** 52(5) pp. 1146. (Slide from Jean-Paul Ebejer) ![enter image description here]( Beyond 3-4 bonds, it's less clear if sampling more conformers is a clear win. I would guess the answer is "yes," but I have not seen any papers (yet) dealing with such flexible molecules. One may need better tools, and also better force fields or computational methods.
stackexchange-chemistry
{ "answer_score": 19, "question_score": 17, "tags": "computational chemistry, cheminformatics" }
Simple pattern/texture for shading chart elements If I print the following `BarChart` in black and white, then it is very difficult to tell which bar is "a" and which is "b". BarChart[{{1, 2}}, ChartLegends -> {"a", "b"}] !enter image description here ## Question How can I put a simple pattern or texture (like stripes or dots) on these bars to differentiate them? I know that the solution will involve `ChartElements`, but I can't figure it out.
BarChart[{{1, 2}}, ChartLegends -> {"a", "b"}, ChartStyle -> {GrayLevel[.1], GrayLevel[.8]}] !Mathematica graphics
stackexchange-mathematica
{ "answer_score": 5, "question_score": 0, "tags": "plotting, histograms, filling" }
What’s the difference between access to a broken HDD with special software vs. typical access through an OS? My HDD broke, but I could extract data from it using special software. The computer did detect the HDD but I could not enable it in the disk manager. If the HDD is only readmode, the i should be able to atelast copy data from the drive using windows manager. But I couldn’t. Why?
An OS needs the filesystem to be healthy (at least to some degree) to mount it. The partition table must be valid to easily tell where on the disk the filesystem(s) is. A probable scenario is the filesystem couldn't be mounted but the tool you used was able to recognize (some of) its structures and retrieve some (not necessarily all) files one by one. It's possible by directly reading sectors from HDD, without relying on the filesystem driver implemented by the OS. The tool uses its own knowledge on how such and such filesystem is supposed to look like. Saving files from broken filesystems is one of such tool's jobs. A particular file may or may not be saved, depending on which sectors are damaged, unreadable etc. Since you didn't specify what special software you had used, this is only my hypothesis; a plausible one though. Certainly there are tools that work this way.
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "hard drive, hardware failure" }
Amann/Escher, Analysis I, Remark 12.12: $K$-algebra homomorphism I'm reading reading Section I.12 _Vector Spaces, Affine Spaces and Algebras_ from textbook _Analysis I_ by Amann/Escher where there is _Remark 12.12_ : > ![enter image description here]( I would like to confirm if my understanding about $p(A) := \sum_{k} p_{k} A^{k}$ is correct. 1. $A^k = \underbrace{A \circ \cdots \circ A}_{k \text{ times}}$ where $\circ$ is function composition. 2. $p_{k} A^{k}$ is a function such that $(p_{k} A^{k}) (v) := p_k (A^k (v))$ for all $v \in V$. 3. $\sum_{k} p_{k} A^{k}$ is a function such that $\left ( \sum_{k} p_{k} A^{k} \right ) (v) := \sum_{k} \left [ ( p_{k} A^{k}) (v) \right ]$ for all $v \in V$. Thank you for your help!
You are right. The only thing you have to know that on $\text{End}(V)$ you have an addition (pointwise by $(A + B)(v) = A(v) + B(v)$), a scalar multiplication (pointwise by $(k \cdot A)(v) = k \cdot A(v)$) and a multplication which is nothing else than function composition $(A \circ B)(v) = A(B(v))$. This makes $(\text{End}(V),+,\cdot,\circ)$ a $K$-algebra. For any polynomial $p \in K[X]$ you may then insert any $A \in \text{End}(V)$ for the variable $X$. This generalizes to any $K$-Algebra $\mathfrak A$: $(p,\mathfrak a) \mapsto p(\mathfrak a)$ can be defined as for $\text{End}(V)$.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "vector spaces, algebras" }
How to convert rows with distinct values to columns? I have a temporary table `table1` as seen below table1 +------+---------------+------------+ | Id | Description | Attribute | +------+---------------+------------+ | 1 | blue | color | | 1 | Large | size | | 1 | active | status | | 2 | green | color | | 2 | small | size | | 2 | inactive | status | +------+---------------+------------+ I would like to return a table as seen below: +------+-----------+-----------+-----------+ | Id | Color | Size | Status | +------+-----------+-----------+-----------+ | 1 | blue | large | active | | 2 | green | small | inactive | +------+-----------+-----------+-----------+ Is there a way to do this? Thank you.
Use `PIVOT` as below: DECLARE @Tbl TABLE (Id INT, Description NVARCHAR(max), Attribute NVARCHAR(50)) INSERT INTO @Tbl select 1 , 'blue', 'color' union all select 1 , 'Large', 'size' union all select 1 , 'active', 'status' union all select 2 , 'green', 'color' union all select 2 , 'small', 'size ' union all select 2 , 'inactive', 'status' SELECT * FROM ( SELECT * FROM @Tbl ) A PIVOT ( MIN(Description) FOR Attribute IN ([color], [size], [status] ) ) B Result: Id color size status 1 blue Large active 2 green small inactive
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "sql, sql server" }
Сортировка категории wordpress? Приветствую! Есть цикл категории <ul class="filter_country"> <?php foreach (get_terms('country') as $cat) : ?> <li><a href="<?php echo get_term_link($cat->slug, 'country'); ?>"> <?php echo $cat->name; ?> </a><span><?php echo $cat->count; ?></span></li> <?php endforeach; ?> </ul> Как добавить сортировка по $cat->count ? Спасибо.
В функцию `get_terms` можно передавать массив аргументов, в том числе параметр сортировки: $terms = get_terms(array( 'taxonomy' => 'country', 'orderby' => 'count', 'order' => 'ASC' // по возрастанию (значение по умолчанию) или DESC - по убыванию ));
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "wordpress" }
Backing up MySQL in WampServer How can I backup my 10MB MySQL database? I don't think WampServer supports mysqldump. I want to migrate it to a web server.
This question was asked on Server Fault
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, mysql, wampserver" }
Cosa significa "il più vago smalto" in questa frase? Nel libro _Racconto d'autunno_ , di Tommaso Landolfi, ho letto la frase seguente: > Le foglie gialle d'una cascia lì presso facevano **il più vago smalto** col cielo azzurro. Nel dizionario Garzanti ho trovato che una "cascia" è una "acacia". Non capisco però il significato di "smalto" in questa frase, malgrado abbia cercato questo termine in parecchi dizionari, soprattutto perché è qualificato con la locuzione "il più vago". Potreste spiegarmelo?
A volte, in senso figurato, "smalto" significa "vivacità". "Vago", oltre al significato di "indefinito, impreciso", ha quello (letterario) di "bello". La frase, molto alta e letteraria, può dunque significare che i due colori insieme davano un'idea di bella vivacità.
stackexchange-italian
{ "answer_score": 7, "question_score": 3, "tags": "meaning" }
How can I schedule a rule to always be run at a specific hour of the day? I have a rules component that sends me an e-mail containing a view that contains certain statistics about my site. I'd like to have this e-mail sent at midnight every day. The rule looks like this: **Component: Action set** 1. Send e-mail 2. Schedule the component again for evaluation (+1 day) I then triggered the rule manually at midnight and waited for it to evaluate again. This worked for the first several days but now the e-mail is arriving at 3 or 4 in the morning instead of at midnight. I really want the e-mail to be sent at the same time every day (or as close to the same time as possible every day). Is there a way to do this?
To finally answer the original question in the title, you can run a rule at a specific hour of the day by writing for example today + 9 hour "today" is always the actual day at 0:00:00, "+ X hour" adds any number of hours to this. Note that "hour" is written in singular. Other keywords could be "month", "week", "day", "minute" or "second". You can combine keywords. There's a lot more, refer to this page for further details: <
stackexchange-drupal
{ "answer_score": 2, "question_score": 4, "tags": "7, rules" }
Check whether Elementor visual editor view is active **How do I check whether a WordPress page is currently viewed "as a regular page" or "in the Elementor visual editor"?** I've written a plugin that redirects users when a specific shortcode if present on a page. It works like a charm, but unfortunately the Elementor visual editor dies when a page redirects the client. I want the plugin to redirect only when the Elementor editor isn't active. My first idea was to check if the URL contains `action=elementor`, as it does when Elementor editor is active, and do something like this: global $wp; if ( strpos(home_url( $wp->request ), 'action=elementor') !== false ) { // don't redirect } but this does not work, as `home_url( $wp->request )` only returns the permalink of the page but not the actually called URL.
Okay nevermind... This does the trick: if ( strpos($_SERVER['REQUEST_URI'], 'elementor') !== false ) { // don't redirect }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, wordpress, elementor" }
Is there a preprocessor macro which lets me know whether an application is of console type or other? I'm going to write me a little `print( )` function. However in said function I'll have to determine whether I'm dealing with a console application independent of the Operating System. ( Mostly for deciding whether to use `std::cout` or go with the OS related `MessageBox` implementation. ) If there is no auto generated constant would there be another suitable way that is multi platform compatible? I will include it in a library, which means I can't tell which compiler will be used or which IDE.
There is no platform independent method for determining if your application is using a GUI or a Console. This would be exceedingly difficult on UNIX platforms, where there are many different GUI libraries, not to mention Wayland vs X11.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "c++, c preprocessor, compiler constants" }
How do I remove the "Productivity" group header from Windows 10's Start menu? By default Windows 10's Start menu mandates the use of groups, ensuring that the Start menu always consists of at least one group. However, grouped tiles are not a feature I need and I would rather just place all my most-used tiles directly onto the Start menu. The closest I can get to this is placing all the tiles in a single large group. However, the problem that I then have is that this group's header still remains, called "Productivity" by default. ![enter image description here]( If it's not possible to disable the Start menu's groups feature entirely, how can I get rid of the redundant group header and free up the space it's taking up?
> How do I remove the “Productivity” group header from Windows 10's Start menu? All you have to do is click on the words "Productivity" and clear the text. > how can I get rid of the redundant group header and free up the space it's taking up? You can get rid of the words, but you will be unable to get rid of the unnamed group, if you want that gone you will have to use a Start Menu replacement program. > You can clear the header name, but it doesn't remove the header itself, as it's still there when hovered over and the space it takes up remains there. Based on your last description, want isn't possible without a third-party program, the best you can do with native functionality is remove the group name. This might change once `Windows 10 version 2004` is released.
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "windows, windows 10, windows registry, start menu" }
Visual scrolling/visual <C-e> and <C-y> across wrapped lines? This has been asked on stackoverflow before, but it seems it still has no solution. Perhaps that has changed with Vim 8.0. I'd like to be able to scroll (i.e. scroll-wheel, or `<C-y>`/`<C-e>` in normal mode) by **visual lines** when line-wrapping is enabled, rather than by line number. This can come in handy for text documents (in my case, LaTeX files). Any chance Vim 8.0 allows this somehow? Or can anyone suggest a vimscript `function` hack that might accomplish the same thing?
I've released a vim plugin that pretty closely matches this behavior. Instead of scrolling by exactly `N` lines, this maps `<C-u>`, `<C-d>` (half window) and `<C-j>`, `<C-k>` (quarter window) to scroll _as close to`N` lines as possible due to the wrapped lines_, then moves the cursor back to the original relative line position in the Vim window. To match the vim behavior, if the top or bottom of the window are on line 1 or the final line, scrolling does _not_ preserve the original cursor location and the cursor starts moving up the window until reaching the boundary. This plugin also introduces a `:WrapToggle` command (mapped to `<Leader>w`) that toggles wrapping on and off, and swaps the various `j`, `gj`, `k`, `gk` maps so that the basic motion commands are _always_ with respect to visual lines, and the `g` prefixed maps are with respect to actual lines when line wrapping is enabled.
stackexchange-vi
{ "answer_score": 5, "question_score": 9, "tags": "vimrc, vimscript, scrolling, multiple lines, mouse" }
Why use XAML in visual studio express for windows 8? i'm trying to do an application for Windows 8 and i'm following a guide on channel9.msdn I cant understand why they use XAML to create textbox, label or other controls. There's a reason ? There's a form which is much faster: simply drag & drop controls into the UI. So why use XAML ? Thanks all and sorry for my english :/
XAML supports laying out the form so that if you resize the window, the controls contained in the window are always consistently positioned according to the layout. If you just drag and drop, you will see that the designers uses margins to position the controls. When you resize the window, they kind of keep the same position and are not going to be well positioned anymore. This layouting is the essence of WPF. Just read a tutorial about layouting in WPF.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "xaml, windows 8, visual studio 2012" }
SQL how to INSERT a row for user when i only have login, not the id I have two tables: > Users (idk, surnamek, namek, logink) > > Measurements (idm, date, weight, #idk) How can I use INSERT to add a row to measurements for a particular user if I only have 'logink' from Users table? I am using postgresql sample data: Users: (1, Smith, Tom, tomsmith) (2, Pitt, Brad, pittbrad) Measurments: (1, 19.02.2019, 80, 1) (2, 19.07.2019, 85, 1) after the INSERT i would like Measurments to be like: (1, 19.02.2019, 80, 1) (2, 19.07.2019, 85, 1) (3, 19.08.2019, 88, 1) after giving 'tomsmith' as login
You can find the user id from the `Users` table when inserting. Something like this: INSERT INTO Measurements(idm, date, weight, idk) SELECT @idm, @date, @weight, ud.idk FROM Users u WHERE u.logink = @logink
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, postgresql" }
What is the default stack size in Node.js? I know how to set the stack size thanks to: How can I increase the maximum call stack size in Node.js But, what is the default size? (ie how do I get to the PHP equivalent of `phpinfo()`)
The simple answer is that the default stack size is 492 kBytes (32-bit) and 984 kBytes (64-bit). As commented by soyuka try this: $ node --v8-options | grep -B0 -A1 stack_size or $ node --v8-options | grep -B0 -A1 stack-size
stackexchange-stackoverflow
{ "answer_score": 50, "question_score": 29, "tags": "node.js, callstack" }
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM I have Subscribers table in the DB which cantains DateCreate field that has default value GetDate(). When I try to add new record to the table via Entity Framework: Subscribers subs = new Subscribers(); subs.Email = email; subs.DateCreate = DateTime.Now; DataBase.DBContext.AddToSubscribers(subs); DataBase.DBContext.SaveChanges(); it throws an exception: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Who can help me? Thanks.
1. Make sure your machine clock is not in 15th century ;-) 2. Recreate your model. 3. It your table has default value you don't have to set it in code. 4. Consider using `GETUTCDATE()` instead of `GETDATE()` 5. Make sure there are no other DateTime fields without default values.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "asp.net, database, entity framework" }
Adding Numbers in a Range with for() Loop I'm having trouble filling out a question on an online python tutorial. It seems really simple but for the life of me I can't figure it out. This is the problem " **write a for loop that adds all the numbers 1 to 10 and returns the sum.** " And this is the code I have been trying: def run(): sum = 0 for i in range(11): sum += i return sum What am I doing wrong? Thanks for any help.
You're returning within the loop, after one iteration. You need to dedent the `return` statement so that it falls outside the loop: def run(): sum_ = 0 for i in range(11): sum_ += i return sum_
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 1, "tags": "python" }
LINQ to SQL and immutability I'm tryign to use LINQ to SQL. Everythign works great but it seems that it is not friendly to immutable objects. LINQ to SQL requires me to create a parameterless constructor for my immutable class. But I want it to be immutable, so I want to only allow people to create it with all the required parameters each time. Likewise I need to have setters on all of my members. Is there a way that I can still use LINQ 2 SQL without giving up my immutability? Here is my code: DataContext db = new DataContext("myconnectistring"); Table<MyImmutableType> myImmutableObjects = db.GetTable<MyImmutableType>(); It will throw exceptions about no setter and no default constructor with no parameters.
You can create types _without_ this ctor, and simpy use the selector to project into them. Since you obviously aren't using updates etc it shouldn't matter that they aren't part of the generate model: from cust in db.Customers ... select new ImmutableCust( cust.Id, cust.Name, ...); (where ImmutableCust isn't part of the L2S model)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 6, "tags": "c#, linq, immutability" }
What's the code for two text boxes to be next to each other in HTML 5? I'm quite new to HTML and I wish to create a web page; but I just couldn't figure out the code for two text boxes to be next to each other.
im not sure what you mean by "parallel text fields" but if you want two text boxes next to each other then the following: <div> Field 1 : <input type="text"/> Field 2:<input type="text"/> </div> if you want the text fields one below the other: <div> field 1 :<input type="text"/> </div> <div> field 2:<input type="text"/> </div>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html" }
Solving angles in a parallelogram with multiple variables !Parallelogram Problem I have a Math test tomorrow, and was going over the study guide. I have solved problems like this before with elimination, but this one confused me. I have not learned trig(sin,cos,tan) so this problem is meant to be solved by knowing the properties of parallelograms. If anyone could help me, that would be much appreciated.
**TIP** : $\rm m\angle J + \rm m\angle K = \rm m\angle K + \rm m\angle L = 180°$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "geometry" }
Passing argv strings to functions in C I know there's a posts about this and I have tried to go through them and they haven't seemed to solve my issue. I'm guessing it's something simple that I've overlooked, but I swear I don't see it. So here goes... from main char *newstr = argv[3]; header(newstr); function header void header(char *read_file){ I'm getting conflicting types for 'header', and warning: passing argument 1 of 'header' from incompatible pointer type. I went through the reference links from this thread and it seems like I'm following the right path to passing the arguments. My only guess is that it has something to do with argv. Here's my args too, I've been using them just fine before this tripped me up. -q Imhere.txt b.txt dynArray.c b.txt
This compiles fine for me (using gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)) : #include <stdio.h> void header (char *read_file) { printf("%s\n", read_file); } int main(int argc, char* argv[]) { char *newstr = argv[3]; header(newstr); return 0; } with output: $ ./a.out -q Imhere.txt b.txt dynArray.c b.txt b.txt
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c, string, function, argv" }
Is there a way to get string literals from GCC? I have been looking around for a while on google but no fruitful results. I am actually looking for a way to export or some how get list of all string literals e.g. int main(){ const char *p = "Hello"; const char x[] = "World"; } For compiling this code is there a way to know "Hello" and "World"? I do know that they are available in disassemblers (used some in Windows). But is there some proper tool to actually dump these strings or somehow export them?
Write a simple tokenizer that recognizes strings and comments and ignores everything else.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "c++, c, gcc, compiler construction" }
JavaScript keyboard event handler for long press I want to get `keyup` and `keydown` events with JavaScript, the problem is that at a long keyboard press those events are triggered automatically very often. Could I access the keys directly to get the physical events?
Keyup is fired once the key is released and the default action was performed. Keydown will repeat while key is not depressed. So you can make an action the first time the keydown event is handled, and not doing it again until the keyup event was fired. var action = true; input.addEventListener('keydown', function () { if (action === true) { action = false; // do your action here } }); input.addEventListener('keyup', function () { action = true; });
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "javascript, keyboard, dom events" }
Uses of LINK tag The `<link>` tag appears to have many uses aside from stylesheets. For example the W3 suggest using it for previous/next/index pages. I know that Opera also has a Navigation toolbar that will show links when present, including Home, Index, Contents, Previous, Next, Copyright, Author and more. (I doubt it is actually used by more than a handful of people.) Are there any other attributes that are useful, or other uses for the ones above? What about SEO benefit?
As far as SEO benefits nothing stands out as being truly beneficial other then canonical. The only other SEO possible benefits I can see from using the `<link>` tag is when using start/next/previous to indicate pages related to the current one, like in a multi-page article, to help the search engines understand the relationship between those pages. Others like glossary, index, section, and appendix look like they may have semantic meaning that can have SEO effects but they seem to be very obscure and we can only speculate if they do indeed have any value. The only uses of link that seems to have any real world practical uses that I have seen are * favicon * start/next/previous * stylesheets (duh) * alternative (usually for style sheets but can be used for other doc types like PDFs) * canonical **update 2011-12-06:** Google now uses `<link>` for specifying a language and location
stackexchange-webmasters
{ "answer_score": 7, "question_score": 5, "tags": "seo, html, links" }
matplotlib ticks thickness Is there a way to increase the thickness and size of ticks in matplotlib without having to write a long piece of code like this: for line in ax1.yaxis.get_ticklines(): line.set_markersize(25) line.set_markeredgewidth(3) The problem with this piece of code is that it uses a loop which costs usually a lot of CPU usage.
A simpler way is to use the `set_tick_params` function of `axis` objects: ax.xaxis.set_tick_params(width=5) ax.yaxis.set_tick_params(width=5) Doing it this way means you can change this on a per-axis basis with out worrying about global state and with out making any assumptions about the internal structure of mpl objects. If you want to set this for _all_ the ticks in your axes, ax = plt.gca() ax.tick_params(width=5,...) Take a look at `set_tick_params` doc and tick_params valid keywords
stackexchange-stackoverflow
{ "answer_score": 57, "question_score": 37, "tags": "matplotlib" }
Oracle Uptime Query Is there a way for a non admin user to check the uptime of an Oracle instance? I.e. I don't have sysdba privileges.
Your question specifies "non admin user" so I'm afraid the answer is probably no. The usual mechanisms require selecting from V$ views - V$INSTANCE or V$SESSION. Neither of these are granted to PUBLIC by default. If you ask your DBA nicely they might be prepared to grant you access to those views, or at least write a wrapping function (or functions) to expose those values.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 14, "tags": "oracle" }
Why isn't pendulums with "large" initial angular displacements not considered simple harmonic oscillators? The tangential force exerted on a pendulum weight is $-mgsin(\theta)$. If we say that the pendulum has length L than $sin\theta$ = $\frac{x}{l}$. Then $$F_{tangential} = \frac{-mg}{l}x$$ Then why do we need the small angle approximation at all? This relation between the force and the displacement satisfies the condition of simple harmonic motion, which is $\frac{F}{x} = c$ ; $c<0$. My textbook uses small angle approximation and derives the same force equation from there. But to me, it seems like the relation should be linear even if the angle is large.
$F_{tangential}$ is not in the direction of the displacement $x$. The force in the $x$ direction is $F_x = F_{tangential} \cos \theta$. Which is almost equal to your $F_{tangential}$ \- _if_ the angle is small.
stackexchange-physics
{ "answer_score": 0, "question_score": 0, "tags": "classical mechanics, harmonic oscillator, oscillators" }
Need help trying to test function to find area of rectangle using co-ordinates I have a Rectangle class that finds the area of a Rectangle using top-left and bottom-right coordinates. I'm having trouble writing up a test function to test the code and verify it works. class Rectangle: # rectangle class # make rectangle using top left and bottom right coordinates def __init__(self,tl,br): self.tl=tl self.br=br self.width=abs(tl.x-br.x) # width self.height=abs(tl.y-br.y) # height def area(self): return self.width*self.height So far I have written this which leads to an AttributeError: 'tuple' object has no attribute 'x' def test_rectangle(): print("Testing rectangle class") rect = Rectangle((3,10),(4,8)) actual = rect.area() print("Result is %d" % actual) What can I change to the code in order to make it work?
class Rectangle: # rectangle class # make rectangle using top left and bottom right coordinates def __init__(self,tl,br): self.tl=tl self.br=br self.width=abs(tl[0]-br[0]) # width self.height=abs(tl[1]-br[1]) # height def area(self): return self.width*self.height If with `x` and `y` you mean the first and second elements of your tuples `tl` and `br` you should use indexes instead. Tuples have no such attributes.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python, function, testing, area" }
If all $L^p$ norms are bounded then the $L^\infty$ is bounded Suppose that $||f||_p \le K$ for all $1 \le p <\infty$ for some $K>0$. How to show that the essential supremum exists and bounded by $K$ that i s$||f||_\infty \le K$? I know how to prove that if $f \in L^\infty$ then \begin{align} lim_{p \to \infty} ||f||_p=||f||_\infty \end{align} but this already assume that $f \in L^\infty$ in this question we have to show that $f$ has an essential supremum. To be more precise I don't think I can use a technique when I define \begin{align} A_\epsilon =\\{ x | \ |f(x)|>||f||_{\infty}-\epsilon \\} \end{align} I feel like here we have to use some converges theorem. Thanks for any help
Assume $\| f \|_\infty=\infty$. Let $M>0$. Define $A_M=\\{ |f| \geq M \\}$. Then $\mu(A_M)>0$. Take $p$ so large that $\mu(A_M)^{1/p} \geq 1/2$, then $\| f \|_p \geq (\mu(A_M) M^p)^{1/p} \geq M/2$. Since $M$ was arbitrary, $f$ is not uniformly bounded in $L^p$, and your result follows by contraposition. This is essentially the argument suggested by John Ma in the comments, but decoupling $M$ and $p$.
stackexchange-math
{ "answer_score": 10, "question_score": 6, "tags": "functional analysis, lp spaces" }
How can I specify the position of a given symbol in a substring function? Let's suppose I have this column with this kind of data: IT > FR ES > PT FR > IT And I want to show two separate columns, where the results are: in the first, only the country code of the first country and, in the second, only the ones of the second. We use the substring function. And it's okay. Now, let's assume I have this column called border: IT > FR ES > PT FR > IT DE > PORTO ES > NL NO2 > UK The length of the borders are not the same! Is there a way to specify in the substring function that I want for a column only the string from the position of `>` backwards or onwards?
< Locate([your column],'>',1) Or am I missing something? Left([Your column],Locate([your column],'>',1)-1) --To grab the left side Right([Your column],Locate([your column],'>',1)+1) --to grab the right side
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "mysql, sql, position, substring" }
Zookeeper: How to use High Level Consumer to find a find a list of kafka brokers I've been following the high level consumer example \- but it seems these for are consuming from kafka. I want to connect to zookeeper (zookeperhost:2181) and get a list of kafka brokers associated. Is there a way to do this with HLC? Also, is there a way to use SimpleConsumer to find a list of kafka brokers, given zk?
As you can see in the link you gave, you don't pass a broker list to the HLC, but props.put("zookeeper.connect", a_zookeeper); So it's already linked to zookeeper, and from there it will discover kafka brokers. For you second question, you have the option of using ZkClient to get /brokers data in ZooKeeper, but I wouldn't do it since it depends on Kafka implementation details, which may or may not be stable.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "apache zookeeper, apache kafka" }
Enhanced for-loop Can you please convert this enhanced for loop to an ordinary one? ` for (String sentence : notes.split(" *\.")) ` I'm fond of enhanced and normal for loop when the data type is an integer. But if it is a string, I'm confused. Thank you very much!
String[] sentences = notes.split(" *\."); String sentence = null ; int sentencesLength = sentences.length; for(int i=0;i<sentencesLength;i++){ sentence = sentences[i]; //perform your task here } Eclipse Juno has in-build feature for converting for-each to index based loop. Check it out.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "java, for loop, foreach" }
CSS-sprite menu and jQuery addClass() method I've created CSS sprite menu based on this tutorial: < Now I'd like to assign .selected class to the 'a' which was clicked as last one. I've added sipmle script: <script> $("a").click(function(){ $(this).addClass("selected"); }); </script> but the class .selected appears only during loading the page. After loading whole page menu item returns to its normal state. Could you help me with this issue? TIA Have a nice day:)
Clicking `a` will take you to a different page, so this event is not gonna work for you. To add `selected` class to the current link you have to code like below: <script> $(function(){ //short form of $(document).ready(function(){ $("a").each(function(){ path=window.location; path=String(path).split('/')['3']; //if you use absolute URLs then disable this line if($(this).attr('href')==path) { $(this).addClass("selected"); } }); }); </script> It will add class `selected` to link(s) if it's `href` matches the current URL of the browser.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, html, css" }
How to multilanguage desktop application using c# Hi All I am very new to c# .I have searched google how to make multi language calender using c# but i have not found any results. I need to make calender in these three languages any help
For a **Desktop app** you have to change the current culture System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("fr") System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture check this link For a **Web Page** simply change the page culture and UI culture to get The Islamic calendar change culture to <%@ Page UICulture="ar" Culture="ar-SA" %> Gregorian : change back to english <%@ Page UICulture="en" Culture="en-US" %>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, asp.net" }
Invalid XPath expression exception due to presence of apostrophe in name I am getting Invalid Xpath Exception for following code. current.Name = current.Name.replace("'", "\'"); System.out.println(current.Name ); String xp1 = "//page[@name='"+current.Name+"']" ; Element n = (Element) oDocument.selectSingleNode(xp1+"/Body/contents"); Exception occurs when the string in current.name has an apostrophe in it current.name: "Répartition par secteur d'activité" Error Message
You can escape the quote by doubling it: current.Name = current.Name.replace("'", "''"); EDIT: For Xpath 1.0, you could try the following: String xp1 = "//page[@name=\""+current.Name+"\"]" ; I.e. Use double quotes instead of single quotes to delimit the name (though that means you won't be able to search for strings with a double quote. Note also, for the second solution you won't need to replace the quotes.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "java, xml, xpath" }
Elements of the amplifier - application and operation I have a problem with a power amplifier from this application note. ![enter image description here]( I am wondering about the elements shown in the circuit in the "Application Circuit" section. Can these elements be placed differently? What is their use? For example, why are TL1, TL2 and TL3 in this location? Can these transmission lines be located differently? I didn't find an explanation of the use of these elements in the application note, and I'm not entirely sure why they are there and what they are for, and if all of them are needed.
Applications circuits are designed so that they will definitely work, and so that the manufacturer and the customer have a common reference circuit if any questions arise. TL1 - TL3 act like inductors. TL1, TL2 & C1 form a low-pass network, presumably to hold down on harmonics. I'm not sure what the function of TL3 is -- possibly impedance matching, or maybe just to get the power to the edge of the board. C2 is a DC blocking capacitor. These are probably not all needed if you're using this amplifier in some circuit of your own design that's not meant for the canonical 50 ohms in and AC-coupled 50 ohms out. But whether that's true _for your circuit_ depends on what you're trying to build, and what tradeoffs make sense _for your circuit_.
stackexchange-electronics
{ "answer_score": 3, "question_score": 0, "tags": "circuit analysis, amplifier, transmission line, power amplifier, passive components" }
Trying to handle InstantiationException in JAVA, compiler throws it instead So I'm new at Java, and I'm trying to work with the try, catch and finally features. As my limited understanding goes, a try-catch block allows me to handle exceptions instead of the compiler throwing an error that I can't return to execution from. Is this right? Also, my program doesn't seem to be working, as the compiler throws "Extracur is abstract, cannot be instantiated!" during compilation. How do I get it to display my error message (and execute my finally block) instead? try { extracur student1 = new extracur(); } catch (InstantiationException e) { System.out.println("\n Did you just try to create an object for an interface? Tsk tsk."); } finally { ReportCard student = new ReportCard("Progress Report for the year 2012-13"); student.printReportCard(); } PS- extracur is an interface.
Interfaces can never be directly instantiated. extracur student1=new extracur(); // not possible And you should capitalize interface names. You need instead: Extracur student1 = new Extracur() { // implement your methods }; Explanation: The code does not instantiate the interface, but an anonymous inner class which implements the interface. You should also understand that the compiler throws an error at compile time while you are trying to catch an error at runtime (too late in this case).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, exception, interface, try catch, finally" }
Using namespace and including a library I just installed memcache on my xampp but I'm having trouble including it to a file of mine that uses namespaces. How do I have to call it to get it to work under my namespace? I only tried doing: $memcache = new Memcache; But it says: Fatal error: Class 'Test\Memcache' not found in x
You have to use fully qualified name like this: $memcache = new \Memcache;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, namespaces" }
Determine programmatically the index in the solution of project- C# The method Solution.Projects.Index(Object index) get an index of project as number. I have the name of the project. How can I determine the index in the solution of this project programmatically?
You can use linq: string yourProject = "ProjectName"; var query = Solution.Projects.Cast<Project>() .Select((p, i) => new { Name = p.Name, Index = i}) .First(p => p.Name == yourProject).Index;
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "c#, solution, visual studio project" }
touch() expects parameter 1 to be string, resource given This problem only happens the first time its called. Second time, no error, no problem. Called once daily to update currency rates. private function updateRates() { $szContent = file_get_contents(self::OPT_URL); if(!$szContent) { throw new Exception('XML resource unavailable.'); } $pXML = new SimpleXMLElement($szContent); $aRates = array(); foreach($pXML->Cube->Cube->Cube as $pChildren) { $aRates[(string) $pChildren['currency']] = (float) $pChildren['rate']; } $pFile = fopen(self::OPT_FILE, 'w+'); fwrite($pFile, json_encode($aRates)); fclose($pFile); touch($pFile); }
`touch` expects a file name, imo. You are giving it the file handle `$pFile`. Change `touch($pFile);` to `touch(self::OPT_FILE);` and see it that works.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, filesystems" }
SQL Query to get two values from a table in same result row I have a table containing an identifier which always starts AB (unique) and a key value (non-unique) ID Key ------------------ AB1234 10001 28376 10001 AB5678 10002 7180 10002 I need to be able to query and get single row results for each Key value. There will always only be two different ID values per key so I require the following results: ID1 ID2 Key ---------------------------- AB1234 28376 10001 AB5678 7180 10002 I'm not even sure if this is possible or not
> There will always only be two different ID values per key In that case, something like this might do (sample data in lines #1 - 6; query begins at line #7): SQL> with test (id, key) as 2 (select 'AB1234', 10001 from dual union all 3 select '1234' , 10001 from dual union all 4 select 'CD5678', 10002 from dual union all 5 select '5678' , 10002 from dual 6 ) 7 select min(id) id1, 8 max(id) id2, 9 key 10 from test 11 group by key; ID1 ID2 KEY ------ ------ ---------- 5678 CD5678 10002 1234 AB1234 10001 SQL>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "sql, database, oracle" }
Can't delete App ID from Apple Developer Center I've seen where Apple has changed the Certificates, Identifiers & Profiles page of the iOS dev center, and read this question/answer here on stack: Removing App ID from Developer Connection But I'm unable to delete an App ID/IDs that are several years old that I would like removed. The 'Delete' button is greyed out/not enabled. Can someone help me at all? I've tried multiple browsers and clearing my cache to no avail. Thank you in advance! Screenshot: !enter image description here
The rule is that if an App ID that has ever been submitted with an App to the store, it cannot be deleted (even if it was not accepted). App IDs that have not yet been used to submit apps can be freely deleted. Checkout this thread on Apple Developer Forums (You'll need to be logged in to view): <
stackexchange-stackoverflow
{ "answer_score": 36, "question_score": 35, "tags": "ios, iphone" }
What is a package ID in octopus? I am trying to deploy a release on a tentacle created with Jenkins and deployed in Octopus. The release is created properly and everything is ok, but when I try to deploy it to the server I get an error message that the `The resource 'XXX' was not found`. I know that I have to create in the Process tab a new step but I can not figure it out what should be in the Package ID field. With what should I fill that field or how can I solve this? Thank you
OctopusDeploy application's abilities are deploying a nuget package and could run powershell scripts on tentacles.It has an API called Octo.exe. I think you are triggering a Jenkins Job, that's creating release and deploying with Octo.exe. Also nuget package feed is very important. You must be sure, that the package is exists in the OctopusDeploy project's nuget feed. You should use Octopus built-in nuget package feed or your existing custom nuget feed server. I suggest to you using Octopus built-in nuget feed. Also nuget package versioning is very important, You must increment the nuget package version number. If you don't, you should fail when you are pushing your package to nuget feed. Package ID in Octopus is nuget package ID. It's name must match with your csprojname.nuspec file. If it does not match, You should fail. If the problem is going on please give us more information about the issue.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "jenkins, jenkins plugins, octopus deploy" }
How to properly filter gridview bound to sqldatasource I am trying to populate an (editable) gridview in ASP.NET with a table from SQL. I have a SQLDataSource set up for this. I also need to have this gridview be filterable based on parameters entered in textboxes. I have tried using ControlParameters for this and it works but the problem there is when all textboxes are empty I want it to display all results in the gridview. What it does is display nothing because no entries have parameters that equal "". Is there an easy way to do this that I am missing or is there a better way to go about it other than a SQLDataSource?
I think I got it working. In case anybody else is wondering here is what I had to do. First I needed to modify my select statement within the SQLDataSource a little bit from `SELECT * FROM [MyTable] WHERE ([ColumnName] = @Param1)` to `SELECT * FROM [MyTable] WHERE (@Param1 IS NULL OR [ColumnName] = @Param1)`. Then I set the parameter for the SQLDataSource: CancelSelectOnNullParameter="False".
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c#, asp.net, gridview, sqldatasource" }
Areas inside a Triangle $D$ is a point on side $AB$ and $E$ is a point on side $AC$ of triangle $ABC$. $P$ is the point of intersection of $BE$ and $CD$. The area of triangle $ABC$ is $12\text{cm}^2$. Triangle $BPD$, triangle $CPE$ and the quadrilateral $ADPE$ all have the same area. What is the area of $ADPE$? (see figure) Using areas I tried to get the ratios of the divided sides. Let $x$ be the area of the the $BPD$ and $y$ be the area of $BPC$. $\frac{AD}{DB}=\frac{2x}{x+y}$ $\frac{CE}{EA}=\frac{2x}{x+y}$ $\frac{CP}{PD}=\frac{y}{x}$ $\frac{EP}{PB}=\frac{x}{y}$ I tried connecting $A$ and $P$ and extending it to touch $CB$ but I still cannot find a relationship between $x$ and $y$. ![enter image description here](
![enter image description here]( $$\frac{CE}{EA}=\frac{x}{y_1}=\frac{x+z}{y_1+y_2+x}\tag{1}$$ $$\frac{DB}{AD}=\frac{x}{y_2}=\frac{x+z}{y_1+y_2+x}\tag{2}$$ By comparing (1) and (2) we get: $$y_1=y_2=\frac x2$$ Replace that in (1) and you'll get: $$\frac{x}{\frac x2}=\frac{x+z}{\frac x2+\frac x2+x}$$ $$z=3x\tag{3}$$ Use (3) to calculate $x,z$ from the total area of the triangle: $$x+x+\frac x2+\frac x2 + z=12$$ The rest is trivial.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "geometry" }
Storing list of account settings on Android Just wondering how to do this on Android. My application needs to store a list of the user's accounts. Each account would have, account name username, password, server address etc. I first tried to implement this with Preference Activity, this worked well but it seems to only result in a user interface for a single account. I am missing how to arrange this so the data is stored for an array of accounts, so if Account 3 is selected from a top level list the Preferences will display the settings for Account 3. For example if you have an email app with multiple accounts, you want to be able to configure each account individually. They have the same settings, but different instances, so each account would have it's own preference file. Thanks
You will most likely need a database (local sqlite usually) to store the data then you will have you use either the ListView and implement onClick methods OR as you say the PreferenceScreen and add preferences programmatically when you retrieve your data from the database for each account. In order to achieve it take a look here Dynamic ListPreference in android or here How can I keep on adding preferences when i click one? * * * hope this helps abit
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android" }
How to return an immutable List in Dart? So in other languages there are `ArrayList` or `MutableList` which allows modifications (add, delete, remove) to list items. Now to avoid modification of these list, simply return the `MutableList` or `ArrayList` as a `List`. I want to do the same thing in `Dart`. But in `Dart` returning a `List` still allows you to do `list.add`. How can this be done properly in Dart?
There is no _type_ for unmodifiable lists in Dart, just the `List` type. Some `List` implementations accept calling `add`, others do not. You can return an _actually_ unmodifiable list, say created using `List.unmodifiable`, as a `List`. The user will get a run-time error if they try to call `add` on it.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 12, "tags": "dart" }
Create a count in count in sql select I have a question: it's possible to create an count in count in sql: my code is: SELECT COUNT( DISTINCT p.id_participant ) as number FROM participation p INNER JOIN message m ON m.id_participation=p.id AND p.id_event = 4 I want to add in first count another count from table winners with count (id_winner) Help me please, Exist a solution?
You need to use the aggregate function **SUM**. For example, SQL> SELECT SUM(val) 2 FROM (SELECT Count(*) VAL 3 FROM emp 4 UNION 5 SELECT Count(*) VAL 6 FROM dept); SUM(VAL) ---------- 18
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "mysql" }
What is the longest element of $S_n$ as a product of adjacent transpositions? I can't seem to get this to work. According to wikipeda, the longest element of $S_n$ should be expressible as a product of $n(n-1)/2$ adjacent transpositions by $$ (n, n-1)(n-1,n-2)\cdots(21)(n-1,n-2)(n-2,n-3)\cdots $$ but I don't understand what pattern they're trying to imply. This should be the order reversing permutation, but even for $n=4$, I think I'm doing it wrong. I think that pattern says, for $n=4$, the longest element should be expressible as $6$ adjacent transpositions $$ (43)(32)(21)(32)(21)(21)=(43)(32)(21)(32) $$ but that's not right since it fixes $2$ instead of sending $2$ to $3$. What am I reading wrong?
It should be $$(n,n-1)(n-1,n-2)\cdots (2,1)(n,n-1)(n-1,n-2)\cdots(3,2) \cdots (n,n-1)(n-1,n-2)(n,n-1)$$ so for $S_4$ it is $(4,3)(3,2)(2,1)(4,3)(3,2)(4,3)$.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "group theory, symmetric groups, coxeter groups" }
gerar artefatos de java maven project com parent no Jenkins Gostaria de saber se alguém já gerou package de artefatos de um modulos pelo projeto parent no Jenkins!? Pois já tentei de todas as formas que pude pensar, mas até agora só obtive erros! Lembrando que no eclipse ele roda normalmete.
Pra quem precisar... Se o Projeto estiver com todos os módulos dentro da mesma pasta basta ir no "Gerenciamento de código fonte" e lá inserir o endereço do seu repositório no campo "Repository URL"; Se os módulos estiverem em pastas separadas também insira o endereço de cada repositório em um campo "Repository URL" (para acresentar clique em "add module"); Em cada endereço de repositorio escolha o projeto que deseja e adicione o nome do projeto em "Local module directory" Ficará assim: Parent Repository URL: endereçocompleto/parent Local module directory: parent modulo1 Repository URL: endereçocompleto/modulo1 Local module directory: modulo1 modulo2 Repository URL: endereçocompleto/modulo2 Local module directory: modulo2 em "construir" adicionar o endereço do pom parent: Pom Raiz: parent/pom.xml Metas e opções: clean install (use qual quiser) e clique no botão avançar para adicionar o settings.
stackexchange-pt_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, maven, jenkins" }
Can we find an open interval $(a,b)$ such that $g′′(x)≠0$ for all $x∈(a,b)$? Let $g:ℝ→ℝ$ be an entire function with infinitely many zeros. My **question** is: Can we find an open interval $(a,b)$ such that $g′′(x)≠0$ for all $x∈(a,b)$? and $g′′$ is continuous on $(a,b)$ and for any $y∈(a,b)$ a zero of $g′$ there are $x_1,x_2 ∈(a,b)$ so that $$g(x_2)-g(x_1)=g′(y)(x_2-x_1)$$ with $g′(y)=0$. The motivation to this question can be found in: A twice continuously differentiable function
Yes most definitely. I'm going to assume $g\neq 0$ since that immediately does not obey the condition on $g''$. The easy way to see this is that if no such interval existed, then since $g''$ is also entire, it would be the zero function (see the identity theorem from complex analysis). Thus $g(x) = ax+b$ but this only has finitely many zeroes and so we have a contradiction.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "real analysis" }
Home page in Orchard CMS I had created a module. I n that module I created a view. Now I need that view should be act as a home page. I am unable to set it as home page of my orchard application.
This Provided the solution to me. I thank it
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "asp.net mvc, orchardcms" }
Use of past simple or past perfect in this sentence However, after she ____ (teach) English for a few years, she ______ (decide) to try her hand at her real passion- writing. I'm not sure how i'm supposed to implement the past perfect and or the past simple in this sentence.
> However, after she **had taught** English for a few years, she **decided** to try her hand at her real passion - writing. It is probably also grammatically correct to use the past-simple "... she taught English ..." but the past-perfect is more appropriate. Past-perfect is used when the action was completed before some other past action. Her teaching English had occured before her deciding to try writing. Even if she was still teaching the act of teaching _for a few years_ was completed.
stackexchange-ell
{ "answer_score": 0, "question_score": 0, "tags": "sentence structure" }
How to display high-resolution images in UIImageView By default, UIImageView displays his image as 1px of image = 1pt in UIImageView, but I'd like to display as 2px of image = 1pt. Version of saving image with name "..@2x.." is not suitable, images are not saving in file system. For example, image size is 400x100, I want to display the image on center of display, and it should be 120 pt on the left and 120 pt on the right of the image(640-400) / 2
That's quite easy, note that for the versions below iOS 4 you don't have Retina displays, that's why in the image scaling method i'm doing this check first: //Retina detect if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2){ and then having `image` loaded from somewhere (file, cache, etc.) i'm scaling it this way UIImage * image2Xscaled = [UIImage alloc]; image = [[image2Xscaled initWithCGImage:[image CGImage] scale:2.0 orientation:UIImageOrientationUp] autorelease]; The method initWithCGImage:scale:orientation: is available at iOS 4.0. that's why you need the first check. If sale is not supported, return the 1.0 scaled image.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "iphone, objective c, ios" }
Quick jQuery Toggle Problem I have a little snippet in place that toggle slides in a bit of content, that works fine. What I would like to happen is that the `<li>` that causes the action in the first place fade out slightly when clicked and return normal otherwise. **My code so far:** jQuery(function($){ var container = $("#headerform"); $("#loginbutton").click(function(event){ event.preventDefault(); if (container.is(":visible")){ container.slideUp(200); // OPACITY TO NORMAL (1)** } else { container.slideDown(200); // HALF OPACITY FOR LI (0.5)** } }); }); Any help would be great, Thanks. **P.s** ID to be toggle faded = #loginbutton
You could use `fadeTo()` to fade the opacity to the desired level. `this` points to the clicked element with the event handler, giving you something like: $(this).fadeTo("slow", 0.5); and $(this).fadeTo("slow", 1);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery" }
Is it possible to use tableau server without tableau desktop? As far as I can tell you can use tableau server to make worksheets based on other worksheets, but I can't figure out how to add a new data source and create an initial worksheet without using the desktop version at all.
Technically, you could use the Tableau Data Extract API to create a TDE file, and then use the REST API to publish it to Tableau Server. Assuming the Data Extract API doesn't require a license to Tableau Desktop (check the agreement, I have no idea) You could probably do the same with a TDS file, which is just XML, so you could presumably create that by hand or by script if you figured out the format. But no guarantees that the format won't change with future versions. Seems like a lot of effort to avoid buying a few Desktop licenses which are useful in their own right. Editing workbooks in Tableau Desktop is generally a faster more fluid experience than via the web, so having a few Desktop licenses is usually well worth the cost. But if your goal is to automate a manual process, that's exactly what the Data Extract and REST APIs are for.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 7, "tags": "tableau api" }