INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Setting options for individual layers within ArcGIS Server Map Service? I've been working on an internet mapping site to include Esri basemap layers, and in-house map services broken out by layer. I am also still fairly new to javascript so this might be a javascript question. Here is the code for the mapservice and the layers I am accessing. var patLayer = new esri.layers.ArcGISDynamicMapServiceLayer(" patLayer.setVisibleLayers([7,6,1,2,3,4]); legendLayers.push({layer:patLayer,title:'Planning Layers'}); What I am not sure of is how to set the options only for specific layers and not just the entire map service e.g.opacity?
With a dynamic map service layer, you cannot specify opacity for individual layers. You can specify visible layers and queries on individual layers but you can only set opacity for the entire map service. See the documentation for specifics: ArcGISDynamicMapServiceLayer.
stackexchange-gis
{ "answer_score": 2, "question_score": 3, "tags": "arcgis server, javascript, arcgis maps sdk javascript, map service" }
#define TRACE(...) doesn't work in C++ I have the following preprocessor divective: #ifndef NDEBUG #define TRACE printf #else #define TRACE(...) #endif and example of usage is: TRACE("TRACE: some parameter = %i\n", param); In C all works perfectly well when I build both debug and release versions, but in C++ compiler emits the following: warning: invalid character in macro parameter name error: badly punctuated parameter list in `#define' and points these warning and error to the 'TRACE(...)' directive. How to write this in C++ correctly?
You could do: inline void TRACE(...) {}
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c++" }
listen for device changes using API state did change Im am using Mbient Lab API to talk to a device. Using the api I discovered there is a stateDidChange Variable that looks like this: var stateDidChange: (() -> Void)? { get set } How would I use this method in viewcontroller to detect a change in the device (such as another device has connected to it already) or can someone provide documentation on what this variable does. Link to the API is <
Simply assign a block to `stateDidChange` and handle your logic inside that block. let item = ScannerModelItem() item.stateDidChange = { // Handle state change }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "swift" }
Get parameters from anonynous class is it possible to get the final parameter values from an anonymous class? Using reflection or anything else? This example is of course all made up: final String x = "Param1"; final String y = "Param2"; ITest<String> iTest = new ITest<String>() { @Override public String execute() { return t.testMethod(x, y); } }; // Get values or x and y from iTest here?
So this is your code: ITest<String> iTest = new ITest<String>() { @Override public String execute() { return testMethod(x, y); } }; Try defining `ITest` like so: public class ITest { int x; int y; public testMethod(int x, int y) { this.x = x; this.y = y; } // execute somewhere }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "java" }
Reindexing Magento 2.0 on Xampp server How can I Reindexing in Magento 2 on xampp server and My Oprating System is Windows 7.
To resolve below error: > 'php' is not recognized as an internal or external command Make sure your PHP path is added to your windows system's environment variable. After that you may able to run commands successfully.
stackexchange-magento
{ "answer_score": 2, "question_score": 0, "tags": "magento2" }
Is it possible to schedule a message for future delivery in Mail.app? Is it possible to schedule a message for future delivery in Mail.app? I know this is possible in Outlook, in Thunderbird, and through several external apps. Can Mail.app do this, too?
There are some AppleScripts using iCal to schedule mails. I've not tested this, but the latest version is from May 2010, so theres a chance these may still work. > <
stackexchange-superuser
{ "answer_score": 1, "question_score": 3, "tags": "macos, email, apple mail" }
Make this notebook trusted to load map : File -> Trust Notebook, how can i solve this issue? import folium world_map=folium.Map() world_map This is showing something like : Make this notebook trusted to load map : File -> Trust Notebook while trusted is written on top right corner of my jupyter notebook file . How can i solve this issue ?
This is a general problem, I ran into the same issue a while back. What you have to do is to try changing your default browser to Chrome or Firefox it should work perfectly.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "jupyter notebook, folium" }
Laravel Query Builder: select TIMESTAMP as Carbon object Is it possible to select a timestamp column as a Carbon date object using the query builder? `DateCreated` in the snippet below: $entities = DB::table('translation_review as tr') ... ->select('tr.AuthorID', 't.LanguageID', 't.DateCreated' /* <--- this one! */) ->get(); **Update 1** : I have solved this manually by iterating over the result set and changing the _DateChanged_ property manually, but I am not satisfied with this solution. It feels inelegant. foreach ($entities as $entity) $entity->DateCreated = Carbon::createFromFormat('Y-m-d H:i:s', $entity->DateCreated);
If you don't use Eloquent, then you should create a Carbon object manually: $carbonDate = Carbon::parse($data['DateCreated'])
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "laravel, laravel 5, php carbon" }
How does the try catch finally block work? In `C#`, how does a try catch finally block work? So if there is an exception, I know that it will jump to the catch block and then jump to the finally block. But what if there is no error, the catch block wont get run, but does the finally block get run then?
Yes, the finally block gets run whether there is an exception or not. Try [ tryStatements ] [ Exit Try ] [ Catch [ exception [ As type ] ] [ When expression ] [ catchStatements ] [ Exit Try ] ] [ Catch ... ] [ Finally [ finallyStatements ] ] --RUN ALWAYS End Try See: <
stackexchange-stackoverflow
{ "answer_score": 56, "question_score": 56, "tags": "c#, try catch, try catch finally" }
Type 'NSError' has no member 'errorWith' in swift 4? On the following line: completionHandler(Result.failure(NSError.errorWith(text: "Can't download video"))) I get: > Type 'NSError' has no member 'errorWith' **What is the current alternative?**
It simply means `NSError` doesn't have errorWith method. If you want to create `NSError` with any description, try this let error = NSError(domain: "SomeErrorDomain", code: -2001 /* some error code */, userInfo: ["description": "Can't download video"])
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -5, "tags": "ios, swift" }
How to redirect a login url to a logged in user to a news feed page I have an app that uses django-user-accounts package to login to the site. I believe that I have to do this via settings.py file: LOGIN_URL = 'accounts/login' LOGIN_REDIRECT_URL = 'news-feed/' LOGOUT_URL = '' LOGOUT_REDIRECT_URL = '' # new def index(request): return render(request, 'feed/index.html',{'page_title': 'HomePage' }) class PostListView(ListView): model = PostForNewsFeed template_name = 'feed/home.html' context_object_name = 'posts' ordering = ['-date_posted'] paginate_by = 5 # add this count_hit = True slug_field = 'slug' .... return context path('', index, name='index'), path('news-feed/', PostListView.as_view(), name='home2'), How to have the logged in user to redirect to the home url?
just check your user is authenticated or not from django.shortcuts import redirect def index(request): if request.user.is_authenticated: return redirect("news-feed") return render(request, 'feed/index.html',{'page_title': 'HomePage' })
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "django" }
Почему при выполнении цикла не добавляются буквы? Почему при выполнении цикла не добавляются буквы? import openpyxl wb2 = openpyxl.load_workbook('импорт2.xlsx') ws2 = wb2['Разделы 1-2'] letters = { 201: 'abc', 208: 'abcd' } r = 4 # start row for num in range(1, 16): if num<10: for letter in letters.get(num, ('',)): ws2.cell(row=r, column=3).value = '2'+ '0'+ str(num) + letter r += 1 elif num>=10: ws2.cell(row=r, column=3).value = '2' + str(num) r += 1 wb2.save(filename='импорт2.xlsx')
Потому что вы сломали тот код, который я написал в предыдущем вопросе :)) В скобках у `range` должны быть именно те числа, которые нужно вывести. То есть от 201 до 216+1 (range не включает последнее число в диапазоне, поэтому нужно прибавлять единицу). Буквы берутся именно по этому номеру из словарика letters. Вы же заменили числа в range, но словарик оставили прежним. Поэтому код теперь перебирает числа от 1 до 16, но в словарике буквы только для чисел 201 и 208, и код их не берёт.
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, excel, openpyxl" }
Calculating a date in Postgres by adding months? I have a postgres table that has the following fields **start_date,duration** duration contains any number of months, so to calculate the end date you add the months in duration to the start date. Now I want to do something like this with a postgres query. SELECT * FROM table WHERE start_date > '2010-05-12' AND (start_date + duration) < '2010-05-12' Is this possible and how does one right the syntax? The version of my postgres is **PostgreSQL 8.1.22 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)**
try: (start_date + (duration * '1 month'::INTERVAL)) < '2010-05-12' or (start_date + (duration || ' month')::INTERVAL) < '2010-05-12' More info: _Date/Time Functions and Operators_
stackexchange-stackoverflow
{ "answer_score": 17, "question_score": 8, "tags": "postgresql" }
Using OFFSET-FETCH, how to default number of rows to "all rows"? Envision a stored procedure which takes `@skip` (offset) and `@take` (maximum number of rows to return. If `@take` is `null`, then I want to return "all rows after applying the offset". I can accomplish this by counting the number of rows in the table/view if `@take` is `null`, but then I have to perform two queries which is, of course, not optimal. I was hoping there was an option similar to `FETCH [NEXT] ALL ROWS`. DECLARE @skip BIGINT = 0; DECLARE @take BIGINT = NULL; IF (@take IS NULL) SET @take = (SELECT COUNT(*) FROM SomeTable); SELECT * FROM SomeTable ORDER BY SortOrder OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY
You could use `COALESCE`: DECLARE @skip BIGINT = 0; DECLARE @take BIGINT = NULL; SELECT * FROM SomeTable ORDER BY SortOrder OFFSET COALESCE(@skip,0) ROWS FETCH NEXT COALESCE(@take,0x7ffffff) ROWS ONLY `**`LiveDemo`**` `0x7ffffff` is the same as `2147483647` max `INT` value. When `@skip` and `@take` are not provided it will get first 2^31-1 records from table.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 10, "tags": "sql server, tsql, stored procedures, sql server 2012, sql server 2014" }
Show that the local truncation error for Ralston's method is $O(h^3)$ Here I have to show that the local truncation error for Ralston's method is $O(h^3)$ using a Taylor expansion of two variables, and then compare this with an appropriate taylor series method. * * * **My attempt** : The taylor series expansion of two variables is: $f(x+h,y+h)= f(x,y)+(h\frac{\partial}{\partial x}+k\frac{\partial}{\partial y})f(x,y)+\frac{1}{2}(h^2\frac{\partial^2}{\partial x^2}+2hk\frac{\partial^2}{\partial x\partial y}+k^2\frac{\partial^2}{\partial y^2})f(x,y)+O(h^3)\ (?)$ The local truncation error is then the error between the exact solution and the approximation in one step of the method... don't know what to do though
You need the Taylor expansion of $$y(x+h)=y(x)+f(x,y(x))h+\tfrac12(f_x+f_yf)h^2+...$$ Then compare with the Taylor expansions of \begin{align} k_1&=f(x,y),\\\ k_2&=f(x+\tfrac23h,y+\tfrac23hk_1),\\\ y_{+1}&=y+h(\tfrac14k_1+\tfrac34k_2). \end{align} Because of the factor $h$ in the last line you only need the linear expansion of the second line (the first does not contain any $h$) $$ k_2=f+f_x\,\tfrac23h+f_y\,\tfrac23hk_1+O(h^2)=f+\tfrac23(f_x+f_yf)h+O(h^2) $$ to confirm the identity up to order $O(h^3)$ with the Taylor expansion of $y(x+h)$, $$ y_{+1}=y+h(\tfrac14k_1+\tfrac34k_2)=y+fh+\tfrac34\tfrac23(f_x+f_yf)h^2+O(h^3). $$ If you want to compute the first coefficient of the error term, you need one degree more in the Taylor expansions.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "ordinary differential equations, numerical methods" }
changing font-size and font-family for iFrame How do I set the font-size and font-family for an iFrame (CSS or JQuery)?
Frames contain independent documents. Include a `<link>` element to your stylesheet in the documents you load in the frame.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "jquery, html, css, iframe" }
yarn encore no funciona en WINDOWS Estoy trabajando en un proyecto personal, y lo estoy haciendo con mi pc WINDOWS. El caso es que es un proyecto en symfony y me he encontrado con un problema. * Instalo el symfony encore pack * instalo yarn Pero cuando utilizo el `yarn encore dev` me dice lo siguiente yarn run v1.22.5 error Command "encore" not found. info Visit for documentation about this command. Estos son los pasos que he seguido: <
Por lo que veo en el siguiente comentario (el mismo error que tienes): < podría ser por no tener la versión actualizada. Aunque por la versión que posees parece que si la tienes podrías intentar lo que comenta: 1. Eliminar el directorio `node_modules`, podrías renombrarlo si prefieres. 2. Eliminar el fichero `.lock` de yarn: `yarn.lock` 3. Usar el instalador que proporcionan o el otro método con `choco`: < (entiendo que ya hiciste un `yarn install`) 4. Ejecutar de nuevo: `yarn add --dev @symfony/webpack-encore`
stackexchange-es_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "windows, symfony, yarn" }
Auto-formatting Javascript arrays into new lines in Aptana Studio 3 It seems that Aptana Studio 3 only has the option for auto-formatting Javascript arrays into one line. I was wondering if there is a way to make Aptana Studio 3 auto-format Javascript arrays into a new line for each array element (similar to the option for auto-formatting php arrays - "Insert new line between array creation elements"). For example, I want var dataset = [1, 2, 3, 4]; to become var dataset = [1, 2, 3, 4];
What I usually do in Aptana is this: var dataset = [ // 1, // 2, // 3, // 4 // ]; And Aptana is dumb enough to be smart about not trying to interpolate with line comments. Then you can even have: var dataset = [ // [1, 3, 5, 7, 9], // [2, 4, 6, 8, 0], // 'Some string here', // function( ) { return 'even a function'; } // ];
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, arrays, aptana, aptana3, autoformatting" }
read input in primefaces notificationbar I'm trying to read an inputText which is placed in a p:notificationBar but I only get null as the input of it. The jsf code is : <h:form> <p:notificationBar position="top" effect="slide" styleClass="top" id="notificationPanel" widgetVar="bar" > <h3>Subscribe</h3> Add your email adress here <h:panelGrid columns="3" cellspacing="20"> Email: <p:inputText value="#{detailsBean.email}" /> <p:commandButton value="Submit" action="#{detailsBean.submitEmail}" onclick="bar.hide()"/> </h:panelGrid> </p:notificationBar> </h:form>
The HTML representation of the `<p:notificationBar>` will be relocated to the desired location in the HTML DOM tree and will in your particular case thus not end up in a HTML form anymore. You need to move the `<h:form>` to inside the `<p:notificationBar>`. <p:notificationBar position="top" effect="slide" styleClass="top" id="notificationPanel" widgetVar="bar" > <h:form> <h3>Subscribe</h3> Add your email adress here <h:panelGrid columns="3" cellspacing="20"> Email: <p:inputText value="#{detailsBean.email}" /> <p:commandButton value="Submit" action="#{detailsBean.submitEmail}" onclick="bar.hide()"/> </h:panelGrid> </h:form> </p:notificationBar>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "jsf, jsf 2, primefaces" }
Get the review and rating List of my app Is there any link that give me the review list of my app from iTunes store?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id;=APP_APPLE_ID"]]; APP_APPLE_ID is your Apple ID which you can get from iTunes->Manage Your Applications
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "iphone, ios6, app store connect" }
ellipse boundary after rotation Assume I have this vertical ellipse with a certain major axis $a$ and minor axis $b$. !Not rotated If we take the center of the ellipse to be at $(0,0)$, then the top right small red circle will be at $(b,a)$. Then I rotate it (say by an arbitrary angle $\theta$) about its center: !Rotated My question is this: what is the new position of the top right small red circle in this new image after rotation relative to the fixed center? For example at $\theta=90^\circ$ its position will be $(a,b)$.
$$ r(t)=(a\,\cos (t), b\, \sin(t)) $$ After rotation, $$ r_2(t)=R_\theta.r(t)= (a\,cos(t)\cos(\theta)+b\sin(t)\sin(\theta),-a\,cos(t)\sin(\theta)+b\sin(t)\cos(\theta)) $$ So you need to find the maximum of $ a\,cos(t)\cos(\theta)+b\sin(t)\sin(\theta)$ and $-a\,cos(t)\sin(\theta)+b\sin(t)\cos(\theta)$. Can you do it?
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "conic sections" }
Anonymous function with a variable-length argument list Can I create an anonymous function that accepts a variable number of arguments? I have a struct array `S` with a certain field, say, `bar`, and I want to pass all the `bar` values to my anonymous function `foo`. Since the number of elements in struct `S` is unknown, `foo` must be able to accept a variable number of arguments. The closest thing that I've been able to come up with is passing a cell array as the input argument list: foo({arg1, arg2, arg3, ...}) and I'm invoking it with `foo({S.bar})`, but it looks very awkward. Creating a special m-file just for that seems like an overkill. Any other ideas?
Using `varargin` as the argument of the anonymous function, you can pass a variable number of inputs. For example: foo = @(varargin)fprintf('you provided %i arguments\n',length(varargin)) Usage s(1:4) = struct('bar',1); foo(s.bar) you provided 4 arguments
stackexchange-stackoverflow
{ "answer_score": 10, "question_score": 12, "tags": "matlab, anonymous function" }
Write a slow query to test slow query logging? Is there a simple query that would take > 2 sec so that I can test the slow query logger? I am looking for something like a generic recursive or iterative statement.
A simple query would be: SELECT SLEEP(2); You want to iterate it? DELIMITER $$ DROP FUNCTION IF EXISTS `iterateSleep` $$ CREATE FUNCTION `iterateSleep` (iterations INT) RETURNS INT DETERMINISTIC BEGIN DECLARE remainder INT; SET remainder = iterations; read_loop: LOOP IF remainder=0 THEN LEAVE read_loop; END IF; SELECT SLEEP(2) INTO @test; SET remainder = remainder - 1; END LOOP; RETURN iterations; END $$ DELIMITER ; -- TO TEST IT OUT mysql> SELECT iterateSleep(2); +-----------------+ | iterateSleep(2) | +-----------------+ | 2 | +-----------------+ 1 row in set (4.01 sec) Alternatively if you just want to test your slow_query_log, change 'long_query_time' to 0 (to log all queries): SET long_query_time=0;
stackexchange-dba
{ "answer_score": 28, "question_score": 20, "tags": "mysql, performance, slow log" }
Is visibility inverted between objects and modifiers? I copy and pasted a driver from a modifier's visibility buttons to an objects visibility buttons, but the resulting visibility is opposite for the object. As in, a driver value of 1 for the modifier results in visibility being true, and for the curve object the same driver value of 1 results in visibility being false. Is this intentional behavior, or is there something I am missing? It doesn't seem to be documented but maybe I missed it. The driver is working, moving the bone to get a driver value of 0 toggles both. ![Modifier Driver]( ![Object Driver](
Seems like the underlying variable is inverted. For modifiers its `.show_viewport` and for objects its `.hide_viewport`. Weird. ![.show_viewport]( ![.hide_viewport](
stackexchange-blender
{ "answer_score": 0, "question_score": 0, "tags": "rigging, drivers, visibility" }
Avoid R output leaking into LaTeX with ggnet Please consider the following MWE which I compile into a .tex document via `knitr` \documentclass{article} \begin{document} <<echo=FALSE, message=FALSE, warning=FALSE>>= library(igraph) library(GGally) library(network) library(sna) # Set up data set.seed(123) g <- barabasi.game(1000) # Plot data ggnet(g, weight.method = "indegree") @ \end{document} which inserts \begin{verbatim} ## 1000 nodes, weighted by indegree ## ## id indegree outdegree freeman ## 4 4 47 1 48 ## 12 12 37 1 38 ## 3 3 34 1 35 ## 13 13 32 1 33 ## 1 1 23 0 23 ## 11 11 19 1 20 \end{verbatim} in my .tex. How could I control it?
Try `results = 'hide'`: \documentclass{article} \begin{document} <<echo=FALSE, message=FALSE, warning=FALSE, results = 'hide'>>= library(igraph) library(GGally) library(network) library(sna) # Set up data set.seed(123) g <- barabasi.game(1000) # Plot data ggnet(g, weight.method = "indegree") @ \end{document}
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "r, knitr, tex, ggally" }
Using write.xlsx to write different data on different sheets in one file by for loop in r I am trying to write each country's data on each sheet named with that country in one `xlsx` file. I am using `xlsx` package in r. I have tried for (i in 1:noctry) { write.xlsx(tab110rev[i,,], file="table.xlsx", sheetName = countrylist[i], col.names=FALSE, row.names=FALSE) } `noctry` stands for number of countries and its 53 `countrylist` is a list of countries with country codes which are numbers. `tab110rev` is an array that has the structure of `array(value, c(country, industry, year))` The problem with this is that it only produces a `xlsx` file with just one sheet which contains the last country. There should be 53 sheets, not just one. I think the `for-loop` is overwriting instead of cumulating the result but I have no idea to fix this.
I guess `append = T` should fix your problem. Try this: for (i in 1:noctry) { write.xlsx(tab110rev[i,,], file="table.xlsx", sheetName = countrylist[i], col.names=FALSE, row.names=FALSE, append = T) }
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "r, for loop, xlsx" }
Does Clan Perk Effect Level Up War The clan level 3 perk is 10% extra loot from wars. Does this apply on the war that levels your clan up or does it come into effect the war after the level up?
The way clan perks work is a bit like 'WYSIWYG' (What You See Is What You Get); what I mean by that is that the 10% extra bonus loot is added in the figures you will see in wars. I'll explain: When you are in a war and check a base from the opponent side, you see how much war loot this base is worth. At clan level 2, let's say that you see 300,000 gold (usually standard early/mid TH8 base). This is exactly the loot you will get if you win the war, regardless of whether your clan level ups or not. At clan level 3, you would have actually seen 330,000 gold on the same base (the 10% already incorporated in the figures). So to answer your question, clan perks apply after the war that clan won enough exp to level up.
stackexchange-gaming
{ "answer_score": 6, "question_score": 5, "tags": "clash of clans" }
tail -n1 sometimes return last 2 lines I tried to create a bash script that read the last entry of a file that is constantly written to. For example: while true do echo $`date +%s` >> output.txt done However, `tail -n1 output.txt` sometimes return two lines instead of one. For example tail -n1 output.txt $1582329371 $1582329371 What would be the possible cause for this?
I used what Wiimm suggested tail -n1 output.txt | tail -n1 to solve the issue. Thanks
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "bash, shell" }
zend2 redirected value not getting in the another action of the same controller I am passing through this return $this->redirect()->toRoute('ModuleName',array('controller'=>$controllerName,'action' => $actionName,'params' =>$params)); param values is not getting is request parameters
the controller `redirect` plugin is not responsable for redirecting to another module. but you can redirect to a route that points in the configuration to another module/controller. `$this->redirect('route_name', $params, $options)` make sure that the redirect route is configured to receive your params. if you forward to current request to a other controller action in the same module use the `forward` controller plugin. <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "zend framework2" }
could there be any disadvantages to this kind of URL validation In some parts of my site, I'll allow users to enter an URL. I'm working on appengine, so what I was thinking, is to validate it like this. try response = urlfetch.fetch(url,follow_redirects=True, deadline=1) if not response.status_code==200: raise SomeCustomException except: Exception as e: my_exception_handling_code(e) advantages * checks for url pattern automatically * also makes sure that the url isn't broken and the loading time is no longer than 1s, helping to ensure a good user experience when clicking a link on my site. possible disadvantages I can see: * the request has to wait for the fetch to complete. This will probably not be a very big deal, as there are very few occasions where users can enter URL's (currently only on signup).
This is a bad idea. As S. Lott pointed, url might not be available now. Or it might be available only from some specific subnetwork. Or it gets more than 1 second to load it. Just don't do this. Use a traditional approach, e.g. `urlparse`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, google app engine, validation, urlfetch" }
Getting List of Objects by a type given by a string I get objects by IEnumerable<ObjectStateEntry> om = context.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Modified); How can I get a `List` of the objects with a type given by a string? Type typ = Type.GetType("mytype"); var om2 = om.Select(s => s.Entity).OfType<typ>(); // does not work
What you are trying to do cannot be done statically: `var` corresponds to the _static_ type of the expression, while the type of your expression on the right is clearly non-static (it's `IEnumerable<T>`, where `T` is not known before the runtime). This, however, is legal: var om2 = om.Select(s => s.Entity).Where(v => typ.IsInstanceOfType(v)); This would produce an `IEnumerable<ObjectStateEntry>`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "c#, entity framework, generics, types" }
Redirecting subdomain to ip:port You know how in computer programming, perfection is not even close to be perfect? Well, I have my server running on port 8080. I did the redirections needed with iptables to redirect 80 to 8080. So when i go to www.domain.com, it works well I have a second server running on port 8081. When i go to www.domain.com:8081, it works well. Everything works! But hey, remember my first rule... Now, I want to to access my second site by using www.sub.domain.com (or www.domain.com/sub, i don't care) Basically, I want www.sub.domain.com (or www.domain.com/sub) to redirect to www.domain.com:8081 From now, what I understand is that if I had a second IP on my server, it would be very easy. But it's not a good solution, because I could want to have like 100 subdomains, and I don't want to pay for this. Any thoughts?
I would suggest you to install a reverse proxy to your webserver. Apache and Nginx are supporting this; For instance, your webserver listens on port 80, and depending on the requested domain (in a serverblock for nginx, vhost for apache) you can ask him to internally redirect to a specific url:port. for apache: (see "Using Virtual_host and mod_proxy together") < for nginx: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "redirect, subdomain" }
Is it possible to get 3 elements in a string/list/array, the first two being consecutive and the third separated from them by a step? Given the array: import numpy as np arr = np.array(range(10)) print(arr) [0,1,2,3,4,5,6,7,8,9] is it possible to get in one single slice ex. arr[1:6:1] the numbers [1, 2, 5]? I've tried everything, from steps to multiple slicing, it seems I cannot get past the uneven step between the numbers. I'm pretty sure it's not possible, but if it is, I'd like to hear it since I wasted a few hours on this. Thanks in advance.
In numpy, you can directly pass a list of indeces instead of a slice object: arr[[1, 2, 5]] If there is an underlying pattern to those indeces you can use it to create the index list.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, arrays, numpy, numpy slicing" }
How to select top 1 based on 3 columns CarID Date Shift 1 2016-08-20 3 1 2016-08-21 1 1 2016-08-21 2 2 2016-08-20 1 3 2016-08-21 3 * * * Expected Result CarID Date Shift 1 2016-08-21 2 2 2016-08-20 1 3 2016-08-21 3 How to write such query to get the top 1 record of every car with the combination of max date and max shift?
You can use the ranking function `ROW_NUMBER`, for example in a CTE: WITH CTE AS ( SELECT RN = ROW_NUMBER() OVER (PARTITION BY CarID ORDER BY Date DESC, Shift DESC), * FROM dbo.TableName t ) SELECT * FROM CTE WHERE RN = 1
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "sql, sql server" }
Divergence or convergence of a sin series $$\sum_{n=1}^{\infty}\frac{n\sin(\frac{n\pi}{2})}{n^2+12}$$ Calc noob here. I have this series. From inputting the first few values I realize this is an alternating series. I also knew this as sin is alternating. From seeing the pattern I tried to solve this series by changing the sum to: $$\sum_{n=1}^{\infty}\frac{(2n-1)(-1)^{n+1}}{8n+5}$$ The first few values are: 1/13 - 3/21 + 5/37 - 7/61 +... I'm not sure if this is a valid move. I believe my second sum diverges. As we find from the series divergence test that the limit would not equal 0. Any help is appreciated!
$$\sum_{n=1}^\infty \frac{n\sin(\frac{\pi n}{2})}{n^2+12}=\sum_{n=0}^\infty \frac{(-1)^n(2n+1)}{(2n+1)^2+12}$$ The series converges by alternating series test.
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "sequences and series" }
Fade images in and out based on scroll position I'm trying to recreate the same effect used here: < where the images will fade in/out based on scroll position. I've had a look at the source and can see that "data-centre-centre" and "data-top-bottom" both have opacity values so it looks like a CSS transition? Thanks for the help anyway :)
For anyone interested, I ended up using skrollr.js < Super easy to use and works great if you're trying to achieve a similar effect to the one referenced in my original question.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, jquery, html, css" }
Understanding logical form of "Nobody in the calculus class is smarter than everybody in the discrete math class" I'm self studying `How to Prove` book and have been working out the following problem in which I have to analyze it to logical form: > Nobody in the calculus class is smarter than everybody in the discrete math class Now, this is how, I started solving it: > ¬(Somebody in the calculus class is smarter than everybody in the discrete math class) ¬(If x is in calculus class then x is smartert than everybody in the discrete maths class) C(x) = x is in calculus class. D(y) = y is in discrete class. S(x,y) = x is smarter than y ¬∃x(C(x) -> ∀y( D(y) ∧ S(x,y))) But this is the solution given in the Velleman's book: ¬∃x[C(x) ∧ ∀y(D(y) → S(x, y))] I cannot understand how that answer is correct. Can someone explain the thing I'm missing there ? * * * There is also a related question asked there but that doesn't discuss the Velleman's answer per se.
Your answer asserts that there does not exist anyone $x$, who, iF $x$ is in Calculus, then (all students y are both in Discrete math and x is smarter than them.) This is clearly not what is conveyed in the original statement. What we need, essentially, is "There does not exist someone $x$ who is enrolled in Calculus AND such that, for all students y, if y is enrolled in Discrete math, then x is smarter than y. $$\lnot \exists x\Big(C(x) \land \forall y(D(x) \rightarrow S(x, y))\Big)$$
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "logic, propositional calculus, quantifiers" }
Adding "Lookup in the dictionary" in the pop-up list in Firefox? Is it possible to add the item "Look up in Dictionary" in the right-click popup menu when you have selected a word on a web page, in Firefox (just like it is available in safari) ? !safari's screen shot
There is a firefox addon to add this in the context menu: <
stackexchange-apple
{ "answer_score": 3, "question_score": 2, "tags": "safari, firefox" }
How to change language settings in R My error messages are displayed in French. How can I change my system language setting so the error messages will be displayed in English?
You can set this using the `Sys.setenv()` function. My R session defaults to English, so I'll set it to French and then back again: > Sys.setenv(LANG = "fr") > 2 + x Erreur : objet 'x' introuvable > Sys.setenv(LANG = "en") > 2 + x Error: object 'x' not found A list of the abbreviations can be found here. `Sys.getenv()` gives you a list of all the environment variables that are set.
stackexchange-stackoverflow
{ "answer_score": 171, "question_score": 150, "tags": "r" }
Acceder a una etiqueta dentro de una clase Hola quiero acceder a una etiqueta que esta dentro de una clase: <h2 class="easylogo"> <a href="/" title="Imagen"> <span style="line-height:0" class="none"> <img src="imagen.com" alt="Imagen"> </span> </a> </h2> Como puedo modificar el estilo de la imagen, estoy trabajando en Wordpress y me da la opcion de añadir el CSS adicional, entonces quiero saber como acceder al estilo de esa imagen. con: img{} Modifico todas las imagenes, pero no quiero modificar todas las imagenes solo esta, entonces como puedo lograrlo?
Hay varias formas de hacerlo, una sería como lo siguiente: h2.easylogo img{ /* Aquí tus estilos */ }
stackexchange-es_stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "css" }
Custom DNS Server for dynamic TXT Records I am trying to do something DNS isn't really meant for, so I won't be surprised if this isn't possible. I have a domain, and I've set up an NS record, so I can resolve queries for subdomains using my own server. I need to dynamically generate TXT records based on what subdomain is being resolved. Is this possible, and if so, what library/software can I use? I'd prefer Python, but any language works.
I ended up using a PowerDNS pipe, written in bash, based on xip.io's source code.
stackexchange-softwarerecs
{ "answer_score": 1, "question_score": 0, "tags": "python, dns" }
How to know a certain row exists MySQL I want to prevent users from commenting on deleted threads. I've set a variable (let's call it 'tnum') to identify the original thread and its comments, so I can display them in a same web page. When I delete a thread, the original thread and all comments get deleted at once (delete from ~ where tnum is ~) So I think I can prevent comment submission on deleted threads using that. I want to put out an error message when there is no row in table with certain tnum value. if( 'some code' ) { error("There is no data for the thread."); } Could someone help me with this? Thanks.
You can use COUNT() in MySQL to get the number of rows that match your criteria. So something like this $db = new PDO( /* connection details */ ); $sth = $db->prepare( 'SELECT COUNT(*) AS numRows FROM `table` WHERE tnum = :tnum' ); $sth->execute( array( 'tnum' => $tnum ) ); $result = $sth->fetchAll(); if( $result['numRows'] == 0 ) { error("There is no data for the thread."); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, mysql, database, if statement" }
Using the command "id" in Linux? I have some doubts with the use of the command _id_ in Linux... I have added one user(andre) to the group "github-total", do if I do _id andre_ I got: $ id andre uid=500(andre) gid=500(andre) groups=500(andre),502(github-total) context=user_u:system_r:unconfined_t But if I do only _id_ : $ id uid=500(andre) gid=500(andre) groups=500(andre) context=user_u:system_r:unconfined_t The thing is that the user "andre" is not assuming that he is in the group "github-total" when I run only _id_ without argument. And in reality the user is not in the group. So my question is... How can I add the user "andre" to the group "github-total"? Best Regards, Sorry my english.
The reason is that you made the change but haven't logged out / logged back in again. When you run id with no arguments, it prints the data inherited from the parent shell, which established the group IDs after it consulted the databases after login. When you run id with a username, it instantly queries the databases to see what that user's group id information is. So... to directly answer your question, logout then log back in. :-)
stackexchange-superuser
{ "answer_score": 8, "question_score": 3, "tags": "permissions, user accounts, file permissions, group policy, acl" }
What is wrong with this clear timeout? It's not working for some reason (in coffeescript) afunction = () -> window.clearTimeout(timeoutID) $(".x").text("#{message}").addClass("y") timeoutID = window.setTimeout (-> $(".x").removeClass("y") ), 4000
`timeoutID` is a local variable, so each time you call the method, `timeoutID` starts off undefined.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "javascript, coffeescript" }
Cheapest FPGA PCIe board for Software Acceleration This question is somewhat related to an earlier question: Cheapest FPGA's. I have been searching for a cheap FPGA board with PCI express 2.0 or 3.x support. Such boards can be plugged in one of the compatible PCIe slot on a motherboard, and can be programmed using either HDL entry or OpenCL or C/C++ based HLS tools. In order to facilitate data transfer between CPU DDR and FPGA DDR memory, the board comes with programmable DMA controllers. There is a company which sells such boards(Nallatech), but the starting board prices are just too high (> 5000 USD). Then there are FPGA PCIe boards sold by Xilinx and Altera with minimum 1300 USD price. But all these are still too expensive for me. **Can someone recommend a cheaper FPGA board from Xilinx/Altera with a PCIe 2.0 or 3.x support ?**.
You could look around for an old ML506 or ML507 from Xilinx, but really $1300 is a reasonable price for these boards. There is one other option I can think of: the Raggedstone 2 from Enterpoint, at prices from about $400 upwards according to the FPGA (Spartan-6, different sizes). They have a range of other options with up to 25 FPGAs, but probably outside your price range
stackexchange-electronics
{ "answer_score": 2, "question_score": 1, "tags": "fpga, vhdl, verilog, board, pcie" }
Do IC's in DIP sockets require an extraction tool? Am I correct in that the IC extraction is used to extract an IC from a DIP socket for swap/extraction in a safe manner? Or is it used for something else? I doubt I will need this behaviour, however if I damage the socket it is worth a few dollars to own such a tool.
If there is adequate clearance, a typical screwdriver will work very nicely for removing DIPs from sockets. Insert the blade between the socket and the chip (not under the socket!), then twist gently in alternate directions to raise the two sides of the chip. Apply gentle pressure on the side of the chip opposite the side being raised, near the corner where the screwdriver is being used, to ensure that both ends of the chip rise by about the same amount. One "tool" that's even better than a screwdriver, though I'm not sure where you can find one, is the L-shaped metal piece from an old-style PC case which screwed in to cover up the holes where I/O cards go. Not sure how best to describe it. Old-style PC cases are a bit hard to find these days, though. BTW, I've yet to find a chip extractor tool that worked better on DIPs than the above-mentioned PC case piece.
stackexchange-electronics
{ "answer_score": 9, "question_score": 6, "tags": "integrated circuit, tools, dip" }
Lipschitz constant and operator norm of derivative in Hilbert spaces Let $f:X \to Y$ be a mapping between Hilbert spaces satisfying $$\frac{f(x+th)-f(x)}{t} \to f'(x)(h)$$ as $t \to 0$, i.e., $f$ is directionally differentiable. If $f$ is known to be Lipschitz with Lipschitz constant $L$, is it true that $$L = \lVert{f'(x)}\rVert_{\text{operator}}$$ ?
The equality $L = \lVert{f'(x)}\rVert_{\text{operator}}$ does not look plausible, considering the right hand side involves $x$ while the left hand side does not. The correct statement is $$L = \sup_{x\in X} \lVert{ f'(x) }\rVert_{\text{operator}}$$ Indeed, the inequality $\ge $ follows from $$\|f'(t)h\| = \lim_{t\to 0} \frac{\|f(x+th)-f(x)\|}{|t|} \le \frac{L \|th\|}{|t|} = L\|h\|$$ For the reverse inequality, let $M=\sup_{x\in X} \lVert{ f'(x) }\rVert_{\text{operator}}$. Let $\varphi$ be any unit-norm functional on $X$. It suffices to prove that the composition $g = \varphi\circ f$ is $M$-Lipschitz. Let $a,b\in X$ be distinct points, and consider the restriction of $g$ to the line segment $[a,b]$. This is a scalar function of a scalar argument, whose derivative is bounded by $M$. The mean value theorem yields $|g(a)-g(b)|\le M|a-b|$, which proves the claim. **Remark** : This works for any pair of normed spaces, they don't have to be Hilbert spaces.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "derivatives, hilbert spaces, lipschitz functions" }
Load component to router-outlet without declaring it in any module I just noticed that I can use a component without declaring in any module it as long as it has its own route. So, is it correct to remove all the directly routed components from the declarations array? Is this new behavior in angular or maybe I just don't remember correctly. You can see in my stackblitz that the "cat" component is not declared but still loading on the button click.
Possible duplicate of this Seems like: router-outlet will auto generate component by ComponentFactoryResolver In other words below will throw error if you access without declaring: <app-cats> </app-cats>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "angular, angular routing" }
How to remove AddressBook book-like interface or enable debug menu? I wish to get rid of the Lion 10.7.5 AddressBook book-like interface a.k.a. leather appearance a.k.a. skeuomorphic design. Usually this kind of setting can be change from the debug menu. However `$ defaults write com.apple.AddressBook ABShowDebugMenu -bool true` does not enable the debug menu in AddressBook. How to enable this debug menu or make addresbook look like 10.6 Addressbook?
This osxdaily.com post let me to LionTweaks utility to do the job. It seems that LionTweaks launches installers that are originally from macnix.blogspot.nl. LionTweaks version 2.0.2 on 10.7.5 give me back the old aluminium/grey/10.6 look for iCal although the top text has a yellow/brownish shade. Address book becomes grey but still feels like the 10.7 address* _book_ *.
stackexchange-apple
{ "answer_score": 0, "question_score": 0, "tags": "macos, contacts, ui" }
Why Cubes falls through the floor but Player sphere dose not? Start passing first tutorial "Roll-a-Ball", and at the stage #3 "Collecting, Scoring and Building the game", I saw an interesting thing without explanation: Both "Player" and "Pick Up" have "Rigid Body component attached" and have Use Gravity checkbox selected. But "Player" sphere dose not falls thought "Ground" mesh, but "Pick Up" cubes dose. Why it happens? here is moment in video: <
The `BoxCollider` on the pick up prefab is marked as a trigger (i.e. `IsTrigger` is set to `true`). A trigger collider behaves as a _volume or space_ in the world, unlike regular colliders which represent an actual physical entity. A trigger collider does not interact with the world, but raises events when a `Rigidbody` enters/exits/stays in the volume in the world represented by it.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "unity3d" }
WCF Client error using 'Basic128Sha256Rsa15' I get the following error when moving from using SHA1 to SHA256 encryption via my WCF client-side config file. This is for a .NET 3.5 client running on a Windows 2003 server. I've implemented changes related to using SHA256 for SAML data found here Snippet from my app.config: <customBinding> <binding name="HAServiceBrokerSOAP11BindingHewitt"> <security defaultAlgorithmSuite="Basic128Sha256Rsa15" Error message I receive in client error log: System.InvalidOperationException: The binding ('CustomBinding', '< has been configured with a security algorithm suite 'Basic128Sha256Rsa15' that is not supported
I finally got things working. I'll post my resolution in case others land here via a search. One thing I tried that didn't work for me but may work for someone else is to use the Common Language Runtime version 4.0. CLR version 2.0 is what is used with .NET 3.5 assemblies. Here are the lines I added to my config file just after the element:   <startup useLegacyV2RuntimeActivationPolicy="true">         <supportedRuntime version="v4.0"/>         <supportedRuntime version="v2.0.50727"/>    </startup> What finally worked for me was to upgrade the code from VS 2008 .NET 3.5 to VS 2010 .NET 4.0 and recompile the entire assembly. .NET 4.0 is not supported in VS 2008. .NET 4.0 assemblies use the CLR 4.0 version.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wcf, sha256" }
How to remove the selected value from the array using jquery I want to remove particular value from the array. I have written code like: $(".remove", document.getElementById("TXT")).live("click", function () { $(this).parent().remove(); var removeitem = $(this).parent().attr('id'); pushvar.splice($.inArray(removeitem, pushvar), 1); }); In the above code `pushvar` is an array. Suppose if it contains 3 elements.The function will repeat for three times when we click on one of the remove button. For eg the `pushvar` contains `[5,6,7]` elements. If i click on the remove button of 6. Then the function will repeat for three times. But the pushvar.splice($.inArray(removeitem, pushvar), 1); will remove all the three elements. But i want to remove only 6 from the array when i click on remove class. How can i do this.
Try this: $(".remove", document.getElementById("TXT")).live("click", function () { $(this).parent().remove(); var removeitem = $(this).parent().attr('id'); if ($.inArray(removeitem, pushvar) > 0) pushvar.splice($.inArray(removeitem, pushvar), 1); });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "javascript, jquery, jquery ui" }
XSLT Leave start and end tags I have an xml structure similar to this. <outer> <inner>text</inner> <inner2>text2</inner2> </outer> I want it to look like this, leaving the start and end tags. <outer> <inner></inner> <inner2></inner2> </outer> This is the current xsl that I am using <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="text()"/> Leaving me with <outer> </inner> </inner2> </outer> How would I get both the start and end tags?
I would expect that XSLT to give you <outer> <inner/> <inner2/> </outer> Which is the correct result as it's exactly the same XML as <outer> <inner></inner> <inner2></inner2> </outer> Within XSLT there's no way to control which of the two equivalent representations the final serializer will use to represent the output tree. There may be processor-specific ways to influence it, depending what processor you're using, but generally it doesn't matter as XML tools will treat both forms the same.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "xml, xslt" }
Does the combination of the Blinded and Deafened status effects make other creatures effectively hidden? If an item and or attack power in 4e gives a creature both the blinded and deafened status effects and the creature has no alternative senses (blind sight, tremor sight) is it mechanically accurate to treat all other creatures as hidden from the blinded and deafened creature?
The **blinded** condition doesn't do that. > ## Blinded > > * The creature can’t see, which means its targets have total concealment against it. > * The creature takes a -10 penalty to Perception checks. > * The creature grants combat advantage. > * The creature can’t flank. > > > A blinded creature cannot have combat advantage against anyone. (RC229) **People can hide anywhere from the blinded creature (since they have total concealment) but they're not automatically hidden.** If they do hide, there's a -10 penalty to the Perception check to find them. The only effect of the deafened condition is an additional -10 penalty to Perception (it is not total deafness) (RC230). If the enemies don't hide, only a -5 to the blinded character's attack roll (for total concealment) applies. For further reference, the Rules of Hidden Club might be useful.
stackexchange-rpg
{ "answer_score": 12, "question_score": 11, "tags": "dnd 4e, conditions, stealth" }
Can I give other players powertools? Can I give other players the use of powertools via the Essentials plugin for Bukkit? Not the command (`/powertool`), but the ability to use an item as a powertool. **Ex:** I assign the use of `/spawn` to a compass for PlayerA. However, he can not assign powertools to himself, he is only able to use the powertools assigned to him by other players.
You'll need to give them the `essentials.powertool` permission, as documented on the Command Reference Page.
stackexchange-gaming
{ "answer_score": 2, "question_score": 2, "tags": "minecraft java edition, minecraft commands, minecraft bukkit" }
Use of personal pronouns when talking to different "ranked" people. (In the same conversation) First time posting here. I have a question that have been bothering me for quite a while. I wonder how to use the personal pronouns (/ & //) in a conversation with different "ranked" people. In the same conversation. Let me put it in a made up example, and let's just say I am talking to my best friend (which to whom I would use for myself and to my friend) and a teacher that we both respect (which to whom I would use for myself and [or his/her name] to the teacher). Can the japanese pronouns be mixed depending on who you are talking to in the one conversation or should I just stick to the formal pronouns? I know that you can skip the formal verb and sentence endings when talking to the friend but should I also stick to one pronoun instead of changing back and forth? Hope I didn't make the question too complicated and thanks in advance!
I believe it is never wrong to be too respectful. Thus, if it was me I would stick to the more humble first-person pronouns to both your friend and your teacher, i.e. I'd address myself as or . I think it is fine to call your friend if you are obviously talking to your friend in a sentence, and address your teacher by , but I'd avoid using at all if a teacher is present (might sound a bit too rude). I'm not totally sure about this, and this is just what I think what I would do in this situation.
stackexchange-japanese
{ "answer_score": 1, "question_score": 2, "tags": "word choice, formality, pronouns, first person pronouns, second person pronouns" }
Creating A new class in CSS that applies to HTML You have no access to I was wondering is it possible to add a new class using CSS to HTML you dont have access to? I am working with a survey programme and i can only create custom CSS but i need to separate two divs by giving them different classes. I know this is obviously possible but Is this possible in CSS without access to the HTML file?
You cannot add classes to html with css. What you can do is select elements you want to style not by class but by type name in combination with parent containers types if needed.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css, frontend" }
How do I register type in code using MEF? I have a custom type instance that needs to be registered in code: container.RegisterType( typeof(Isome), myvar); so it can be used normally like this: [Import] ISome var1 ; How do I get a reference to the container?
I don't know about Prism, but in MEF you don't register types with the container - that introduces a dependency that defeats the purpose of decoupling the code. What you do to make the `ISome` type available for MEF to discover is you put an `[Export(typeof(ISome))]` attribute on your class that implements the `ISome` interface. In composition, MEF will see the Import attribute keyed on the ISome interface type, then go looking for a matching Export keyed on the ISome interface type. It will find your implementation class with the Export attribute. MEF will create an instance of the exported class and assign it to the import property for you. In the composition step, you need to provide a catalog of types or assemblies for MEF to load and do its matchmaking magic. Make sure the assembly that contains your implementation class is in that catalog group.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "c#, .net, dependency injection, prism, mef" }
What happens when I reset the call statistics on an iPhone? I have an iPhone 4. Under Settings > General > Usage, there is a button to "Reset Statistics". After reading the manual, I'm not clear on one point: if I reset the statistics, will the entry under "Call Time: Lifetime" also be reset?
After a quick test, everything but "Call Time: Lifetime" and the statistics under "Time since last full charge" was reset. It only makes sense that the field "Call Time: Lifetime" doesn't get reset since it shows the the total physical time the phone was being used to call. If it was restored and set up as a new phone I believe that the setting will then be reset since it will be technically a new life for the phone. Unless AT&T/Verizon keeps track of that data through your number. Then you would change your number to reset that field. Though I wouldn't be trying that anytime soon.
stackexchange-apple
{ "answer_score": 3, "question_score": 2, "tags": "iphone" }
Proving something is NOT a tensor I need to show that $\frac{\partial}{\partial x^i}v^{j}(x)$ is not a tensor. Here $v^i(x)$ is a vector field. I tried writing down the tensor transformation like this: $$\frac{\partial}{\partial{x'^{i'}}}v'^{j'}(x')=\frac{\partial x^i}{\partial x'^{i'}} \frac{\partial x'^{j'}}{\partial x^j} \frac{\partial}{\partial x^i}v^{j}(x)$$ And thus I think this looks like a tensor transformation is supposed to look. I've likely done something incorrectly, could someone please give me a hint here on what I'm doing wrong?
What you went wrong is that you don't write the derivation correctly. What you must do is this $$ \frac{\partial v^{j'}}{\partial x^{i'}} = \frac{\partial}{\partial x^{i'}} v^{j'} = \underbrace{\frac{\partial x^i}{\partial x^{i'}} \frac{\partial}{\partial x^i}}_\text{by chain rule} \underbrace{\Bigg( \frac{\partial x^{j'}}{\partial x^j} v^j \Bigg) }_\text{by transf.rule for $v^{j'}$} = \dots (\text{proceed}) $$ which is by chain rule and tensor transformation rule $\textbf{for}$ $v^{j'}$. Proceed by yourself and find out why its not a tensor.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "mathematical physics, tensors, general relativity, index notation" }
Shell script to loop over files with same names but different extensions For example say I have: filename1.ext1 filename1.ext2 filename2.ext1 filename2.ext2 I need to write a shell script to feed these files into a program like so: program filename1.ext1 filename1.ext2 program filename2.ext1 filename2.ext2 Additionally the `.ext1` files must be entered first and the `.ext2` files second. Any help would be appreciated.
anubhava's solution is excellent if, as they do in your example, the extensions sort into the right order. For the more general case, where sorting cannot be relied upon, we can specify the argument order explicitly: for f in *.ext1 do program "$f" "${f%.ext1}.ext2" done This will work even if the filenames have spaces or other difficult characters in them.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "linux, bash, shell" }
Is there an easy way to convert 11.04 wubi install to a new partititon with no drawback? I have a wubi install that is running great. Some of the setup though is pretty time intensive, and I didn't realize that WUBI was only meant for testing - I thought it would be equally as good as the regular installation :( So, I'd like to transfer my entire installation and move it to a new partition - with new swap partition and all. Is there an easy way to do that? I tried looking at lvpm (or lpvm.. i forget), but Ubuntu 11.04 complains that it is low quality software. Is it safe? Should I just install a fresh copy of 11.04 anyway? What are the drawbacks to using something like lvpm? Should I just keep the wubi installation and not care? Thanks
LVPM is by the same people who did wubi, It worked fine before, but apparently dosen't work with newer versions \- which is probably why ubuntu complains about it. If you REALLY need to be able to suspend/resume or something else ubuntu needs, switch over to a real partition. Else, really, if it works, there's no need to fix it, IMO You can probably reinstall ubuntu fresh, and move over your home directory if you really want a physical install of it.
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "ubuntu, installation, conversion, migration, wubi" }
update virtual host's SSL cert after cpanel has expired I had setup the server, virtual hosts via cpanel. I didnt renew my cpanel subscription because I no longer needed it. Now my SSL certificate has expired. I have SSH access to the server. How do I update the certificate without subscribing to cpanel just to renew the certificate? **What I have tried:** 1. Replace the keys and certs in the user's home directory. 2. update using whmapi1, but that says cannot read license.
If someone has a better answer, please post it. But here's how I was able to achieve it: 1. Goto `/var/cpanel/ssl/apache_tls/` 2. You will see a directory for each of your virtual host. 3. Inside each directory, there is a `certificates` file and a `combined` file. There are also `.cache` files for both. 4. Edit the certificate file, and put your certificate in place of the expired ones. 5. Edit the combined file, and put your key and certificate in place of the expired ones. 6. Rebuild the ssl.db for all users using `/scripts/rebuildinstalledssldb` 7. Delete the `.cache` files (not sure if necessary) 8. Restart apache2 using `systemctl restart httpd`
stackexchange-webmasters
{ "answer_score": 1, "question_score": 1, "tags": "apache, cpanel, security certificate, httpd.conf" }
What determines who texts me in Hawaii? I'm now nearing the end of my NG+ run and I just got back from Hawaii (in-game). > On the last night of the school trip, you get a text from a girl about spending time on the beach together after Ryuji invites you to find girls since he struck out earlier. My first playthrough, I received a text from Makoto, who I think was my highest ranked Confidant at the time, so that made sense. However, this time around, I've maxed both Ann and Makoto's Confidant ranks, while Hifumi was only at 7, yet Hifumi was the only one who texted me. What determines who you get a text from? It looks like only one girl will text you.
Apparently, it's possible for multiple girls to contact you for this date (though it never happened for me, strangely). This can be seen in this video. ![all date options]( There are requirements that must be met for any of these girls to contact you, which can be found here: > Here are the conditions for events during the Hawaii trip. > > * Ryuji: none > * Makoto: rank 5 or higher > * Ann: rank 9 or higher, romance > * Kawakami: rank MAX, romance > * Hifumi: rank 5 or higher > Considering I wasn't romancing Ann or Kawakami at the time, this lines up with them not contacting me, despite having reached max rank with Ann. As for Makoto, I may not have been invited by her because I'd declined her romance already. Otherwise, this seems to check out.
stackexchange-gaming
{ "answer_score": 0, "question_score": 4, "tags": "persona 5" }
how can use $categoryId in function here, I am generating **dynamic column** in **yii2 GridView** $gridColumns = []; $gridColumns[] = [ 'class' => 'yii\grid\SerialColumn', 'contentOptions' => ['width' => 10], ]; foreach ($CategoryList as $categoryId => $categoryName) { $gridColumns[] = [ 'label' => $categoryName, 'value' => function($model) { return $categoryId; <---- categoryId use in function } ]; } GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumns, ]); how can i use categorId in gridView Closure function every column has unique $categoryId like 1,2,3 accroding to loop
foreach ($CategoryList as $categoryId => $categoryName) { $categoryIdVariable = "$categoryId"; <---- store value in a variable $$categoryIdVariable = $categoryIdVariable; <---- store variable in another variable $gridColumns[] = [ 'label' => $categoryName, 'value' => function($model) use($categoryIdVariable) { <---- and use it like a string variable $categoryId = $categoryIdVariable; return $categoryId; <---- dynamic categoryId use in function } ]; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "gridview, yii2, yii2 advanced app" }
How can I make a Flatlist not scrollable in ReactNative I would like to know can I make a flatlist not scrollable for a moment. For example: there is a boolean constant that whenever is true, you can scroll the flatlist but whenever is false, how can I make it so that it can not be scrolled?
The FlatList inherits props of ScrollView according to docs, so it should have `scrollEnabled` prop ScrollView props and try setting it up as: scrollEnabled={ false } in your FlatList props.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "react native, react native flatlist, scrollable" }
Why when making a sphere child of a cube the sphere is losing his shape? When I drag to the scene a new sphere it looks like a ball a rounded ball. When I drag the sphere to be a child in this case of a cube the sphere looks like ellipse. ![Sphere one is not child the light blue is child]( Is there any way to fix it ?
Make sure the cube, or any parent of the cube, is scaled to (1,1,1). Otherwise, any children -- in your case the sphere -- will get scaled along with the parent and warped.
stackexchange-gamedev
{ "answer_score": 0, "question_score": 0, "tags": "unity" }
Applying chain rule in $f(x)=\sin(x)\cdot x\ln(x)$ > Can we apply chain rule in function > $f(x)= \sin(x)\cdot x\ln(x)$ What i try:: Chain rule $$\frac{d}{dx}\bigg(f(g(x)\bigg)=f'(g(x))\cdot g'(x)$$ So $$\frac{d}{dx}\bigg(\sin (x)\cdot x\ln(x)\bigg)=\sin(x)\cdot \frac{d}{dx}\bigg(x\ln(x)\bigg)+x\ln(x)\frac{d}{dx}(\sin x)$$ I have seems that we can not apply chain rule Here. Please conform me whether i am right or not. Thanks
You are correct, this is just applying the product rule twice. What is the derivative of $x\ln(x)$?
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "derivatives" }
Is PCI x16 and PCI Express 2.1 same? My Motherboard is Gigabyte GA-MA74GMT-S2. It is written that PCI slots are 1 x PCI Express x16 slot, running at x16 1 x PCI Express x1 slot 2 x PCI slots And I see one Graphic Card which is of following configuration. Bus Standard PCI Express 2.1 Model ID Radeon HD 5450 Is this Graphic Card compatible with my motherboard?
Yes, read this PCI Express® based PC is required with one X16 lane graphics slot available on the motherboard
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "windows 8, motherboard, amd radeon, pci" }
Extending a controller's specific functions I have controller (say `BaseCtrl`) that has a number of functions attached to it. I want to extend `BaseCtrl` to other controllers that shares some of its functions, however, I only need a function or two (and not all of `BaseCtrl`'s functions). I already saw some posts that demonstrates how to extend a controller, but I wonder if it's possible to extend specific functions only and how to do it?
Extending my comment: app.controller('parentCtrl', function($scope,$rootscope) { $rootscope.myPerent = function () { //your code } }); app.controller('childCtrl', function($scope,$rootscope) { $scope.ourPerent = function () { $rootscope.myPerent(); } });
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "angularjs" }
Deploying multiple satellites from one second stage I’m just watching the Iridium-6/GRACE-FO launch from SpaceX. Before the launch they showed a video of the Iridium satellite network and in this mission they deployed 5 additional satellites into LEO. They are at 500km altitude and moving at 27000km/h. They deploy one satellite from the second stage and then wait 100 seconds for each subsequent satellite deployment. But... surely each satellite is still moving at that release speed and in the same direction. So are all of these satellites going to be orbiting in a tiny group all nestled together? That doesn’t seem right...? How does this deployment pattern end up with a spread out network of satellites? I guess they don’t have enough propulsion on board to significantly alter their orbit? Or do they?
While significant orbital changes generally require a lot of propellant, it takes very little propulsion to move to a different relative position along the same orbital path. To advance ahead of your sibling satellite, you burn retrograde (counterintuitively) briefly, which lowers the opposite side of your orbit, making the orbital ellipse smaller and faster. One complete orbit after the burn, you're back where you made the burn, but you've gotten there faster than your sibling did. You then perform a burn opposite to the one you started with, that is, prograde, and you're back on the same path, just further ahead of where you would have been. If you want to be further ahead still, you just wait several orbits before making the counter burn. You can make the initial burn arbitrarily small if you're willing to wait a long time to take your final relative position.
stackexchange-space
{ "answer_score": 9, "question_score": 10, "tags": "spacex, orbital mechanics, iridium" }
what is the difference between callback function as an parameter and callback keyword as an parameter? i am confused in the following two code: **1.** `MyModel.update({ age: { $gt: 18 } }, { oldEnough: true }, callback);` **2.** MyModel.update({ age: { $gt: 18 } },{ oldEnough: true }, function (err,numberAff, raw){ if (err) return handleError(err); }); in first code `callback` is passing as an parameter and in 2nd callback function is using as an parameter.what the `callback` represent in first code ?
In the first code `callback` is the name of a function defined elsewhere. The second code is about the same as function callback(err,numberAff, raw){ if (err) return handleError(err); } MyModel.update({ age: { $gt: 18 } },{ oldEnough: true }, callback);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "node.js, mongoose" }
How to disable GPU in keras with tensorflow? I want to compare processing time of my code with and without gpu. My backend of keras is Tensorflow. So it uses a GPU automatically. I use a model of `keras/examples/mnist_mlp.py` for comparing. I checked the processing time like below. Then, how do I disable my GPU? Should `~/.keras/keras.json` be modified? $ time python mnist_mlp.py Test loss: 0.109761892007 Test accuracy: 0.9832 python mnist_mlp.py 38.22s user 3.18s system 162% cpu 25.543 total
Have you tried something like this? : $ CUDA_VISIBLE_DEVICES='' time python mnist_mlp.py `CUDA_VISIBLE_DEVICES` is usually used to hide some GPU's to cuda. Here you hide them all as you don't put any visible device.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 11, "tags": "tensorflow, keras, deep learning, gpu, nvidia" }
Run a task on localhost only once I have a playbook which will be run on many servers (say ten). The first three tasks will be run on the remote servers. The last task of merging is done on localhost (Ansible controller). When I run this playbook, the merging is happening each time (i.e.: ten times). I want to do the merging task only one time, once all the above tasks are completed on all servers. --- - name: Find the location debug: - name: Extract details debug: - name: Create csv file debug: - name: Merge files debug: delegate_to: localhost
Create a block containing 'Find', 'Extract', 'Create' that runs on remote servers. Another block containing 'Merge' that runs only on localhost. The preferred way is to create a role for the first block, another role for second and use it in playbook: - hosts: all roles: - find_extract_create - hosts: localhost roles: - merge
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "ansible" }
How to read file in Node? I want to read file but if file not available on particular path than gives an error.I want to create a file if not exist and get data value is null. I used these code but not working please any one help me? fs.readFile(path, 'utf8', function (err,data) { if (err) { return console.log(err); //Here throw error if not available } console.log(data); fileData = data; }); I used below code it's also not working.I want read all data from file what should i put on '?' in following code? fs.open(path, 'w+', function(err, data) { if (err) { console.log("ERROR !! " +err); } else { fs.read(data, ? , 0, ? , null, function(err) { if (err) console.log("ERROR !! " +err); }); } });
if(fs.existsSync(file_path)) { var file_content = fs.readFileSync(file_path, 'utf-8'); } else { var file_content = fs.writeFileSync(file_path, ''); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, node.js, file" }
WebApi - why is my post variable always null? I'd like to be able to read a post variable from my controller method. I currently have the below code: [HttpPost] public IHttpActionResult BuildPartitions([FromBody]string PartitionBuildDate) { } I'm using the below code to test: using (HttpClient httpClient = new HttpClient()) { var values = new Dictionary<string, string> { { "PartitionBuildDate", "24-May-2017" } }; var content = new FormUrlEncodedContent(values); var response = httpClient.PostAsync(" content); var responseString = response.Result.Content; } Looking online, this looks correct for both sending and receiving a post variable in C#, however the PartitionBuildDate variable is always null.
Try adding the `content-type` header. I have used Newtonsoft JSON.NET for JSON conversion: string postBody = JsonConvert.SerializeObject(yourDictionary); var response = client.PostAsync(url, new StringContent(postBody, Encoding.UTF8, "application/json")); var responseString = response.Result.Content; Also, on your web API side, try wrapping your POST parameters inside a class: public class PostParameters { public string PartitionBuildDate {get;set;} } [HttpPost] public IHttpActionResult BuildPartitions([FromBody]PostParameters parameters) { //you can access parameters.PartitionBuildDate }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net web api2" }
Merge UV changes from .fbx file back into Maya I am trying to export a `FBX` model from Maya, modify some of the UVs externally, and then reimporting it back to Maya, replacing just the portions that have been changed. To export: cmds.file(myFile, type='FBX', exportSelected=True, lf=False, f=True) To import: cmds.file(myFile, i=True, type='FBX', ra=True, mnc=True, pr=True, lf=False, f=True) However, after running the commands, nothing changed within the scene. How do I merge and overwrite the current scene with the new changes?
Instead of this: import maya.cmds as cmds cmds.file(myFile, typ='FBX', es=True, lf=False, f=True) Your options need to be passed via MEL evals if you’re using Python: import maya.mel as mel mel.eval('FBXResetExport; FBXExportInputConnections -v false; FBXExportBakeComplexAnimation -v true; FBXExportLights -v false; FBXExportCameras -v false; FBXExportInAscii -v true; FBXExportFileVersion FBX201200; FBXExportSmoothingGroups -v false; FBXExportSmoothMesh -v false; FBXExportApplyConstantKeyReducer -v false; FBXExportBakeComplexAnimation -v true; FBXExportBakeComplexStep -v 1; FBXExportCameras -v false;’ ) **P.S. This is an example how your code might look like**.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, maya, mel" }
Is it correct to use unset($form['#token']); In my Drupal 7 site, form submit throws the following error: > The form has become outdated. Copy any unsaved work in the form below and then reload this page. Is it correct to use `unset($form['#token'])` to resolve that error?
A big **NO** would be the answer but I think you guessed that already. Form tokens are an important piece of security, insuring your form has not been forged by some script/bot and helps preventing malicious attacks. You can find some more information on drupal.org about it but consider it as a _must-have_ or _should-not-remove_ feature of you prefer. If you have an issue with a form submit, you have probably hacked the form too much and should identify which part of your code has generated this error (some module might be in fault as well). Post an issue about this specific part but unsetting `$form['#token']` is not a viable solution.
stackexchange-drupal
{ "answer_score": 2, "question_score": -2, "tags": "forms" }
Is it true that football World cup trophy is always changed, when a country wins it 3 times? When in 1970 Brazil wins Jules Rimet Trophy for the third time, then for the next world cup in 1974 the trophy is new - so called FIFA World Cup Trophy. Since then Germany has won the cup 3 times, the last in 2014. Should we expect a new World Cup trophy or this is just a rumour?
This is untrue. Quoting from FIFA's page about the trophy: > The original FIFA World Cup Trophy cannot be won outright anymore, as the new regulations state that it shall remain in FIFA's possession.
stackexchange-sports
{ "answer_score": 6, "question_score": 5, "tags": "football, world cup" }
The Difference Between Time Clauses I was pleased **as/after/when/whenever** I heard the news. Could you please tell me if they are all correct? If yes what is the difference between them?
I was pleased whenever I heard the news means that you heard the news more than once and you were pleased every time. I was pleased after I heard the news means you heard the news first and afterwards you were pleased. I was pleased as I heard the news means that being pleased and hearing the news occurred at the same time. I was pleased when I heard the news means you were pleased very shortly after you heard the news and you were pleased because of it. In my opinion this is the correct choice.
stackexchange-ell
{ "answer_score": 0, "question_score": 0, "tags": "clauses, time" }
Django exclude(**kwargs) help I had a question for you, something that I can't seem to find the solution for... Basically, I have a model called Environment, and I am passing all of them to a view, and there are particular environments that I would like to exclude. Now, I know there is a exclude function on a queryset, but I can't seem to figure out how to use it for multiple options... For example, I tried this but it didn't work: kwargs = {"name": "env1", "name": "env2"} envs = Environment.objects.exclude( kwards ) But the only thing that it will exclude is the last "name" value in the list of kwargs. I understand why it does that now, but I still can't seem to exclude multiple objects with one command. Any help is much appreciated! Shawn
The way to do this would be: Enviroment.objects.exclude(name="env1").exclude(name="env2") or Enviroment.objects.exclude(Q(name="env1") | Q(name="env2"))
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python, django" }
Response to "God Bless" when parting company What should the correct response be (from someone not overtly religious) if someone says "God bless" when parting company? "Bye now" or "Bye" doesn't seem an adequate response.
I think it comes down to A) how religious the other person is, B) how religious you are, and C) how much you want to avoid potentially insulting the person. If they are very religious and you are not, and you want to avoid any hint of insult to their religion or any potential conflict, better just say something religious or at least agreeing back: > "Thanks, same to you". If you can't stand to say something that even acknowledges their beliefs, I think it at least doesn't hurt to acknowledge their sentiment, so you could just say "Thanks, bye." That's probably what I'd do.
stackexchange-english
{ "answer_score": 9, "question_score": 8, "tags": "politeness" }
Why can't I see my reviews? On `profile > activity > reviews` I cannot see the reviews. I only see: (nothing in this date range) I think this message is quite inappropriate. Is there any way to see if my flag was accepted by peers?
The "reviews" tab in your profile lists the **suggested edits** that you have reviewed and voted on (either to approve or reject the edit). Remember that you are only able to review suggested edits if you have full edit privileges yourself (at least 2k rep). If not, you won't have anything listed in this tab. In order to see your **flags** and find out which have been marked as valid or invalid, you need to click on the flag weight link in your profile, underneath the reputation counter: !click the "flag weight" link underneath your reputation count in your profile That links you to this page, which displays a summary of all the posts you've flagged, whether they were dismissed as valid or invalid, and what action (if any) was taken in response.
stackexchange-meta
{ "answer_score": 9, "question_score": 5, "tags": "support, recent activity, review" }
custom uploader in the admin area I am building a wordpress plugin that needs to allow the admin to upload CSS documents, and attach thumbnails. I want to know if there are any methods within wordpress that would be useful in assisting me in building an admin page that allows upload and deletion of css documents and images.
You can use the file uploader that come with Wordpress, using this guide to insert it in your meta-box: < You can create some custom fields and use it to upload thumbnails or CSS to your server.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 0, "tags": "plugins, plugin development, uploads" }
Prove $2^n > n^3$ Let $P(n)$ be the property: $2^n > n^3$. Let's use mathematical induction to prove that $P(n)$ is true for $n\geq10$. **Basis** : $P(10): 2^{10} > 10^3 \Leftrightarrow 1024 > 1000$ which is true. **Hypothesis** : $P(k): 2^k > k^3$ **Inductive step** : we have to prove $P(k) \Rightarrow P(k+1)$: $2^{k+1} = 2\cdot 2^k > 2\cdot k^3 = k^3 + k^3$ Everything is clear up to here, but then it goes on like this: $k^3 + k^3 \geq k^3 + 7\cdot k^2$ **Question here:** How to prove that $k^3 > 7\cdot k^2$ ? I know it's because $n\geq 10$, but how to prove it? Besides empirically - which shows it's true. Then the proof goes on: $k^3 + k^3 \geq k^3 + 3\cdot k^2 + 3\cdot k + 1$ **Question here:** I suppose it's the same "technique" like above, isn't it? If not, how to prove that: $k^3 \geq 3\cdot k^2 + 3\cdot k + 1$ ?
In the induction step you're allowed to assume $k\ge 10$ because $k=10$ was proved in the base case. This directly implies $k>7$, and because $k^2$ is positive you can multiply on both sides to get $k^2>7k^2$. If you want to be completely formal about it, you could insist that mathematical induction must always start at $0$. In that case, the property you _actually_ prove by induction is $2^{m+10}>(m+10)^3$ for all $m\ge 0$, and in your induction step $k$ would be an abbreviation for $j+10$ for some $j\ge 0$. Then $j\ge 0$ implies $j+10\ge 10$ which is the same as $k\ge 10$. (But nobody is _that_ formal about it, except when they interact with computer proof systems).
stackexchange-math
{ "answer_score": 5, "question_score": 1, "tags": "analysis, inequality, induction" }
How to get wishlist collection using customer id in magento 1.9 I am trying to get the wish list products in Magento 1.9, I am facing some problem. Based on customer id am fetching customer details, Unable to fetch the wishlist product collections. $customer_id= 4; $customer = Mage::getSingleton('customer/customer')->load($customer_id); if($customer){ $wishList = Mage::getSingleton('wishlist/wishlist')->loadByCustomer($customer); print_r($wishList); $wishListItemCollection = $wishList->getItemCollection(); if (count($wishListItemCollection)) { $arrProductIds = array(); foreach ($wishListItemCollection as $item) { $product = $item->getProduct(); $arrProductIds[] = $product->getId(); } } }
I assume that the customer ID is 1 and you want tot get the wishlsit items of the customer having the customer ID 1. Please use the code like below: <?php class Stack_Wishlistitems_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { $customerId = 4; $customer = Mage::getSingleton('customer/customer')->load($customerId); $wishlistItems = Mage::getModel('wishlist/item')->getCollection() ->setWebsiteId($customer->getWebsiteId()) ->setCustomerGroupId($customer->getGroupId()); echo "<pre>";print_r($wishlistItems->getData());exit; } }
stackexchange-magento
{ "answer_score": 0, "question_score": 2, "tags": "magento 1.9, wishlist" }
P6spy doesn't spy on hsql jdbc driver When trying to spy on the jdbc connection to a hsqldb database it doesn't work. It looks like the org.hsqldb.jdbcDriver is not deregistered.
The solution is to deregister both drivers registered by hsqldb.jar. In spy.properties you should have realdriver=org.hsqldb.jdbcDriver realdriver2=org.hsqldb.jdbc.JDBCDriver deregisterdrivers=true
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "jdbc, hsqldb, p6spy" }
Zero article after the phrase "speaking of" Tell me please why the speaker left out an article after the phrase _speaking of_ in the following sentence. It is from Crash Course Big Hisory. It is at 2 minute and 32 second. > Some questions can only be explored by zooming out. That is what Big History does. **Speaking of** ( **the** ) **zoomed out** , this is Earthrise one of the most famous photographs of all time. Why did the speake not use _the_ before _zoomed out_ or not say _speaking of zooming out_?
"Zoomed out" is an adjective phrase. "Of X" is a prepositional phrase. Normally X there should be a noun, not an adjective. So the sentence is not really grammatically correct to begin with. The meaning is clear enough, so I'd say it's informal rather than wrong. But a grammatically correct sentence would be, "Speaking of things that are zoomed out, this is Earthrise, one of the most famous photographs of all time." There's no call for "the" here because articles are used to modify nouns, not adjectives, and there is no noun in the phrase. English speakers often do say "speaking of X" where X is an adjective. Like "Speaking of annoying, yesterday my wife said ..." Or "Speaking of expensive, have you seen what new cars cost today?" Etc. In most if not all cases, what the person means is, "Speaking of things that are X".
stackexchange-ell
{ "answer_score": 2, "question_score": 0, "tags": "articles, zero article" }
Why does Visual Studio open with a guid exe file What's the guid appended after devenv about? Does it have something to do with the fact that it runs as Administrator? ![Visual Studio 2015 UAC prompt](
The UAC prompt displays the name of the program as embedded in the digital signature. Something you can see with Explorer. Navigate to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE, right-click devenv.exe, Properties, select the "Digital Signatures" tab. Select the SHA256 signature, click Details. Select the Advanced tab and the 1.3.6.1.4.311.2.1.12 field. The hex dump shows the name. Why Microsoft started gluing a guid after the "devenv" is unclear to me. It used to be "devenv_2.exe" in earlier versions. Well, "_2" doesn't win any prizes either. You can file a bug at connect.microsoft.com (say "devenv elevation prompt doesn't name program correctly") and with some luck they'll tell you.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "visual studio" }
Switch "Day of the Week" I want to know the current day - and than do something special on this day on monday = do this on sunday = do that etc... I know how to do the switch, but how can I ask to the current day? if (...) { do something; } else { switch (..) { case 0: currentPageNumber = 2; break; case 1: currentPageNumber = 3; <...> default: break; } I think switch/case is the right way to do want I want. Thanks for helping me ;-)
[NSDate date] Gives you the current date in your timezone NSDateComponents *components = [[NSCalendar currentCalendar] components:NSWeekdayCalendarUnit fromDate:[NSDate date]] Gives you an `NSDateComponents` instance. You can get the weekday (value from 1-7/SU-SA) with components.weekday
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "iphone, objective c, case, switch statement, dayofweek" }
Using Git for an OSX application I'm working on an OSX application (using xcode) and all the versionning stuff is managed with git. I'm asking because I'm a bit new at this (not git, but osx applications) : which files should be commited and which shouldn't? I'm not sure what to do with the .xcodeproj and all theses folders... Thanks!
Within the `.xcodeproj` directory you just want to keep `project.pbxproj` under version control. The other files in that directory are all user-specific - `project.pbxproj` contains all the important stuff. Also you probably _don't_ want the `build` directory under version control.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "xcode, macos, git, xcode4" }
Javascript / jQuery - Full Page Slider I'm looking for some sort of solution/plugin to make it so that I can take full page content, and slide it in from the left or right.
Have a look at supersized jquery plugin... < And also the Fullscreen Slit Slider... <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "javascript, jquery" }
Pause a Groovy script during runtime How would I pause a Groovy script **within the script** until a Java program tells the script to run again? The script will be embedded inside of a Java program.
There are several possibilities depending on how you actually call the script. If you call it using a seperate process, you could wait for input from STDIN in your script and write to STDOUT in java. If both just run in different threads of one JVM (this includes the execution via ScriptingManager), than you can use `obj.wait()` int the script and `obj.notify[All]()` in the java program.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, groovy" }
La phrase « Je saurais gré à l’un d’entre vous de ramener un tire-bouchon » est-elle correcte ? Je n'ai jamais vu une phrase avec _savoir gré_ sans pronom avant _savoir_ (e.g. « je vous saurais gré »). Peut-on dire : « Je saurais gré à l’un d’entre vous de ramener un tire-bouchon » ?
La phrase est correcte : le _vous_ usuellement utilisé avant savoir est remplacé par _l'un d'entre vous_ , situé après. Mais il vaut mieux utiliser _rapporter_ quand il s'agit d'un objet et utiliser _ramener_ pour les être vivants que l'on mène avec soi : _L'expressionsavoir gré_ avec _a_ : [« Savoir gré, savoir bon gré, un gré infini _à_ qqn (de qqc.) » ( --> § D. 2 )] > Je saurais gré _à_ l’un d’entre vous de _rapporter_ un tire-bouchon. _L'usage desavoir gré_ > Je vous saurais gré _de_ bien vouloir me rapporter un tire-bouchon.
stackexchange-french
{ "answer_score": 3, "question_score": 3, "tags": "grammaire, pronoms, prépositions, locutions" }
Most common element in the universe that could theoretically be a fuel? I'm making a small game about travelling deep space on limited resources. One thing I'm interested in having is the idea that the craft is scavenging what it can from planets as it travels through entirely uninhabited locations. The idea is this is a sufficiently advanced society that they could feasibly extract elements out of common materials to make a fuel from what they came across. So my question is, what element would they design around finding the most? I know earth's atmosphere is largely Nitrogen but if scientists were to make their best assessment, what would they bank on being the most copious element available to fuel the craft?
**Hydrogen** and helium make up most of the universe, in fact, hydrogen accounts for 90% of atoms in existence. What makes hydrogen significant? Fortunately, liquid hydrogen is literally rocket fuel when you set fire to it. It's also used in nuclear fusion, that is, smashing the atoms together to release tremendous amounts of energy. It's what fuels stars, which are giant fusion reactors. So I guess a spacecraft could harvest hydrogen from nebulae (as is discussed in this thread). Then it could either be compressed and burnt up for thrust, or used as a nuclear power source for an entirely different type of engine. Since your question isn't focused on how to extract/obtain hydrogen, I'll leave the rest to your imagination.
stackexchange-worldbuilding
{ "answer_score": 11, "question_score": 4, "tags": "science based, technology, space" }
Create a unique long in a service fabric stateful service I have a stateful service fabric service, that needs to call a third party API. When it calls the API it is obliged to provide a unique ID of type long. Is there any way in a stateful service to get the next available Long, without other instances of the service also creating the same ID?
* You can use the hashcode of the service instance if re-use is allowed and the 3rd party resource is not used concurrently by the same caller. * You can use the RandomNumberGenerator.aspx) to generate 8 random bytes, and convert them into a long using BitConverter.aspx) to get a fairly good random long value. There's no guarantee that two random numbers are never the same. Chances are pretty good when using 8 bytes though. * You can create an Actor or Service that keeps track of long-values currently in use (or ever used - if needed). Have it distribute fresh long values on demand.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "azure, azure service fabric" }
Programmatically find your Script ID I'm writing a Google Apps Script which must be registered with an OAuth2 service, which in turn needs the redirect_url to complete authorization. This redirect_url requires as a component the Script ID. Is there a way that I can programmatically read the Script ID property from within my Add-on script, so that I can present the user a full redirect_url to copy when registering their spreadsheet?
I had been unable to find the API by searching for ScriptID or "Script ID" -- but there is an API: ScriptApp.getScriptId()
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "google apps script" }
LibreOffice Calc: What is the data range syntax? I want to specify a graph's data ranges, but I don't know what format the data range specifier strings are in. Specifically, I'd like to specify all cells in Column A starting and including row 2 for a graph. I tried checking the LibreOffice wiki which unhelpfully links to the OpenOffice wiki which isn't helpful either.
What's in row 1? If it's the column label, then `Sheet1.A:A` works. Apparently, Calc ignores rows that do not contain numeric values. ![$Sheet1.$A:$A]( Otherwise, use `Sheet1.A2:A1048576` for the maximum number of rows. Either way, however, it's much slower than specifying only the rows that contain data, for example `Sheet1.A2:A100`. **EDIT** : There are workarounds for automatically expanding the chart's area. Browse through these related questions: * < * * < *
stackexchange-superuser
{ "answer_score": 3, "question_score": 3, "tags": "libreoffice, libreoffice calc" }
Different electron .html files in one I need to somehow import a lot of html pages into one in electron(im using w2ui layout). I have tried: <iframe src="../map/index.html"></iframe> but it does not work: <script>require('./index.js');</script> > (Uncaught ReferenceError: require is not defined at index.html:15)
From what I understand, you want to include the HTML from multiple files into one page. You can do this by using jQuery `$('#elementToLoadHtmlInTo').load('url/pathToFile')` you could also try using the fs module in nodejs to load the content from your files and then add it to your file.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html, node.js, electron, w2ui" }
Can a Galaxy-class saucer section join onto a Nebula-class ship? Can a Galaxy-class's saucer section join onto a Nebula-class vessel? I can’t find the answer anywhere but they both _seem_ identical.
In theory, one could probably be made to fit the other. The saucers are of a _very similar_ shape and size. In practice, however, the way that they're joined is very different. The link between the saucer on the Nebula class is almost 50 metres longer. ![enter image description here]( Image Courtesy of John Eaves As noted by Rick Sternbach, the similarity didn't go unnoticed by the producers. > _The Nebula is sometimes thought to be smaller than the Galaxy class. At least this was the original intention by the designers. Rick Sternbach writes at TrekBBS: **" The Nebula class was supposed to be smaller than the Galaxy class, IIRC; the saucer shape is similar, but the bridge module is larger in proportion to the saucer size, as are the windows. The fact that the Nebula saucer looks like a Galaxy saucer (shape, colors, various design elements) doesn't exactly help the situation, but there it is."**_ > > Nebula Class Observations
stackexchange-scifi
{ "answer_score": 25, "question_score": 15, "tags": "star trek, star trek tng" }