INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Solve giving null solution when number substituted with a variable I'm new to Mathematica so maybe I'm missing some crucial information but this Solve[{a == 25, x^2 == a}, x] gives a null solution `{ }`, while this Solve[{x^2 == 25}, x] gives the correct `{{x -> -5}, {x -> 5}}`. I've just restarted the kernel to make sure there aren't any symbols defined that I'm unaware of. Why isn't the first example giving the same output as the second one?
Another option is ClearAll[x, a]; Solve[{a == 25, x^2 == a}, {x, a}] !Mathematica graphics It gave `{}` because it needed all variables to solve for (even though we know `a=25`, it just needed to see `a` in there.
stackexchange-mathematica
{ "answer_score": 6, "question_score": 5, "tags": "equation solving" }
Flutter Desktop scrolling with mouse wheel: step size How do i change how much a single mouse scroll wheel step scrolls in a Flutter Desktop App (Windows, macOS, Linux), without affecting touchpad scrolling speed? The default scroll wheel step size is too small, especially on 4K monitors. If i multiply the step size through scroll listener, it breaks touchpad scrolling, makes it too fast. I maybe need to somehow distinguish between touchpad scroll and mousewheel scroll?
Currently there is no reliable way to distinguish between scroll wheel scroll and trackpad scroll because they are the same event at the engine level. Because trackpad gestures aren't directly supported yet trackpad scroll is currently implemented as a series of discrete incremental scroll events rather than a gesture. Once that issue is addressed, they will be different types of scrolling that can be distinguished from each other.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "windows, flutter, macos, dart, flutter desktop" }
Prevent Bootstrap from being responsive in certain screen resolutions My goal is to stop from changing the layout at a given resolution, say `768px` wide. Is there a way to set that across the board in my app?
You can give your container a min-width of whatever amount you want. @media all and (min-width: 768px){ body { min-width: 960px; } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "html, css, twitter bootstrap" }
How do I create a C++ library in VS 2008? I am working in VS 2008 and have several C++ projects and want to build my own library to share across projects. The first project is called "Project 1". I created the library as a separate Win 32 project, and chose DLL. I added a reference in Project 1 to the library using "Add reference". I also added an "Additional reference search path". I added #include "Library.h" to the top of the cpp file for Project 1. However, I am getting the error: fatal error C1083: Cannot open include file: 'Library.h': No such file or directory. How do I do this? Thanks!
If the projects are in separate folders, you may have you do something like: #include "../libproject/Library.h"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, visual studio 2008, dll" }
SQL Server ambigous col name this is concerning SQL Server Management I have been getting this error when trying to update a table: "Ambiguous column name 'Id'." this is the query: update DispatcherDB.dbo.Engineer set MobilePhone = RestoreDB.dbo.W6ENGINEERS.MobilePhone from DispatcherDB.dbo.Engineer join RestoreDB.dbo.W6ENGINEERS on Id = W6Key I have done this query before on other tables without a problem. I'm still a novice when it come to SQL, so any help/advice would be greatly appreciated! Thanks!
You have to give aliases to your tables (not really have to, but nice to do) and then you have to define of which table the id you are using in the on clause. update E set MobilePhone = W.MobilePhone from DispatcherDB.dbo.Engineer E join RestoreDB.dbo.W6ENGINEERS W on E.Id = W.W6Key
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "sql, sql server, sql update" }
Why is this not an exponential distribution? On an exercise sheet I found the following question: You monitor planes landing at an international airport. **X** measures the time intervals between consecutive landings. _Is **X** exponentially distributed (in good approximation)?_ To me it seemed that this is a clear case of an exponential distribution. However, the correct answer, supposedly, is _no_. Can you explain to me why X is not exponentially distributed?
It slightly depends on how busy the airport is, but note (a) the mode of an exponential distribution is $0$ while (ignoring emergencies) there is usually a substantial gap between planes landing so the first can clear the runway, and (b) in a busy airport with restricted landing slots the controllers try to make planes tend to land with close to equal gaps between them to balance efficiency and safety, so a low standard deviation of gaps compared to their average, while an exponential distribution has a standard deviation equal to its average
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "probability distributions, exponential distribution" }
301 redirect on windows with ISAPI_Rewrite 3 I have a page '/communities/communities.html' which i want to redirect to './communities.aspx" my httpd.ini file looks like this but I cant get it to work. It just acts like there is no redirect. redirect 301 /communities/communities.html
Try this instead in your site root: RewriteEngine on RewriteBase / RewriteRule communities/communities.html [R=302] Also ISAPI_Rewrite3 defaults to naming the naming the rewrite rule file `.htaccess` and not `httpd.ini`.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "iis, redirect" }
virtual box installation causes error while launching The virtual machine 'cloudera-quickstart-vm-5.12.0-0-virtualbox' has terminated unexpectedly during startup with exit code 1 (0x1). More details may be available in 'C:\Users\Sri Dhanasheelan\VirtualBox VMs\cloudera-quickstart-vm-5.12.0-0-virtualbox\Logs\VBoxHardening.log'. Result Code: E_FAIL (0x80004005) Component: MachineWrap Interface: IMachine {b2547866-a0a1-4391-8b86-6952d82efaa0} I have installed JDK ,visual studio-2015 in my windows10 system . But still get the error that the session to open virtual machine has been failed.
Download latest virtual box and try to re install.It will solve the problem.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "virtual machine, virtualbox, cloudera quickstart vm" }
function to output pairwise of passed letters I would like to create a Python function that can take in letters and output a pairwise comparison of the letter given. So for example, if my function is named `pairwise_letters()`, then it should behave as follows: >>> pairwise_letters('AB') AB >>> pairwise_letters('ABC') AB BC AC >>> pairwise_letters('ABCD') AB BC CD AC BD AD >>> pairwise_letters('ABCDE') AB BC CD DE AC BD CE AD BE AE >>> pairwise_letters('ABCDEF') AB BC CD DE EF AC BD CE DF AD BE CF AE BF AF ...
Use `itertools.combinations()` to get each pairing. By default, `itertools.combinations()` outputs an iterable of tuples, which you'll need to massage a bit to turn into a list of strings: from itertools import combinations def pairwise_letters(s): return list(map(''.join, combinations(s, 2))) print(pairwise_letters("ABC")) This outputs: ['AB', 'AC', 'BC']
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, python 3.x" }
how can I configure PyCharm so that running a Python script file is visible for Python Console I am writing Python scripts in Pycharm with IPython installed. So I can use Python Console in Pycharm to type Python commands and check the immediate output of the codes. However, when I run a script file after pressing 'Run' button (Shift+F10), all the variables and functions are not visible to the Python Console. This is, however, the feature of Spyder, another popular Python IDE. So here is my question: how can I configure Pycharm so that running a Python script file is visible for Python Console? Thanks
You could also run the part of your code you want to test/check in the console by selecting it and then right clicking and clicking on "Execute Selection in Console Alt-Shift-E". That's what I use sometimes when the debugger is not helpful. After running the code (you can also just "run" functions or classes) the console knows the functions and you can use the same features that Spyder has. However, be aware that when you change the code you need to run it in the console once to update the console definitions!
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, pycharm" }
Liferay AssetEntryQuery filter by asset type (Jython) Trying to get a list of assets filtered by category AND asset type (e.g. blog). I have the AssetEntryQuery working in a python portlet: from com.liferay.portlet.asset.service.persistence import AssetEntryQuery from com.liferay.portlet.asset.service import AssetEntryServiceUtil aq = AssetEntryQuery() aq.setAllCategoryIds([442492]) articles = AssetEntryServiceUtil.getEntries(aq) for a in articles: out.write(str(a.title)) out.write(str(a))
Set the `className` in your AssetEntryQuery with the FQCN of the model you're looking for, eg. `assetEntryQuery.setClassName(BlogsEntry.class.getName());`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, liferay, jython, portlet" }
Is it possible to display a WebView inside a Popup in UWP? I want to display a simple WebView inside a Popup, I tried this code but doesn't seem to be working. <Popup x:Name="StandardPopup"> <Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" BorderThickness="2" Width="200" Height="200"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <WebView x:Name="webView1" Source=" HorizontalAlignment="Center"/> <Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center"/> </StackPanel> </Border> </Popup>
There's no problems on WebView for showing the website in Popup control. If you check the visual tree in the visual studio, the issue was just due to the WebView's actuall size is zero. You could set a appropriate size for it, then you will see the WebView works well. <Popup x:Name="StandardPopup"> <Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" BorderThickness="2" Width="200" Height="200"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <WebView x:Name="webView1" Source=" Width="200" Height="200" HorizontalAlignment="Center" NavigationCompleted="WebView1_NavigationCompleted" /> <Button Content="Close" Click="ClosePopupClicked" HorizontalAlignment="Center" /> </StackPanel> </Border> </Popup>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, xaml, webview, uwp, popup" }
Getting error while detect chrome extension installed or not using javascript Here is My code, var myExtension = chrome.management.get( "my_extention_id" ); if (myExtension.enabled) { // installed } else { ... } source : < i have tried this method. But i'm getting following error: Uncaught TypeError: Cannot read property 'get' of undefined
If it's undefined then you're missing the management declaration in the manifest: "permissions": [ "management" ], Source
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "javascript, jquery, google chrome, google chrome extension, google chrome devtools" }
extract data from .txt file and convert it into row and column in .csv format I have a .txt file that needs a header as Id attr1 attr2 attr3 attr4 and each should be in a separate column and data should be stored under that from the document below using python. image_01.jpg 1 0 0 NA image_02.jpg 1 0 1 0 image_03.jpg 1 NA 0 1 image_04.jpg 0 0 0 1 image_05.jpg 0 0 1 1
def convert(filename:str)->None: import csv with open(filename, 'r') as in_file: stripped = (line.strip() for line in in_file) lines = (line.split(" ") for line in stripped if line) with open('data.csv', 'w', newline='', encoding='UTF-8') as out_file: writer = csv.writer(out_file) writer.writerow(('Id', 'attr1', 'attr2', 'attr3', 'attr4')) writer.writerows(lines) convert("data.txt") This should work. just change `data.txt` to whatever filename you have in the function call.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python" }
Why does (?:\s)\w{2}(?:\s) not match only a 2 letter sub string with spaces around it not the spaces as well? I am trying to make a regex that matches all sub strings under or equal to 2 characters with a space on ether side. What did I do wrong? ex what I want to do is have it match `%2` or `q` but not `123` and not the spaces. update this `\b\w{2}\b` if it also matched one letter sub strings and did not ignore special characters like - or #.
You should use (^|\s)\S{1,2}(?=\s) Since you cannot use a look-behind, you can use a capture group and if you replace text, you can then restore the captured part with `$1`. See regex demo here Regex breakdown: * `(^|\s)` \- Group 1 - either a start of string or a whitespace * `\S{1,2}` \- 1 or 2 non-whitespace characters * `(?=\s)` \- check if after 1 or 2 non-whitespace characters we have a whitespace. If not, fail.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "regex, nano" }
Docker hangs and gets corrupted on reboot We are running a scheduling engine with docker, chronos & mesos. Running 2 mesos slaves on each node. Sometimes, too many Jobs gets executed on each node and docker becomes unresponsive and docker gets corrupted on rebooting the server. Is there anything wrong with the setup? Not sure, why docker hangs and gets corrupted on reboot? Thanks
> Running Docker containers won't work properly because restarting one agent will cause Docker containers managed by the other agent to be deleted. > > Check out `--cgroups_root` flag in < This flag only applies to MesosContainerizer (can be used to launch Docker containers).
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "docker, mesos, mesos chronos" }
Left Join on association table I need help trying to join a table that uses an association table. I have a users table Users Table user_id user_name Association Table user_id project_id Project Table project_id project_name I need to pull a user and the count of projects they are associated with. SELECT u.user_name, COUNT(p.project_id) projects FROM users u LEFT JOIN association a ON u.user_id = a.user_id GROUP BY u.user_name How do I associate the two tables?
If you want to associate projects and users, you need to do 2 joins: SELECT u.user_name, COUNT(p.project_id) projects FROM users u LEFT JOIN association a ON u.user_id = a.user_id LEFT JOIN projects p ON p.project_id = a.project_id GROUP BY u.user_name If you want it faster you can do: SELECT u.user_name, COUNT(a.project_id) projects FROM users u LEFT JOIN association a ON u.user_id = a.user_id GROUP BY u.user_name
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "mysql" }
How to solve "N+1" with Ruby on Rails Creating a web application with Ruby on Rails. In the midst of all this, the N+1 problem arose, I have tried eager_load, but it does not solve the problem. I would be grateful if you could tell me about the solution. # companies_controller.rb companies = Company.with_include_users users = User.with_include_company companies.each do |company| ActiveRecord::Base.transaction do target_user = users.where(id: company.id) pp target_user end end # company.rb has_many :users scope :with_include_users, -> { eager_load(:users) } # user.rb belongs_to :company scope :with_include_company, -> { joins(:company).eager_load(:company) } As shown above, we eager_load in the model and outer join. In fact, it has not been resolved.
In order to resolve the n+1 problem, you can use the method includes to get your associated objects directly, if you know that you will have to use them in your view. (untested code bellow) # companies_controller.rb companies = Company.includes(:users) companies.each do |company| company.users.each do |user| pp user end end
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "ruby on rails, ruby on rails 6" }
Can grass clippings be used for livestock feed? I was at a university agricultural research farm and I noticed that sheep had maintained grass height on a pasture to less than 1 inch. I asked the person in charge if they used a lawn mower and he said "no, not needed". I never throw away my grass clippings and always use them for compost. But after seeing this self sustaining agricultural cycle, I am looking for ways to implement this. The township ordinances will not allow me to rent livestock for "mowing the lawn" but I was wondering if I can take the grass clippings to farm for livestock feed. Will livestock consume grass clippings?
I live on a farm and can say with certainty that cattle and sheep will absolutely eat grass clippings. All of our grass clippings from the around the house go to the animals, along with a significant amount of other garden waste. They not only eat grass but will strip leaves off tree trimmings, and eat fruit and vegetables that may no longer be suitable for human consumption for whatever reason.
stackexchange-sustainability
{ "answer_score": 8, "question_score": 3, "tags": "balanced ecosystems, agriculture" }
Which of the following sets of vectors are linearly independent? > Which of the following set of vectors are linearly independent? > > ![enter image description here]( I'm a bit confused. I think the answer(s) would be **A, C,** and **D**. I'm unsure of how to actually figure out if each one is or isn't LI/LD
c and d only. a is twice the same vector and thus the second vector is in the linear span of the first.
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "linear algebra" }
How to add shade to Image swiftui? I want to take the top image and add shade so it looks like the bottom. ![enter image description here]( image description here]( I've tried; .renderingMode(.template) .accentColor(.black.opacity(0.5)) .foreGroundColor(.black.opacity(0.2) and other things.
It is simpler by adding an `overlay`: Image(...) .modifiers(...) .overlay(Color.black.opacity(0.1) You can animate it too: struct HomeView: View { @State private var hover = false var body: some View { Image(...) .modifiers(...) .onHover { hover in withAnimation { self.hover = hover } } .overlay(Color.black.opacity(hover ? 0.2 : 0)) } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "swiftui" }
Can we use a matrix as input for feedforward neural networks? I'm studying neural networks but haven't yet studied CNNs in depth. _I'm wondering whether we can use a matrix as input for feedforward neural networks? Or can we only use vectors as input for feedforward NNs?_ I'm asking this because in all the practical examples I've worked with I had to flatten the input matrix (for example images) to use it as an input in form of a vector.
CNNs for image recognition can take in not just a matrix but also a MxNx3 array (width, height, RGB channels). In fact, they can take in any array shape.
stackexchange-stats
{ "answer_score": 1, "question_score": 3, "tags": "neural networks" }
ruby for loop to generate matrix I have this for loop: for i in 0...4 for j in 0...4 puts "#{i}:#{j}" end end outputs: 0:0 0:1 0:2 0:3 1:0 1:1 1:2 1:3 2:0 2:1 2:2 2:3 3:0 3:1 3:2 3:3 but I like to generate a matrix of this result. I need to put all 0: in one line and all 1: in one line etc to generate this: 0:0 0:1 0:2 0:3 1:0 1:1 1:2 1:3 2:0 2:1 2:2 2:3 3:0 3:1 3:2 3:3 Any ideas? Thanks
As said in the documentation, **puts** "writes a record separator (typically a newline) after any that do not already end with a newline sequence". So you need to use **print** instead (but still use `puts` to move to a new line when each row is done printing) for i in 0...4 for j in 0...4 print "#{i}:#{j} " end puts end
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ruby, matrix" }
How to sort a DataFrame by two columns, using a custom order? I have a pandas DataFrame that I need to sort in a particular order in one column, and just ascending in another. Both columns have repeated values. It looks more or less like this: import pandas as pd df = pd.DataFrame() df[0] = pd.Series( [ 'a', 'aa', 'c' ] * 2 ) df[1] = pd.Series( [ 1, 2 ] * 3 ) df[2] = pd.Series( range(6) ) print( df ) 0 1 2 0 a 1 0 1 aa 2 1 2 c 1 2 3 a 2 3 4 aa 1 4 5 c 2 5 Now, say that I need to order by columns 0 and 1, but not alphabetically: Column 0 should first follow an order: order = [ 'a', 'c', 'aa' ] How do I do that? I would like to have it sorted like this: print( sorted_df ) 0 1 2 0 a 1 0 1 a 2 3 2 c 1 2 3 c 2 5 4 aa 1 4 5 aa 2 1 * * * Using python 3.5.2, pandas 0.18.1
You can use pandas' categorical Series for this purpose which supplies the functionality of an individual sort order: df[0] = pd.Categorical(df[0], order) print(df.sort_values([0, 1])) 0 1 2 0 a 1 0 3 a 2 3 2 c 1 2 5 c 2 5 4 aa 1 4 1 aa 2 1
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 4, "tags": "python, sorting, pandas, dataframe" }
Hamracheim or Hammerachim? In Modim in the Shmoneh Esre we say המרחם כי לא תמו חסדך the question is whether the מ in המרחם should have a daggesh or not, and thus what sort of Shva should be under said מ?
It should not have a _dagesh_. Throughout _Tanach_ , most every _mem_ with a _sh'va_ as the first letter of present-tense verb in _piel_ or _pual_ has no _dagesh_ after a _he hay'dia_ according to the _m'sora_ (and the same is usually true of any _mem_ with a _sh'va_ ), and I have no reason to believe that that changed in later Hebrew (certainly not by the time " _Modim_ " was written). That said, I'm not sure what kind of _sh'va_ the _mem_ has. At least possibly, the _sh'va_ is _na_ anyway.
stackexchange-judaism
{ "answer_score": 3, "question_score": 3, "tags": "hebrew, shemoneh esrei, pronunciation, vowels nekudot" }
Editing framework-res.apk Screenshot : !enter image description here How do I change that yellow color to blue or another color? Should I edit or add any xml file in framework-res.apk? I want to change the yellow color to cyan.
You can refer the following link: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, xml, user interface" }
Visual Studio Attach to Process IE COM Plugin I have ActiveX COM Plugin for Internet Explorer. I want to "Attach to Process" to this plugin and debug it. I tried to attach to iexplorer.exe process but Visual Studio did not enter the breakpoint. What is my fault? Which process hosts this COM Plugin ?
Should be `iexplorer.exe` most likely problem with something else. Make sure that the `debug` version of the your Plugin `.DLL` loaded by the Internet Explorer process from the correct place (PluginProject\Debug) where present `.pdb` from the last build (check your Registry entry for the Plugin registration or try show MessageBox from it). Also check you trying to debug x86 version of the Plugin with the x86 version of the IE (or x64 with x64;)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "com, activex, visual studio debugging, attach to process" }
Why can't I use generic Type as an argument in Dart 2? This seems to be allowed List<Type> myTypes = List(); myTypes.add(SomeType); List<Type> moreTypes = [int, String]; but this fails? List<Type> myTypes = List(); myTypes.add(SomeGenericType<int>); List<Type> moreTypes = [SomeGenericType<int>, SomeGenericType<String>]; The error message is: The operator '<' isn't defined for the class 'Type'. Try defining the operator '<'. I'm new to Dart coming mainly from a C,C# background, so this seems confusing and inconsistent. Why is a generic type treated any differently than a non-generic?
This relates to this question: How to get generic Type? \- but it isn't a real duplicate question, that's why I replicate it here. While it doesn't answer the "Why", it gives the solution for the "How": Helper function: Type typeOf<T>() => T; And then you can get the type without a needed instance: myTypes.add(typeOf<SomeGenericType<int>>());
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "dart" }
Laser etched logo in glass I've tried everything found online, and suggested in forums but can't seem to achieve the realism I need. I'm looking to etch a logo and text in a whisky bottle which will not only create translucent glass, but will lighten the area. The problem I have is adding the layer to the existing material and making it look convincing. I've tried different masks, layers, etc. with no success. Below is a photo of what I'm trying to create, and the my work. Any help would be greatly appreciated. **This is the real bottle...** ![Original]( ![enter image description here]( ![enter image description here]( ![enter image description here](
I think there are a few ways you can achieve this. One way is to create a suitable mask from your base image (The one with the double D logo") using an _RGB to BW_ node and a _ColorRamp_ , and use that as a mask between a normal (unaltered) _Glass Shader_ and another _Glass Shader_ that has had it's Normal, Roughnes, IOR (or any combination of the 3) "warped" by a _Noise Texture_ : ![GlassFrost](
stackexchange-blender
{ "answer_score": 3, "question_score": 1, "tags": "materials, uv, glass" }
Setting style property in Javascript through Array creating an error Getting error in the following code: var attribute=["position","top","bottom","left","right","zIndex"], prop=["fixed","0","0","0","0","-2"]; for(var i=0;i<attribute.length;i++) video.style.attribute[i]=prop[i]; Error displayed by the console: `Uncaught TypeError: Cannot set property '0' of undefined` . Please Help!
`video.style.attribute` tries to read a property called `attribute` which does not exist, so `attribute[0]` throws the observed error. To set `video.style.position = "fixed"` you need to use `[]` notation in your loop: video.style[attribute[i]] = prop[i]; i.e. `video.style["position"] = "fixed"`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, html, dom, html5 video, undefined" }
How to construct a pattern that match the multiple partial differential of any multi-variable functions? For example,I want to match a multiple partial derivative of a function $f^{(1,0,1)}[x,y,z]$ which is the same as$\frac{\partial^2{f}}{\partial{x}\partial{z}}$.The only information given is the list of the independent variables such as {x,y,z} in this example. So I try to construct a pattern something like u_^[(n__)][independ] to match an arbitrary partial differential of an unknown function. However, it turns out to be wrong. For a simple case that has only one independent variable like $f^{(3)}[x]$ I can construct a pattern like D[u_[independ],{independ,n_}] to correctly match the partial derivative.But i don't know how to proceed to the multivariable cases. Are there some good soulutions?
Tutorial: Introduction to Patterns __"...the structure the Wolfram Language uses in pattern matching is__ _**the full form of expressions printed by FullForm. "**_ Consider D[foo[x, y, z], {x, 2}, {y, 3}] ![enter image description here]( See the underlying expression using `FullForm`: FullForm @ % > > Derivative[2, 3, 0][foo][x, y, z] > So the pattern you need is `Derivative[__][_][__]`: list = {g[x], D[foo[x, y, z], {x, 2}, {y, 3}], x + 4, w''[x]}; Cases[Derivative[__][_][__]] @ list ![enter image description here](
stackexchange-mathematica
{ "answer_score": 1, "question_score": 1, "tags": "pattern matching, design patterns" }
Calculating runtime in recursive algorithm Practicing recursion and D&C and a frequent problem seems to be to convert the array: `[a1,a2,a3..an,b1,b2,b3...bn]` to `[a1,b1,a2,b2,a3,b3...an,bn]` I solved it as follows (`startA` is the start of `a`s and `startB` is the start of `b`s: private static void shuffle(int[] a, int startA, int startB){ if(startA == startB)return; int tmp = a[startB]; shift(a, startA + 1, startB); a[startA + 1] = tmp; shuffle(a, startA + 2, startB + 1); } private static void shift(int[] a, int start, int end) { if(start >= end)return; for(int i = end; i > start; i--){ a[i] = a[i - 1]; } } But I am not sure what the runtime is. Isn't it linear?
Let the time consumed by the algorithm be `T(n)`, and let `n=startB-startA`. Each recursive invokation reduces the run time by 1 (`startB-startA` is reduced by one per invokation), so the run time is `T(n) = T(n-1) + f(n)`, we only need to figure what `f(n)` is. The bottle neck in each invokation is the `shift()` operation, which is iterating from `startA+1` to `startB`, meaning `n-1` iterations. Thus, the complexity of the algorithm is `T(n) = T(n-1) + (n-1)`. However, this is a known `Theta(n^2)` function (sum of arithmetic progression) - and the time **complexity of the algorithm is`Theta(N^2)`**, since the initial `startB-startA` is linear with `N` (the size of the input).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, algorithm, recursion, runtime, divide and conquer" }
Reference to multipile versions of same dependency in modular application I've designed a modular system based on `ASP.Net MVC`. Every module is an independent `ASP.Net Mvc` application which can be run alone. But if I load them into my core application the controllers and views and ... will merged to the my core app. The loading module mechanism is based on loading assembly to my current app domain in core, and registering the controllers and other services in my `IoC`'s container. Also I load the referenced dependencies by the module one-by-one into current app domain, so it runs perfect. **BUT, my problem** is that if two different versions of the same third-party assembly be referenced by two different module it causes error which it says cannot one or more dependencies of the assembly exception and the app stops! **Question:** what is/are the general solution or approach to dealing with above problem?
Strong naming is the general solution for your problem. Effectively when using a strong name, 2 different version of the "same" assembly are treated as two different assemblies. In your modules, 1. in Solution Explorer, right mouse click on the reference that is causing the issue, 2. choose properties, 3. ensure they are strong named, 4. if so then select the `SpecificVersion` option and set it to `true` This will ensure that given module will only use a given version of the 3rd party dependency. ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, asp.net, asp.net mvc" }
Segregate top element out of a list using XSL I currently have a `<xsl:foreach>` statement in my XSL processing all elements in this XML file. What I want to do though is process the first one separately to the rest. How can I achieve this? Here is my current code: <ul> <xsl:for-each select="UpgradeProgress/Info"> <xsl:sort select="@Order" order="descending" data-type="number" lang="en"/> <li><xsl:value-of select="." /></li> </xsl:for-each> </ul>
Assuming that you want to handle the first sorted element, this tests for the position inside of a choose statement and handles them differently: <ul> <xsl:for-each select="UpgradeProgress/Info"> <xsl:sort select="@Order" order="descending" data-type="number" lang="en"/> <li> <xsl:choose> <xsl:when test="position()=1"> <!-- Do something different with the first(sorted) Info element --> </xsl:when> <xsl:otherwise> <xsl:value-of select="." /> </xsl:otherwise> </xsl:choose> </li> </xsl:for-each> </ul>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "xml, xslt" }
.Net Send message at midnight based on TimeZone? I have a few datapoints that include the offset from gmt (in seconds). I would like to send a message via a socket at midnight. Sending the message is no problem, im just having trouble determining the time based on the offset. Anyone have any suggestions for this?
Since UTC and GMT are the same you can use this code. int secondsOffset = 100; DateTime utcMidnight = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc); DateTime utcWithOffset = utcMidnight.AddSeconds(secondsOffset); Console.WriteLine("Offset on UTC: " + utcWithOffset); Console.WriteLine("Offset on local time: " + utcWithOffset.ToLocalTime()); The first WriteLine shows the time at UTC timezone. The second Writeline shows the time at the local timezone. The tricky part may be finding out what is the base time, was it today at midnight or yesterday at midnight?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".net, timezone" }
Simulating a cookie-enabled browser in PHP How can I open a web-page and receive its cookies using PHP? **The motivation** : I am trying to use feed43 to create an RSS feed from the non-RSS-enabled HighLearn website (remote learning website). I found the web-page that contains the feed contents I need to parse, however, it requires to login first. Luckily, logging in can be done via a GET request so it's as easy as fopen()ing " for example. But I still need to **get the cookies generated when I logged in** , pass the cookies to the real client (using setcookie() maybe?) and then redirect.
For a server-side HTTP client you should use the cURL module. It will allow you to persist cookies across multiple requests. It also does some other neat things like bundling requests (curl_multi) and transparently handling redirects. When it comes to returning a session to your user, I don't think this is possible. You would need to be able to overwrite the cookies of other domains. This would cause massive security issues, so no browser would implement it.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "php, curl, curl multi, redirectwithcookies" }
REGEXP_REPLACE special character I have varchar lastname (Jovic) and I need to replace the letter **c** to **ć** . I tried with regexp_replace but no results. does anyone know how to replace?
select regexp_replace('Jovic' , 'c', 'ć') from dual; should return name with replaced character. In case it doesn't please check encoding set for your client application operating system maybe it is not able to display such character (I can't believe it) If by replace you mean replace it in your database please follow suggestions by **MT0**
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, oracle" }
Mysql Between in Between how to select data between 2 dates in between 2 dates? for example : start_date - end_date -- title 2014-01-28 2014-02-03 test 2014-02-01 2014-02-15 ests 2014-02-28 2014-03-03 sets 2014-03-01 2014-03-10 sste the problem is, i want to select data between 2014-02-02 and 2014-02-28 with first three of them selected because the first three data is included on 2nd month. i tried this, but not works SELECT title FROM my_tables WHERE start_date BETWEEN 2014-02-02 AND 2014-02-28 how it works?
Two periods overlap when one begins before the other ends, and the other ends after the first begins. Here is the correct logic: SELECT title FROM my_tables WHERE start_date <= '2014-02-28' and end_date >= '2014-02-02'; Note that date constants need to be in single quotes. Here is a SQL Fiddle showing it working.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql, sql, between" }
How to add `:include` to default_scope? Searching the 'net, I found that I should use `:include`, but that does not seem to change the SQL query that is generated: def Post #model default_scope :order => 'created_at DESC', :include => :author end With or without the `:include`, the SQL is the same (i.e. it is only selecting from the posts table). What is the way to do this?
What if you do default_scope { includes(:author).order('created_at ASC') } This is the way that it’s documented in the Rails API for `default_scope` & `scope`, rather than the hash parameter method you're using.
stackexchange-stackoverflow
{ "answer_score": 34, "question_score": 18, "tags": "ruby on rails 3" }
Projection-valued measure property I am reading the book functional analysis from Dirk Werner. In this book he introduces a Projection-valued measure (PVM) as follows. > Let $L(H)$ denote the set of linear,bounded operators $T:H\to H$ on a Hilbertspace $H$. Denote with $\Sigma$ the Borel-$\sigma$-algebra on $\mathbb{R}$. A map $$ E : \Sigma \to L(H)$$ is called PVM if all $E(A)$ are orthognal projections with $$ E(\emptyset) =0, \quad E(\mathbb{R})= Id $$ and for pairwise disjoint $A_1,A_2,\dots \in \Sigma$ it holds $$ \sum_{i=1}^\infty E(A_i) (x) = E(\cup A_i)(x) \quad \forall x \in H .$$ Now the author claims that is very easy to show that $$E(A) E(B) = E(B)E(A) = E(A\cap B)$$ holds, but he does not give a hint. Why is this true?
If $A$ and $B$ are disjoint, then $$ E(A\cup B)= E(A)+E(B) $$ $P^{2}=P$ for an orthogonal projection $P$. Equating the square of the right side with itself leads to $E(A)E(B)+E(B)E(A)=0$, or $E(A)E(B)=-E(B)E(A)$. Then use $E(B)^{2}=E(B)$ and apply this identity twice to conclude that $E(A)E(B)=0$ if $A\cap B=\emptyset$. Now, for general $A$ and $B$: $$ E(A)E(B)=\\{ E(A\setminus B)+E(A\cap B)\\}\\{E(B\setminus A)+E(A\cap B)\\} \\\ = E(A\cap B)^{2}=E(A\cap B). $$
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "functional analysis, measure theory" }
Emulate incoming network messages for Indy Is it possible to emulate incoming messages using Indy (if it's of any importance: I'm using Indy 10 and Delphi 2009)? I want to be able to create these messages locally and I want Indy to believe that they come from specific clients in the network. All the internal Indy handling (choice of the thread in which the message is received and stuff like that) should be exactly the same as if the message would have arrived over the network. Any ideas on that? Thanks in advance for any tips.
What you want to do has nothing to do with Indy, as you would need to do this on a much lower level. The easiest way to make Indy believe that messages come from a specific client is to inject properly prepared packets into the network stack. Read up on TCP Packet Injection on Google or Wikipedia. EtterCap is one such tool that allows to inject packets into established connections. However, this is definitely going into gray areas, as some of the tools are illegal in some countries. Anyway, all of this is IMHO much too complicated. I don't know what exactly you want to do, but a specially prepared client or server is a much better tool to emulate certain behaviour while developing server or client applications. You can run them locally, or if you need to have different IP addresses or subnets you can do a lot with virtual machines.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "delphi, networking, indy" }
If $g(z) = f(1/z)$ and $g$ has a pole at $0$ and $f$ entire.Then there is a $z_0$ such that $f(z_0) = 0$. I figured I can somehow use Liouville's theorem. I don't really know what the method is for solving or where to begin. Suppose that $f: \mathbb{C} \to \mathbb{C}$ is an entire function. Let $g(z) = f(\frac{1}{z})$. Prove that if $g$ has a pole at $0$ then there is a $z_{0}$ in $\mathbb{C}$ such that $f(z_{0}) = 0$. Can assume $g$ is holomorphic on $\mathbb{C} \setminus \\{0\\}$.
Since $f$ is entire, there is a power series $\sum_{n=0}^\infty a_nz^n$ centered at $0$ such that$$(\forall z\in\Bbb C):f(z)=\sum_{n=0}^\infty a_nz^n$$and therefore$$(\forall z\in\Bbb C\setminus\\{0\\}):g(z)=a_0+\frac{a_1}z+\frac{a_2}{z^2}+\cdots$$So, since $g$ has a pole at $0$, there is some $N\in\Bbb N$ such that $n>N\implies a_n=0$. So, $f$ is a polynomial function and therefore you can use the Fundamental Theorem of Algebra to prove that it has a zero.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "complex analysis, singularity, entire functions" }
Insert line break in postgresql when updating text field I am trying to update a text field in a table of my postgresql database. UPDATE public.table SET long_text = 'First Line' + CHAR(10) + 'Second line.' WHERE id = 19; My intended result is that the cell will look like this: First Line Second line The above syntax returns an error.
You want `chr(10)` instead of `char(10)`. Be careful with this, because that might be the wrong newline. The "right" newline depends on the client that consumes it. Macs, Windows, and Linux all use different newlines. A browser will expect `<br />`. It might be safest to write your update using an escape string for PostgreSQL 9.1+. But read the docs linked below. UPDATE public.table SET long_text = E'First Line\nSecond line.' WHERE id = 19; The default value of 'standard_conforming_strings' is 'on' in 9.1+. show standard_conforming_strings;
stackexchange-stackoverflow
{ "answer_score": 101, "question_score": 64, "tags": "postgresql, char, sql update" }
Retrieve all uploaded videos by a given user Is it possible to get all videos that a user uploaded on YouTube (without the authentication token)? How? Edit: The best approach is this Pointy answer, but there is a limit of 50 videos per request, so in short there isn't a way to get all videos at once. Accepted anyway.
A quick google search results in this page from the YouTube API docs: < The responses from the API are XML documents. Each `<entry>` tag corresponds to an upload. The video "key" can be extracted from the `<id>` tag inside the entry; it's the tail end of the URL. (The URL in the `<id>` is _not_ directly the URL for the video.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "jquery, youtube, youtube api" }
Disable product returns feature in opencart My client doesn't accept returns. Is there any way to disable this returns feature without modifying the template files?
AFAIK the answer is no. You have to either edit the template and/or use VQmod to alter the code where returns are refered to. But there is no option in admin where you can disable product returns
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "opencart" }
How to monitor calls to an external library function? I have an application which is executing oci statements using OCIStmtExecute(). I need to know which sql statement is being passed to OCIStmtPrepare on what action. Tried using API Monitor but there weren't OCI.dll functions. Also placing a breakpoint doesn't help since it's executing a notify statement almost every half a second.
> Tried using API Monitor but there weren't OCI.dll functions. OCI.dll most certainly does export functions, including `OCIStmtExecute()` and `OCIStmtPrepare()`: ![OCIStmtExecute]( If you're not seeing them in API Monitor, it's because you've not told API Monitor to log them correctly, or because they're not really being called by the target process.
stackexchange-reverseengineering
{ "answer_score": 1, "question_score": 1, "tags": "ida" }
Why isn't there any one-shot way of vertical centering in CSS3? After reading this _"In The Woods" blog post_, I wondered: **Why isn't there any one-shot way of vertical centering in CSS3?** Why can't I just make a `<div>` with the CSS attribute `vertical-align: center` and have my content vertically centered?
The name may be slightly confusing. The css declaration `vertical-align` isn't for vertically centring some content inside its parent (unless we're talking about table cells). Rather, it is for setting the vertical alignment of the element that the rule is declared upon. This is useful if you're using `inline-block` to get some elements to sit next to each other and behave.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "css, vertical alignment" }
Using GCD in Swift CLI So I'm trying to use GCD in the CLI. To test it out i wrote some code like this: import Foundation var i = 0 print("a: ",i) dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)) { for n in 1..<10{ i++ } print("c: ",i) dispatch_async(dispatch_get_main_queue()){ print("d: ",i) } } print("b: ",i) sleep(5) print("e: ",i) the output of this is: a: 0 b: 0 c: 9 e: 9 with the last line printing a few seconds later. What I'm trying to find out is what happened at d? Nothing I put in that block seems to execute. This works fine when I use it in iOS, just not in the CLI.
The CLI lacks the persistence of an app. It came to an end (terminated) before `d` had a chance to be printed. As @user3441734 rightly points out, you can work around this in the CLI by calling `dispatch_main()` as the last thing before exit. This call effectively forces us to dip into the main queue _right now_ and pull out the main-queued block and execute it, before exiting.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, macos, swift2, command line interface, grand central dispatch" }
Why does py2exe remove `help` and `license`? I packaged my Python app with py2exe. My app is a wxPython GUI, in which there is an interactive Python shell. I noticed that I can't do `help(whatever)` in the shell. I investigated a bit and discovered that after the py2exe process, 3 items were missing from `__builtin__`. These are `help`, `license`, and another one I haven't discovered. Why is this happening and how can I stop it? I want the users of my program to be able to use the `help` function of Python.
_Reason:_ These are added by the **site** module. I believe that py2exe doesn't package that. _Fix:_ Either explicitly `import site` or reimplement `help` (trivial). See also: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, packaging, py2exe" }
Find double limits $f:\mathbb{R}^2\rightarrow\mathbb{R}, \ f(x,y)=x\cdot\mathbb{D}(y)$, where $\mathbb{D}$ is Dirichlet function (nowhere continuous function). Find all the limits: $\lim_{x\to 0}\lim_{y\to 0}f(x,y)$, $\lim_{y\to 0}\lim_{x\to 0}f(x,y)$ and $\lim_{(x,y)\to (0,0)}f(x,y)$. Is there any problem with moving $x,y$ to $0$ (no matter in what order)? I think there is no problem and all limits will be equal to $0$, but then this exercise will be rather pointless, so I'm not sure..
This is a nice exercise which illustrates that the existence of a double limit does not imply the existence of iterated limits. Using the squeeze theorem (as @Keivan indicated) you should be able to prove that the 2nd and 3rd limits are zero. But the 1st one does not exist... do you see why?
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "real analysis" }
UnauthorizedAccessException - EnumerateFiles to parse a network share I try to parse a network share and the script always stop in the middle with a specific folder and throws UnauthorizedAccessException. How to skip this folder and continue the script? The following code doesn't work (even with GetFiles), if you know the answer please could you provide me a solution in Powershell code and not C# code (as I don't know well C#). $files = [system.IO.Directory]::EnumerateFiles($path, "*",[system.IO.SearchOption]::AllDirectories) foreach ($file in $files) { try { [System.IO.Path]::GetExtension($file) } catch [UnauthorizedAccessException] { } }
Try this: $path = "" try { foreach ($file in ([system.IO.Directory]::EnumerateFiles($path, "*",[system.IO.SearchOption]::AllDirectories))) { try { [System.IO.Path]::GetExtension($file) } catch [Exception] { } } } catch [Exception] {} I believe the problem you were having is in your $files variable is where the files were being Enumerated, thus it was outside of the try statement and gave you the error. This script adds another try and catch outside the foreach to catch exceptions while enumerating within the foreach statement itself. You can do that or just declare the $files variable within the try block. I personally like this better though.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "powershell" }
How to configure Rider F# for ubuntu with autocomplete? I'm trying to get Intellisense for F# on Ubuntu (20.04) using Rider IDE. Intellisense works for C# but not F#, I have tried dotnet 5 and 6 via snap and mono for 4.8.x but neither of them seem to be giving me intellisense suggestions. F# interactive is also not available in Rider. It is available in the terminal though. Any ideas on how I can get a better F# experience on ubuntu? Rider linux not showing types. ![Figure shows syntax highlighting but no autocomplete]( Rider windows showing types. ![Rider windows](
Suspect you are running into a known issue with Snap and FSAC: < Try installing .Net 6 manually and see if it solves your issue.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ubuntu, f#, rider, jetbrains rider" }
Applying substring operation to FOR token value (batch file) _(Edited question for clarity)_ Applying substring operation to a token value in a FOR does not work: for /F "tokens=1 delims=" %%G in ("tokenvalue ") do ( Echo %%G:~-1 ) The substring operation does not delete the space at the end. Instead, `:~-1` gets appended to the echoed result to produce: > tokenvalue :~-1
I cannot reproduce your problem here. Only when I append a space to the input file it also appears in the output file. If you do echo %%G >> D:\newfile.txt then a space gets appended, obviously. This might be the case if you simplified your code before posting here. If you indeed start out with a space in the input, then use the following: setlocal enabledelayedexpansion for /f "tokens=1 delims=" %%G in (D:\originalFile.txt) do ( set "line=%%G" echo !line:~-1!>>D:\newfile.txt ) You apply substring operations only to environment variables as the help already states. In any case, if you're sure that the input file does not contain the trailing space, then you don't actually need the loop. A simple type D:\originalFile.txt >> D:\newfile.txt should suffice.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "batch file, cmd, token" }
How can I ask JavaScript to hide an element ONLY IF it can be found? I have a javascript event handler in one of my SSI files that hides a bunch of elements that may or may not appear on the page that calls the SSI file. As a result, the handler goes smoothly until it cannot find the element I'm asking it to hide and then stops before completing whatever may be left to hide. So, how can I get JavaScript to not get hung up on whether or not the element is on the page and just get through the handler? Many thanks. Mike
Depends on how you're getting the element. If you're not using a JS library then you could do something like this: /* handler begin code */ var el = document.getElementById('myElement'); if (el) { //do work } /* handler end code */ Its easier if you use something like jQuery, where you can select the element and then even if it doesn't exist any operations on the selected set will not throw an exception //this will work even if myElement doesn't exist - no exceptions will be thrown $("#myElement").hide();
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 0, "tags": "javascript, html, css" }
imacros not working in firefox properly I have .iim file in iMacros and when I Play it in firefox few text fields are not extracted but same .iim file is working in iMacros software . I am using Firefox because I can see .js(java-script file) in firefox.Is there any other way to see .js file in iMacros software also why the text extracted in firefox is not working for a few field ?? Please help me out .Thanks in Advance.
iMacros browser support several more commands and options, which imacros for firefox does not support - this may be the issues. You can view .js files using any text editor software, even notepad.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, firefox, imacros" }
Why doesn't my exe file open from the debug or release folder for visual studio 2015? I'm still new to visual studio and I'm desperately trying to find a way to run my simple console application (in c) from an exe file. I have found my debugging and release folders, each folder containing ilk,pdb, iobj, and ipdb along with the exe file. This is probably a very simple answer so please keep it on a basic level of understanding, thanks :c
If you write in C++ or in C, you could add the code "system("pause");". It would not close the console window directly if you double click the .exe file in your project output path. A simple sample here: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "debugging, visual studio 2015, directory, exe, release" }
Matar un proceso en C# que empiecen por el mismo nombre Supongamos que tengo los siguientes procesos con los nombres: proceso_1 proceso_2 proceso_3 Pues yo quiero eliminarlos todos independientemente como terminen el nombre de la cadena. Tengo el siguiente código, pero no es lo que me interesa ya que debería pasarle el nombre exacto del proceso. var resultado = System.Diagnostics.Process.GetProcessesByName("Tu Nombre de proceso"); foreach (var item in resultado) { item.Kill(); } Debería ser capaz de encontrar todos los procesos que empiezen por el nombre "proceso_" y eliminarlos. ¿Es posible esto?. Nota: El nombre completo del proceso es arbitrario, sólo se como empiezan.
Existe un método `GetProcesses()` que te devuelve todos los procesos que están actualmente corriendo, puedes recoger todos los procesos y después recorrerlos y eliminarlos si su nombre coincide con tu condición: var resultado = System.Diagnostics.Process.GetProcesses(); foreach (var item in resultado) { if(item.ProcessName.Contains("proceso_")) item.Kill(); }
stackexchange-es_stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c#" }
get present year value to string I need to get the present year value in string so I did: Calendar now = Calendar.getInstance(); DateFormat date = new SimpleDateFormat("yyyy"); String year = date.format(now); It works on ubuntu but it's not working on windows 7. Do you know why? Is there a safer way to do that? Thanks
You can simple get the year from `Calendar` instance using `Calendar#get(int field)` method: Calendar now = Calendar.getInstance(); int year = now.get(Calendar.YEAR); String yearInString = String.valueOf(year);
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 9, "tags": "java, calendar, operating system, date format" }
sql mail and ssrs Is it possible to attach a report from SSRS as PDF and send using sql mail? the server is MSSQL 2000.
Why not use email delivery built into SSRS? Underneath, this uses SQL Agent anyway. All versions of SSRS support email delivery. Configuring email delivery for SQL 2000.aspx). For PDF... when you set up the subscription you specify the render format. I can't test this bit, but I assume PDF is supported here because PDF is supported anyway. BOL link: How to create an e-mail subscription.aspx) We've also tested URL Access to generate PDFs followed by using SSIS emailing as attachment to work around some corporate limitations.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 1, "tags": "sql server, ssrs" }
how to import py file from different upper folder? All, File structure: \ util utils.py modules __init__.py modules1.py submodule __init__.py submodule.py I want to know how to import `utils.py` in those __init__.py for example, now I run the python interpreter in \ level, I run `import modules`, I suppose the code `from ..util.utils import *` may works, but it is not. may I know where is the mistake? and may I know if there's a way i can import utils.py in a universal format? something like import \util\utils.py I know I may use path.append(), but any alternative? Thanks ============ got the answer from this post: Import a module from a relative path
If you are developping a python **package** (what you are obviously doing, as you have **init**.py), then the most simple way to import your module is just via the package. For example, if your package is called `mypackage`, then: import mypackage.utils
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, path, import" }
Endpoints API with authentication My question is : can I use endpoints API or a service with OAuth protocol in general, in sort of that i not need to authenticate the user all time that it send a request to the server but only the first time and for the other times I will use type of token or whatever to use the server directly without check oaut. ALl that in a secure way of course. the process of check oaut is slowing the response. Thanks
It depends what you mean by "authenticate the user". OAuth as implemented by Endpoints (and demonstrated with samples) suggests you authenticate the user the first time they use the application (either at install time, or each time they load the app in the browser). From then on, the identity of the user is represented by a token, managed by the client library, and sent along with each request. The server will _always_ verify this token to determine who is making the request, but it does not require user-facing interaction. If you're asking whether you can use OAuth without continually making the user identify themselves (via an OAuth popup, etc.), yes, this is the way it works by default in the samples. If you're asking whether you can use OAuth without verifying the tokens on each request, you _could_ , but it's not worth doing, because it doesn't get you a lot from a security perspective or save you much performance-wise.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "google app engine, authentication, oauth, oauth 2.0, google cloud endpoints" }
How to make a custom number formatting for trillions in google sheets I found this online which formats thousands, millions, and billions [<999950]0.0,"K";[<999950000]0.0,,"M";0.0,,,"B" number format sheet how would you format it so it's by millions, billions, and trillions Link to sheet
this "internal" formatting is by default able to work with only 3 types of numbers: * positive (1, 2, 5, 10, ...) * zero (0) * negative (-3, -9, -7, ...) this can be somehow tweaked to show custom formatting like K, B, M but you always got only 3 slots you can use, meaning that you can't have trillions as the 4th type/slot * * * [<999950000]0.0,"M";[<999950000000]0.0,,"B";0.0,,,"T" ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "google sheets, formatting, string formatting, number formatting" }
flutter want to keep sharedpreferences although shutting down the app Currently, my app lost data after closing the app. But I want to keep sharedpreferences data even if the app shut down. Do you know any good way for it?
`shared preferences` does persist the data, so you might be doing something wrong. Here are other alternatives: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "flutter, sharedpreferences" }
Homotopy invariant line integral? Consider a smooth function $g: \mathbb R^2 \rightarrow \mathbb C$ and define a function $$f(x,y):=\frac{\partial}{\partial x} g(x,y)\frac{\partial}{\partial y} \overline{g}(x,y)-\frac{\partial}{\partial y} g(x,y)\frac{\partial}{\partial x} \overline{g}(x,y)$$ where $g$ denotes the complex conjugate. Is it true that if we integrate $f$ over the boundary $\partial A$ of an annulus $A$ that this integral vanishes, i.e. $$\int_{\partial A} f(z) \ dz=0? $$ Please let me know if you have questions.
Unless I'm mistaken, $g(x,y) = x \cos y + ix \sin y$ is a counterexample. $$f = (\cos y + i\sin y)(-x\sin y - i x\cos y) - (-x\sin y + ix\cos y)(\cos y - i\sin y) = -2ix$$ Evaluating the loop integral of this function about the circle $|z| = 1$ yields $$\oint_{|z| = 1}f(z)\, dz = \int_0^{2\pi}2e^{it}\cos t\, dt = 2\pi$$ Evaluating the loop integral of this function about the circle $|z| = 2$ yields $$\oint_{|z| = 2}f(z)\, dz = \int_0^{2\pi}8e^{it}\cos t\,dt = 8\pi \neq 2\pi$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "real analysis, integration, complex analysis, functional analysis, analysis" }
Finite product of complex functions Reading a Russian book "Lectures on Mathematical Analysis" by Arkhipov, Sadovnichy and Chubarikov, in the section "Integral Sums Method" I encountered an equality, which I cannot prove. Here it is: $$ \prod_{k=1}^{n}|(\alpha-e^{ix_k})\cdot(\alpha-e^{-ix_k})|=|\alpha^{2n}-1|, x_k={\pi k\over n} $$ Could somebody, please, explain, how to prove this. I think it has something to do with root of unity.
**Hint:** Consider the roots of $f(x)=x^{2n}-1$. What is $f(\alpha)$?
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "complex numbers" }
Limit $\lim_{x \to 0} \left(\cot x-\frac{1}{\sin x}\right)$ Im having trouble calculating this limit: $$\lim_{x \to 0} \left(\cot x-\frac{1}{\sin x}\right)$$ I've tried factoring out $\frac{1}{\sin x}$, $\cos x$, $\cot x$ and it doesn't lead me anywhere. I also tried looking at alternative form $\frac{\cos x-1}{\sin x}$, with no luck. I can't use l'Hospitals rule. Can anyone help? I think this is super easy but somehow I'm stuck.
$\frac{(\cos x-1)(\cos x +1)}{\sin x (\cos x+1)}= \frac{\cos^2-1}{\sin x(\cos x +1)}=$ $\frac{-\sin^2 x}{\sin x(\cos x+1)}=\frac{-\sin x}{\cos x +1}$. And now?
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "calculus, limits, trigonometry" }
Selenium Webdriver: org.openqa.selenium.NoSuchElementException I am getting error as below :- > org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //*[@id='userId'] Here is my HTML code: <input type="text" name="_ssoUser" id="userId" class="inforTextbox required" data-localizedtext="placeholder:UserID" aria-required="true" placeholder="User Name"> I have tried all below options, nothing is working. WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='userId']"))); WebElement userid = driver.findElement(By.name("_ssoUser")); WebElement userid =driver.findElement(By.xpath("//*[@id='userId']")); WebElement userid = driver.findElement(By.id("userId")); driver.switchTo().frame(1); driver.switchTo().frame(driver.findElement(By.name("_ssoUser")));
You can use below xpath //input[@id='userId' and @name='_ssoUser' and @placeholder='User Name'] If your above element is present after frame then you need to switch first and then look for the element Another thing is you can switch to frame by frame xpath,name or frame id also. Try that too You can check first weather your element is present or not in your HTML DOM to prevent from error/failer of script. like below:- if (driver.findElements("YOUR LOCATOR").size() != 0) { driver.findElement(YOUR LOCATOR).click(); System.out.println("element exists"); } else{ System.out.println("element is not exists"); } Hope it will help you :)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "java, selenium, selenium webdriver" }
Google AdWords custom conversion tracking We are using AdWords to promote our business and have a customer enquiry form which is tied in to AdWords conversion tracking. Whenever an enquiry is submitted via the form it counts as 1 conversion. What we would like to do is somehow tie the conversion to the name submitted with the form so that we can later review if this person actually made a purchase and thus determine our ROI. Is this possible with AdWords and if so where would I have to look to learn how something like that is implemented. I'm willing to hire a developer for this but also assume this is a simple job. I would greatly appreciate it if someone could point me in the right direction.
I solved it by using goal conversion in Google Analytics... more specifically a header match that contains the customer enquiry info i.e. last name. This is the code used on the form to make it work: onSubmit="javascript: surname = document.getElementById('surname'); _gaq.push(['_trackPageview', 'email/' + surname.value]);"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "google analytics, google ads api" }
Maximum number of non-zero elements for an (n, n) matrix product Is there a relationship to describe the maximum number of non-zero elements for any matrix, A, of size (n,n), such that the matrix product AA is equal to the zero matrix? Just curious about how to solve this question.
The maximum number is in fact $n^2$, i.e., all coefficients can be non-zero. Consider $$ A=\begin{pmatrix} 1 & -1 \cr 1 & -1 \end{pmatrix}. $$ Then $A^2=0$. Another example is $$ A=\begin{pmatrix} 1 & 1 & -2 \cr 1 & 1 & -2 \cr 1 & 1 & -2 \end{pmatrix}. $$ You can generalise this, if you want.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra, matrices, linear transformations, matrix equations, matrix calculus" }
Where to put a Django template's dependent files? My Django templates use a lot of related stuff: images, style sheets, etc. Where should I put these file, or how should I refer to them in the template itself? For now I'm using the development server. I know it's a really common thing, but I can't really figure it out.
I put them inside a folder named `static`, which is in the web project's top level folder. Example: > /static/img/ > /static/js/ > /static/css/ > /templates/ > urls.py > settings.py I then have the following rule in my `urls.py` file: (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), My `settings.py` contains: MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static').replace('\\', '/') ADMIN_MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static/admin').replace('\\', '/')
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "python, django, django templates" }
Fastest stable duplicate removal algorithm I have an array and I need to get out of it array, without duplicates. I must leave those unique elements that have a minimal order in the original array. That's roughly I mean NoDuplicate(A, value) for int i = 0 to i < A.length if A[i] == value return true i++ return false StableRemoveAlgo(A) for int i = 0 to i < A.length if NoDuplicate(result, A[i]) result.append(A[i]) return result If there is a faster algorithm than this simple one? **UPDATE:** I cannot sort an array. I need a "stable" version of duplicate removing algorithm. So, if `A[i] == A[j] and i < j` algorithm must remove element `A[j]`
As you're traversing the array, put every (unique) element that you encounter into a hash table or a tree. This will enable you to quickly check -- while examining `k`-th element -- whether you've encountered the same number in the previous `k-1` elements. A tree would give you overall `O(n log(n))` time complexity. A hashtable with a good hash function will do even better (potentially `O(n)`).
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "algorithm, language agnostic, duplicates" }
Как Telegram боту узнать новых пользователей, которые добавляются в чат? - C# Пишу бота для администрирования чата. Подскажите, как боту узнать новых пользователей, которые добавляются в чат? Как это реализовать?
Это делается очень просто - у объекта Message есть поле **new_chat_member** типа User, соответственно при получении апдейтов проверяйте объект **Message** на наличие непустого поля **new_chat_member** , это и будет означать, что в чат добавлен новый юзер. **Пример** : if (update.Type == UpdateType.MessageUpdate && update.Message.NewChatMember != null) { await bot.SendTextMessageAsync(update.Message.Chat.Id, $"*{update.Message.NewChatMember.FirstName}, добро пожаловать!*", true, false, 0, null, ParseMode.Markdown); return; }
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "c#, telegram bot, telegram api" }
android app not installing, eclipse juno I'm using Eclipse IDE for Java EE Developers. I created my first android application project, and it's supposed to display the Hello World message, but I run it and get nothing(well, the emulator starts but then nothing), no console output view, no error.If I run it again the console appears(...WARNING: Data partition already in use. Changes will not persist!) and the emulator opens in new window but again nothing Please tell me what's wrong and how to install and run the app? after first run(pic1&2), after second run (pic3) !first run !emulator !second run
It sounds like the emulator is already running and you are launching a new instance of it... based on the log it has been launched earlier and perhaps it hasn't shut down properly. -Restart adb as poitroae suggested in an earlier answer. -If that doesn't help, restart Eclipse. -If that doesn't help, restart your computer. If you're still having issues after that, post back.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "android" }
Migrating existing VARCHAR values to an Enum in Postgres 8 I have a table in production with values in a varchar column, but this column has now to be an enum. I've already created the enum, but how to migrate the existing values to the created Enum. Will the database automatically map/migrate the existing values to the Enum by simply changing the column type? Edit: ALTER TABLE table ALTER COLUMN column TYPE new_enum_created; I don't know if it might be useful but we use flyway for the migrations.
You have to use a `USING` clause to tell PostgreSQL how to convert the data: ALTER TABLE "table" ALTER COLUMN "column" TYPE new_enum_created USING "column"::new_enum_created;
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "postgresql, enums, migration" }
Networkx 2.2: degree_assortativity_coefficient with weights I have got the following error when I am using with weights: outIn=nx.degree_assortativity_coefficient(net, x='out', y='in', weight='weight') The error is File "/usr/local/lib/python3.5/dist-packages/networkx/algorithms/assortativity/mixing.py", line 160, in degree_mixing_matrix mapping = {x: x for x in range(m + 1)} TypeError: 'float' object cannot be interpreted as an integer It works without the weights! What is happening?
After some test I discovered that edge weights have to be integers. See _M. E. J. Newman, Mixing patterns in networks, Physical Review E, 67 026126, 2003_ for futher information on the assortativity algorithm.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python 3.x, networkx" }
MySQL Update Text field using TRIM(TRAILING I am trying to remove a carriage return in a MySQL Text type data field using the Update command. I've tried the following and when I export a record and view in a text editor (image attached) I still see this character? What should I use to remove this? update fort_property_res SET property_information = TRIM(TRAILING '\n' FROM property_information update fort_property_res SET property_information = TRIM(TRAILING '\r' FROM property_information update fort_property_res SET property_information = TRIM(TRAILING '\t' FROM property_information !What I see in a text editor
Harder than it seems as though it should be, yes? Here is a way that works. Perhaps not the best, but it can get you started. I tried something using rlike and it did not work with my first try. It seems that it should have though. O well. mysql> create table foo (pk int primary key, name varchar(8)); Query OK, 0 rows affected (0.62 sec) mysql> insert into foo values (1, 'aaa\t'); Query OK, 1 row affected (0.18 sec) mysql> select * from foo; +----+------+ | pk | name | +----+------+ | 1 | aaa | +----+------+ 1 row in set (0.00 sec) mysql> update foo set name = substr(name,1,length(name)-1) where hex(name) like '%09'; Query OK, 1 row affected (0.23 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from foo; +----+------+ | pk | name | +----+------+ | 1 | aaa | +----+------+ 1 row in set (0.00 sec)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql" }
Check if an Object is an Array or a Dict I'd like to check if var is an Array or a Dict. typeof(var) == Dict typeof(var) == Array But it doesn't work because typeof is too precise: Dict{ASCIIString,Int64}. What's the best way ?
If you need a "less precise" check, you may want to consider using the `isa()` function, like this: julia> d = Dict([("A", 1), ("B", 2)]) julia> isa(d, Dict) true julia> isa(d, Array) false julia> a = rand(1,2,3); julia> isa(a, Dict) false julia> isa(a, Array) true The `isa()` function could then be used in control flow constructs, like this: julia> if isa(d, Dict) println("I'm a dictionary!") end I'm a dictionary! julia> if isa(a, Array) println("I'm an array!") end I'm an array! * * * **Note:** Tested with Julia 0.4.3
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "julia" }
How to enable-disable input type="text" when select value from dropdown list I have a drop-down list) and one is input type="text". what i want if i select value{2,3} from drop down list not first value then input type will be disabled and if i select again first value then it will be enable.
Let's suppose you have this HTML code: <select id='dropdown'> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <input type="text" id="textInput" /> Then you can act on `change` event on `<select>` to make `<input>` disabled or enabled by adding an event listener. Since you're using jQuery (as you've added `jquery` tag to the question), the example code could look like this: $('#dropdown').change(function() { if( $(this).val() == 1) { $('#textInput').prop( "disabled", false ); } else { $('#textInput').prop( "disabled", true ); } }); Here's a working fiddle: <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -5, "tags": "javascript, php, jquery, css, html" }
How to configure BIND for domain name with own nameservers? I am using BIND 9.10.3_P2 to setup DNS records for domain speedydrive.net. The domain itself has glue records on parent servers with 2 IP addresses for NS servers. Everything looks fine except the fact that when I check if DNS is OK, I get this result: Check DNS: < It claims mismatching NS records, missing SOA, etc. Is there really a problem in the domain name configuration, or is it a problem of the intodns check tool which reports some bullshit? How can I check (using Linux command line) that the domain's DNS is configured properly? I have one personal domain configured in EXACTLY the same way (only using different bind version 9.10.1_P1 on different servers IP addresses) and that domain reports no errors at all at intodns. There is also no firewall anywhere. So I am puzzled. Thank you
The issue is due to the difference between the DNS name using capitals, and a interaction between BIND changes and (now) buggy script/commands due to issues with case sensitivity. This URL check_dig is case sensitive, together with this one check_dig: expected answer is now incasesensitive should shine a light in similar problems at the application/scripting level. This is where the change that provoked the aforementioned behaviour in BIND 9.9.5 is documented: Case-Insensitive Response Compression May Cause Problems With Mixed-Case Data and Non-Conforming Clients
stackexchange-unix
{ "answer_score": 1, "question_score": 3, "tags": "dns, bind" }
Posthumous authorship or acknowledgement Suppose I am working on a book that is a broad expansion of a survey article I wrote with a collaborator, Dr. Y, who passed away recently. I sent Y extremely early drafts of some chapters and invited Y to be a coauthor. Y gave a lot suggestions in the structure, content, and style of the book, yet Y remained vague about coauthorship (probably because he had doubts if he will live long enough). Y never said yes or no. Y never participated in the actual writing. But Y's suggestions became the high level blueprint that guided the development of the book. This draft is only about 60% done, but I'm wondering: in this case, should Y be a coauthor?
There may be laws that govern this, though laws vary from place to place. Normally he would have to give permission and that "right" may legally have passed to his heirs. You would do well to contact someone responsible for his estate and take up the question with them. But since he never gave permission, you don't have permission, yet, to include him. You have an obligation to acknowledge his contribution and probably cite some of the specifics as well, even though they haven't been published. Dedicating the book to his memory would be a nice touch also.
stackexchange-academia
{ "answer_score": 9, "question_score": 5, "tags": "authorship, death" }
Run command in Container for Linux during Azure Devops Pipeline Release Currently I'm deploying my docker image into AppService for Linux from AzureDevops. I want to run some migrations before the container became fully available. The db migrations are executed by calling a cli command in my container. How can I achieve this from DevOps pipeline? 1. Is there a way to SSH to the specific _not fully deployed_ container? 2. Is there a way run a cli command without configuring SSH? 3. Is there any other recommended way for migrations/running some scripts before making the container available?
I suppose you have 2 options: 1. run some sort of init script that does the migrations and then starts the web server\what have you process that's actually doing the work 2. modifying entrypoint\command that the container runs by default, so it does that on its own (dockerfile reference). something like this: RUN /bin/bash -c 'run migrations; run payload'
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "azure devops, azure pipelines" }
Java using relative path instead of absolute path I am reading in a file in Java and when I use the absolute path it works fine. File myObj = new File("/Users/aaronmk2/Downloads/demo2/SystemDependencies/src/sample_input.txt"); However, when I try to use the relative path I get a No such file or directory error File myObj = new File("../sample_input.txt"); When I use my terminal and use `nano ../sample_input.txt` it opens up the file. What do I need to add to get the relative path to work?
Java does relative paths just fine. Clearly, then, the 'current working directory' for your java process is not the same as the cwd when you're invoking `nano`. You can check the CWD in java. Either way will work: System.out.println(new File(".").getAbsolutePath()); or: System.out.println(System.getProperty("user.dir")); You should find that it is different. The 'cwd' for a java process is the cwd that it was set to by whatever started java. If you're invoking java from the command line, it'll be the directory you're in as you do so. If you are double clicking a jar, it'll be the directory the jar is in. If you're making a windows shortcut, it's the directory listed in the shortcut. Example: cd /foo/bar java -jar /bar/baz/hello.jar In the above example, the cwd is `/foo/bar`. Not `/bar/baz`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, relative path, readfile" }
Why are there System.*.* dlls in my bin release directory? When building my application which consists of 10 lines of code and has dependency to Zeroconf & Newtonsoft.json, it produces around 104 dlls in my bin release directoy and a lot of them are System. _._ dlls. Why? How can I reduce it to 3 dlls? one for my lib, one for zeroconf and one for Newtonsoft.Json. !Screenshot nuget After installing .Net 4.7.1
This is a .net standard 2.0/net 4.6/4.7.1 issue which was improved in 4.7.2: > "In .NET Framework 4.7.2 we have addresses the known runtime issues with .NET Standard 2.0. We made changes to the runtime to ensure **that you don’t need additional files deployed along with your .NET Standard library** " So, run Visual Studio 2017 Installer and install .Net Framework 4.7.2 and the Target Pack and target your app as .net 4.7.2.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 5, "tags": "c#, visual studio" }
Cannot open some tables in phpmyadmin Recently i get backup of my database from host in that backup i get table in .ibd,.frm,.myd format . I placed this files in > xampp->mysql->data->test . Now i can open the tables in php myadmin. Now i can open some tables .But some files i can not open . When clicked it showing `932 - Table 'table.name' doesn't exist in engine` . And also i noticed in the collection column it is showing in use Why this happen . Please help to solve ![enter image description here](
You can copy frm and ibd files ONLY if the tablespace ID in idb file is the same as the tablespace ID in ibdata1, if it's not then the data will be corrupt and you will be missing tables. When I had that problem I used this resource to recover files: * Recover InnoDB into MySQL You may also find these links useful: * Recover InnoDB from ibd File * Manually Importing InnoDB MySQL Table Files
stackexchange-dba
{ "answer_score": 0, "question_score": 2, "tags": "innodb, mysql 5.5, phpmyadmin" }
Accessing Properties in object > **Possible Duplicate:** > JavaScript property access: dot notation vs. brackets? <script> var foo = { name: 'kevin' }; document.write(foo.name); document.write(foo['name']); var cool = 'name'; document.write(foo.cool); document.write(foo[cool]); </script> 1. Why does `foo.cool` returns me undefined where as `foo[cool] returns me kevin`. 2. How does cool actually refer to my name property in foo object.
1. A `cool` property is not defined on `foo`, so `foo.cool` is undefined. If you did `foo.name`, it would return `kevin`. 2. `cool` in `foo[cool]` is the one you defined in the line above it, so it is actually `foo['name']`, which is defined and has the value `kevin`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "javascript" }
Internship verbal offer but no offer letter I received an offer over the phone for an internship out of state. I was told my salary, start date, and last day to accept the offer. I know the company provides housing assistance, so I asked if could get any help with moving. The HR lady said she can do that for me. It has been two weeks since I spoke to her and the last day to accept the offer is in a week. Would it make sense to email the HR lady and ask when I should be expecting the letter? Or should I just remain patient?
It not only makes sense, it's necessary. **If you don't have an offer in writing, you don't have an offer.** Simply state that you need something in writing to respond with acceptance.
stackexchange-workplace
{ "answer_score": 2, "question_score": 1, "tags": "job offer, internship, human resources, relocation, start date" }
How does the choice of transaction models ACID or BASE affect UX design? How does the choice of database transaction models: ACID (Atomicity, Consistency, Isolation, Duratbility) or BASE (Basic Availability, Soft State and Eventual Consistency) affect UX design? Can someone share an example of how choosing one of these database models makes difference in user experience design?
# Database design is critical! As are all architectural decisions. This is why a software architect should be a part of the UXD process. The choice of back-end architecture isn't something the UXD can decide, but user-facing factors can be evaluated from a UX perspective. These database considerations will impact product experience: * Is the product highly transactional? * Is "dirty data" a major concern? * Will transformations of the data be heavily queried against? * Is confidence or speed a greater concern? * Are there legacy or third-party back-ends to integrate with? * ... etc ... ^ All of those factors will impact the responsiveness of the interface and the trust established with the user.
stackexchange-ux
{ "answer_score": 0, "question_score": 0, "tags": "design, consistency, transactions" }
How can I define a local variable in a function in PHP? I have this code: require_once('../config.php'); function ha(){ global $user; /* I need this to define local-only access from this function */ return $user; } echo ha(); echo $user; /* Global variable value */ So how can I define a local variable in the function that will be accessed through inside function ha()? So the output from the `echo ha();` will be the value $user that is stored in file _config.php_ , and the last line `echo $user` needs to be empty on echo...when I define $user in function static I get an empty value...so how can I define a static value of variable in PHP that is read from file _config.php_ and only access the value in the function?
function ha(){ global $user; $user2 = 'abc'; // No prefix whatsoever echo $user; // Prints global $user echo $user2; // Prints local $user2 } > how can I define a static value of variable in PHP that is read from file _config.php_ and only access the value in the function? It's all about variable scope. If you want a variable to be defined in the configuration file and only be readable from within a function, then your current approach is incorrect. Anything declared in the main scope (such as the configuration file loaded in the main scope) will be accessible from nearly anywhere in the code. If you don't want variables to be accessed otherwise than through `ha()` then they need to be defined within `ha()`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "php, global, local" }
Matching last character of string fails I cannot understand why this very simple regex is failling: "3243" ==~ /^\d+$/ I want val to only be a string of numbers. The following return true: "213213" ==~ /^\d+/ "213213dsadasd" ==~ /^\d+/ These are part of a field validation in a domain object. This is the complete code: static constraints = { intValue validator: {val,obj -> if(val){ "${val}" ==~ /^[0-9]*$/ } } } The above example will accept "321a31" or "321aa"... Not sure if the regex is wrong or something else is off... intValue is an Integer, although the default validation would accept strings like '32112dsa'(and only store the numeric part) thats why I am trying to create a custom validator.
The reason the regex was not making any difference is that the values reaching the domain object field were already parsed automatically. A workaround for this can be found on this answer: Grails GORM integer validation
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "regex, grails, groovy, matcher" }
Php time and datatime object So, I know a lot of requests and question has been askeb about this subject but none really worked for my case... I'm working on a liscensing api with php (supposed to be easy) and I get a string date (2000-01-01) from my db and the length of the subscription. So I'm creating a DateTime Object with it using this : $created_at = date_create($result["created_at"]); date_add($created_at, date_interval_create_from_date_string($result["length"]." days")); But for some unknowed reason, It seems I can't get the current date in a DateTime object so I can just compare them with <>=. Even if I use `date_sub() or date_diff()` It still require two DateTime object. I'm really deseperate at this point so I figured I could ask for some help. Hope I didn't miss anything obvious
You can use the 'now' attribute, `$today = new DateTime('now');` to get the current time. Don't forget to set your timeregion in your php.ini to be able to get the right time. And if you want to compare them, you can use `date_diff` and then `$var->format('%r')` to get the value. %r is going to be empty if the result is positive. Good luck!
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "php, datetime" }
Dynamics CRM v4 monitor mailbox for a queue Hi I want to set up Microsoft Dynamics CRM to monitor a single mailbox using pop3 and then have any mails in that mailbox added as email activities to a queue in CRM. I have set up the pop3 mail box and I know that it works. I have set up the email router with an incoming profile for the mailbox. I have a queue called "inbound" in CRM and I can see it in the Users and Queues section of the Email router interface. Its inbound profile is set to the correct profile. I have published the changes but the emails do not make it into the queue. CRM is definitely accessing the mailbox and downloading the emails... so where are they going?
A couple of things to check. When you open the queue in CRM make sure that the "Incoming Email" option is set to "All e-mail messages", also make sure that the "E-mail access type - incoming:" and "E-mail access type - outgoing" are both set to "Forward Mailbox". Now, go back to your email router configuration screen and make sure you've set up the right forwarding rule with the queue's email. Do a test and see if both inbound and outbound succeed.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "queue, dynamics crm, dynamics crm 4, router" }
Could monitors in general work in lesser resolutions than officially supported? For example this Iiyama 25" ProLite E2591HSU-B1 monitor is 16:9 format, but the only resolution of same format it officially supports is 1920*1080. Could it work in 1280*720 mode? This is user manual for this monitor: < And the last page has this table: ![enter image description here]( The only single 16:9 resolution there is the last one... but I need lower.
If the manual does not list the resolution, the chance is high that it will not work, or not work as expected. It would not be the first time I try a resolution that is not in the manual, and that it works. But it also not the first time when I think a resolution should work even though it is not in the manual, because it is a very standard resolution, only to find out that it doesn't work. That said, keep in mind that when you go to a resolution that is not the native resolution, the image quality will always degrade because it has to perform scaling from an arbitrary resolution to the native one, so the image becomes blurry. If you want to use a smaller resolution in Windows, then use the native resolution and increase the DPI to make everything bigger. If you run an application that specifically needs this resolution, contact the developer of the application and ask for 1080p support.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "display, resolution" }
How to specify accepted certificates for Client Authentication in .NET SslStream I am attempting to use the .Net System.Security.SslStream class to process the server side of a SSL/TLS stream with client authentication. To perform the handshake, I am using this code: SslStream sslStream = new SslStream(innerStream, false, RemoteCertificateValidation, LocalCertificateSelectionCallback); sslStream.AuthenticateAsServer(serverCertificate, true, SslProtocols.Default, false); Unfortunately, this results in the SslStream transmitting a CertificateRequest containing the subjectnames of all certificates in my CryptoAPI Trusted Root Store. I would like to be able to override this. It is not an option for me to require the user to install or remove certificates from the Trusted Root Store. It looks like the SslStream uses SSPI/SecureChannel underneath, so if anyone knows how to do the equivalent with that API, that would be helpful, too. Any ideas?
It does not look like this is currently possible using the .NET libraries. I solved it by using the Mono class library implementation of System.Security.SslStream, which gives better access to overriding the servers behavior during the handshake.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "c#, .net, ssl, sspi" }
Apache blocking valid Allow from <ip> client I am trying to block public access to `apc.php` file. Initially this configuration worked, now it doesn't. I know this is where the issue lies because when I comment out the ACL I can access the file just fine. Yes I've restarted the server on configuration changes. I've tried plenty of variants of allowing a host (using CIDR and the exact client IP). <Files apc.php> Order Deny,Allow Deny from all Allow from 192.168.1 </Files> and [Mon Jun 11 08:00:51 2012] [error] [client x.x.x.x] client denied by server configuration: /var/www/html/apc.php
You should change Order: order allow,deny <\- changed to make 'deny from' rules get applied after 'allow from' and in allow from you must be more specific: allow from 192.168.1.0/24 Your Config should look like this: order allow,deny deny from 192.168.0.37 allow from 192.168.0.0/16 <\- removed the 'deny from all' - this will be implicit because of the 'order' directive above Satisfy any
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "apache 2.2, httpd" }
Java class that automatically listens on a port for specific string(s)? I have a very basic need. I want to listen on a specific port for any one of a hand full of basic administration commands like "STOP" or "reboot". For now I don't even care about verifying who the messages come from. Now I can obviously create a serversocket, have it spawn a listener for each new socket, then buffer messages to look for one I'm expecting, I've done that all before it's not impossible to do. However, I'm wondering if there is some Java class or library out there that does most of that work for me. Something less robust as a full JAX-RS server but still per-written?
I think using one of these, would be easier than writing from scratch: < <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java" }
What is the lifecycle of Oracle Linux for minor releases? We are discovering Oracle Linux and considering the move from other RHEL clones. One question that's remains unanswered is: what's the lifecycle of minor releases on Oracle Linux? Do we get updates, on the free tier, when a new point release is available for the previous ones? Exemple: I need to install an Enterprise Linux 7.7 server, on CentOS world we need to get the ISOs from CentOS Vault and there's only updates to the last day before CentOS 7.8 is released. In other hand on RHEL there will be some security updates for RHEL 7.7 even if 7.8 is already released for a period of time. So RHEL is a better fit than CentOS in this case. So which is the policy on Oracle Linux in this case? Where I can read about it? How can I pin Oracle Linux to keep a point release and maintain it patched just like in RHEL? Thank you all.
Oracle's lifecycle for Oracle Linux is _only_ at the major release level, not the minor. (see here: < The important part of the version for software compatibility is the "7", not the ".x". Oracle Linux 7.8 just as a newer kernel than 7.7; they're not "separate" releases. If you need to maintain security, then you need to install kernel patches as they are released. Particular kernel patches will _automatically_ increase the point release of the Oracle Linux OS; the point version is an indicator of the minimum kernel version. This happens once or twice a year in my experience. I've never seen software that had an issue with that - that wouldn't release its own update to support a new kernel version if necessary. If you have to freeze the kernel version to support something specific, then by definition security isn't really critical - I don't think you can have it both ways.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 2, "tags": "centos, redhat, oracle linux" }
unable add case condition inside a where clause in oracle I have a procedure where I intialize the variable `i:=0` and I increment every time a loop runs. I need where should return one condition when `i:=0` and other when `i>0` Query I wrote Select ID from table where case when i=0 then time <=end_time when i>0 then time>start_time and time <=end_time Could exactly get what should be done.
I think instead of using case statement for this scenario you can rewrite your query as below:- Select ID from table where (i=0 and time <=end_time) or (i>0 and (time>start_time and time <=end_time));
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "oracle, case, where clause" }
php hash('crc32') and crc32() return different value i want to ask about PHP crc32 hashing. i'm tried using `hash('md5','value')` and `md5('value')` its return same output. > output : 2063c1608d6e0baf80249c42e2be5804 but when i'm try to use `hash('crc32','value')` and `crc32('value')` its return different output. > hash() output : e0a39b72 > > crc32() output : 494360628 anyone know why it can return a different output? thanks :)
> `hash("crc32b", $str)` will return the same string as `str_pad(dechex(crc32($str)), 8, '0', STR_PAD_LEFT)`. See manual and also about difference between crc32 and crc32b
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "php, hash, crc32" }
幾人も or 一杯? Kanji or hiragana? I am writing the following sentence: And I'd like to know if could be a more respectful/more natural replacement for , and whether I should be using kanji.
> **** This sentence is OK. The only thing I would change to make it more natural would be the . Using would make it far more natural. > And I'd like to know if {} could be a more respectful/more natural replacement for {}, and whether I should be using kanji. Using in this context would be a bad idea. Why? Because it only means "many" mostly when the number is a dozen or two **_at the most_**. São Paulo has about a million Japanese and Japanese Brazilians, correct? That is definitely **_way_** too many to call . I would not worry about writing using kanji. Your sentence is already very informal with the use of and . is more informal than many J-learners seem to think.
stackexchange-japanese
{ "answer_score": 2, "question_score": 1, "tags": "kanji, politeness, counters, idioms" }
where to put time format rules in Rails 3? I am finding myself repeating typing many strftime which I defined. Having watch Ryan Bates's railscasts ep 32/33( I think), I created a custom option for the to_s method as in Time.now.to_s, so that I can do Time.now.to_s(:sw), where :sw is my custom method, to retrieve "23 Sep 2010, 5:00PM" for example. But the problem is, I don't know where to put #sw's definition. Should it be in a file in in the initializer folder? Or should it go in application.rb? Thanks!
I have a file `config/initialisers/time_formats.rb` containing: ... Time::DATE_FORMATS[:posts] = "%B %d, %Y" Time::DATE_FORMATS[:published] = "%B %Y" ... You just need to restart your server to have the changes picked up.
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 24, "tags": "ruby on rails, helper" }