qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
4,207,709
I am using Windows 7 64bit and I am trying to get my computer to detect my HTC Desire, but it's not picking it up. I have everything available installed through the Android Updater and I have got my phone running through Ubuntu, so it is definitely a problem with Windows. Does anyone know what's wrong or how to get it ...
2010/11/17
[ "https://Stackoverflow.com/questions/4207709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/348261/" ]
Had this problem on Windows 7 x64 and uninstalling in device manager then selecting manual install gave an error (something like: ensure driver is 64-bit compatible). Resolved as follows: 1. Connect phone 2. Run [USBDeview](http://www.nirsoft.net/utils/usb_devices_view.html) as Administrator 3. Sort by Serial Number 4...
I had a similar problem of not being able to launch the Android app from Eclipse on real phone and not in AVD. Once I installed HTC Sync, it did the magic and I was able to use real phone. Cheers, Madhu
8,271
I wanted to carry out a two-way ANCOVA for my data. However, SPSS isn't liking that I have only one IV. I have * One IV: Group (3 levels, i.e. 2 experimental groups and a control group), * One DV: outcome measure (2 levels, i.e. time 1 and time 2), * One covariate (I have checked and this demographic continuous var...
2011/03/14
[ "https://stats.stackexchange.com/questions/8271", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/-1/" ]
I am guessing that you have your data in wide format. This seems to be causing you confusion because in wide format it is less obvious that "time" is your second independent variable. One option in SPSS for doing what it sounds like you want to do: 1. `Analyze -- GLM -- Repeated Measures` 2. Enter time as repeated me...
Set it up as a regular regression, they are mathematically equivalent, just make sure your non-continuous variables are defined appropriately (as categorical or whatever) to SPSS.
33,842,521
I have an ASP.NET application running on a dedicated server "Windows Server 2012 R2". The site uses SSL encryption throughout, the certificate is correctly installed on the server and shows as valid when accessed through different browsers. I now want to send emails through my application, to do this I set up an SMTP ...
2015/11/21
[ "https://Stackoverflow.com/questions/33842521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2321152/" ]
I managed to find a solution to my original question. Instead of sending directly from my application, I set up my SMTP server to use a pickup directory instead. The application code is very simple now, specifying the delivery method and pickup directory can also be moved into the configuration file. ``` SmtpClient c...
this may be the reson SMTP service on the server is not using the same certificate as https. The [diagnostic steps I had read here](http://blogs.msdn.com/b/jpsanders/archive/2009/09/16/troubleshooting-asp-net-the-remote-certificate-is-invalid-according-to-the-validation-procedure.aspx?Redirected=true)
1,718,412
I have a small question: how do I find out what type a C++ pointer is? I often use a small function in my console programs to gather input, which looks something like this: ``` void query(string what-to-ask, [insert datatype here] * input) ``` I would like to create a generic form, using a void pointer, but I can't...
2009/11/11
[ "https://Stackoverflow.com/questions/1718412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/144734/" ]
If you control the datatype yourself, I would probably make a class/struct that contains an enum of all of the data types you care about and pass that. You could then query the passed in pointer for it's datatype, and then cast appropriately. IE ( pseudo code warning - treating this as a struct for now. ) ``` class ...
If I understand what you're asking then the usual way to do this is to create an interface class that supports `query(string what-to-ask)` and then instead of using a void pointer just pass a pointer to the interface. Then you can call query() on that instance.
1,088,793
What is a culture-invariant way of constructing a string such that the Javascript Date() constructor can parse it and create the proper date object? I have tried these format strings which don't work (using C# to generate the strings): ``` clientDate.ToString(); // gives: "11/05/2009 17:35:23 +00:00" clientDate.ToSt...
2009/07/06
[ "https://Stackoverflow.com/questions/1088793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111934/" ]
[According to MDC](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date/parse): > > Given a string representing a time, `parse` returns the time value. It accepts the IETF standard ([RFC 1123](https://www.rfc-editor.org/rfc/rfc1123) Section 5.2.14 and elsewhere) date syntax: `"Mon, 25 De...
If you want a locale-independent format Javascript can parse, you can use `2013-03-31T16:36:57+0900`. It works at least in Node.js and Chrome, so I suspect it's standard.
140
What properties should I look for in a good wire for building a wire antenna? Could anyone recommend something specific for me?
2013/10/22
[ "https://ham.stackexchange.com/questions/140", "https://ham.stackexchange.com", "https://ham.stackexchange.com/users/106/" ]
Because of the skin effect, which causes most of the electric current to be concentrated around the outer surface of the wire at high frequencies, larger gauge wire is needed for RF than for an equivalent DC current. As a general rule of thumb, 16 gauge is sufficient up to 100 watts, but 12 would be ideal. Any system e...
Be sure that the wire that you use is acceptable legally as well as physically. In any place were the National Electric Code (NEC), that is used in much of the United States, is enforced as law the minimum size of wire that can be used for an amateur radio transmitting antenna is number fourteen American Wire Gauge (14...
13,326,877
I have very simple code that includes ImageButton with OnClickListener that points to another Activity, the click on the ImageButton doesn't fire the onClick (The same problem was with Button) : ``` public class ToolsActivity extends Activity { private ImageButton btnCamera; final Context context = ToolsActivity.this;...
2012/11/10
[ "https://Stackoverflow.com/questions/13326877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/315264/" ]
I can't see anything wrong with the code. If it works with a regular button my guess is that you maybe have to set `android:clickable="true"` in the xml (you can also do it in code).
I opened new Android project and copy paste may code, and it works, I guess something with the project was damaged.
24,792,301
I'm trying to use [this](http://iphone2020.wordpress.com/2012/10/01/uitableview-tricks-part-2-infinite-scrolling/) method to implement an infinitely scrolling `UITableView` The core logic of the solution is: 1. To increase the tableview content by a factor of 3, so that we make the 3 copies of the content laid one a...
2014/07/16
[ "https://Stackoverflow.com/questions/24792301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3846979/" ]
Another possible workaround is to create a simple `DataTransfromer` and attach it to the required field. Example: ``` <?php namespace Interprac\Bundle\UtilityBundle\Form\DataTransformer; use Symfony\Component\Form\DataTransformerInterface; class NullToEmptyTransformer implements DataTransformerInterface { /** ...
1. Do not use empty\_data option. 2. And use the placeholder attribute. 3. Ex: ``` array( 'label' => 'textExample', 'required' => false, 'disabled' => false, 'read_only' => true, 'attr' => array('placeholder' => 'DefaultValue') ) ```
3,114,696
I have multiple user types in a system that shows each user different views and templates of the stored information, often based on whether they are logged in and what current\_user.user\_type is. As a result, I have lots of this: ``` #controller @project = Project.find(params[:id]) if current_user.user_type == "Compa...
2010/06/24
[ "https://Stackoverflow.com/questions/3114696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/341583/" ]
If you're having **a lot** of code like this, is a code smell that your controller is really serving multiple purposes. Assuming your controller is something like InfoController, which is a REST view for some Info model, ask yourself: * What is the central piece of your actions, the data or the user who access it? * A...
Can also use constraints as seen here: [User-centric Routing in Rails 3](http://collectiveidea.com/blog/archives/2011/05/31/user-centric-routing-in-rails-3/) ``` root :to => "companies#home", :constraints => UserTypeConstraint.new("Company") ``` Or scoped routes as seen here: [Use lambdas for Rails 3 Route Constrain...
11,448,307
I'm having a bit of a problem trying to import data from a CSV and have a couple of questions on it that I haven't managed to solve myself yet. First off here's my code to help put things in perspective (tidied it up a bit, removing CSS and DB connection): ``` <body> <div id="container"> <div id="form"> <?php $delet...
2012/07/12
[ "https://Stackoverflow.com/questions/11448307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1520179/" ]
``` set_time_limit(10000); $con = mysql_connect('127.0.0.1','root','password'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db", $con); $fp = fopen("file.csv", "r"); while( !feof($fp) ) { if( !$line = fgetcsv($fp, 1000, ';', '"')) { continue; } $importSQL = "INSER...
i think the main things to remember about parsing csv is that it follows some simple rules: a)it's a text file so easily opened b) each row is determined by a line end \n so split the string into lines first c) each row/line has columns determined by a comma so split each line by that to get an array of columns [have...
21,379,444
I'm looking for a data structure that behaves like this: 1. Last in, first out 2. Upon iteration the first item is the item that was last in (LCFS - last come, first served) 3. When max capacity is reached, the 'oldest' item(s) need(s) to be dropped It sounds like a `Queue` would do the trick, but that structure is F...
2014/01/27
[ "https://Stackoverflow.com/questions/21379444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/201482/" ]
.Net has a LIFO "queue" structure called [`Stack<T>`](http://msdn.microsoft.com/en-us/library/3278tedw%28v=vs.110%29.aspx), although this does not fulfill your third constraint (e.g. size constrained). It wouldn't be too difficult to achieve this by means of containment. However... if you want to throw away the oldest...
I would recommend to use the `Stack` class [MSDN Stack Class](http://msdn.microsoft.com/de-de/library/system.collections.stack%28v=vs.110%29.aspx)
747,303
I'm trying to use `parallel` and `ack` together to do some searching in parallel. However, `ack` seems to insist on using `stdin` if it finds itself in a pipe, even if you give it files to search: ``` $ echo hello > test.txt $ ack hello test.txt hello $ echo test.txt | xargs ack hello hello $ echo test.txt | parall...
2014/04/28
[ "https://superuser.com/questions/747303", "https://superuser.com", "https://superuser.com/users/70130/" ]
This happens on the current dev branch as well (`9cc2407`). The reason for this is that when standard input is a pipe, ack tries to be helpful and assumes you're trying to search that input stream. We've not seen this behavior before, so I've brought it up on the ack developers mailing list. In the meantime, you can us...
The problem is due to this line in `ack`: ``` $is_filter_mode = -p STDIN; ``` So these two situations are treated differently in `ack`: ``` cat file | ack ... ack < file ... ``` The workaround for you seem to be to add a `cat`: ``` echo test.txt | parallel cat {} \| ack hello ``` This works in `ack` 2.12.
1,971,246
I recently wrote a piece of code that looked a bit like this: ``` IEnumerable<DTO.Employee> xEmployee = from e in xDoc.Descendants("Employee") where int.Parse(e.Attribute("Id").Value) == emp.Id select new DTO.Employee { Id = (int)e.Attribute("Id"), LastName = (string)e.Element("LastName...
2009/12/28
[ "https://Stackoverflow.com/questions/1971246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/237462/" ]
Check out the explicit operator overloads of the [XAttribute](http://msdn.microsoft.com/en-us/library/system.xml.linq.xattribute.op_explicit.aspx) class. ``` public static explicit operator int(XAttribute attribute); ```
There is an [explicit conversion from `XAttribute` to `int`](http://msdn.microsoft.com/en-us/library/bb358993.aspx) - but there's no explicit conversion from `string` (the type of `XAttribute.Value`) to `int`.
12,639,914
I am using javascript method window.open to get the reference to the other windows of mine service. The main idea is that if I use window.open('', name ) and window with given name exsists then I get the reference to it (and if it is from same domain I can comunicate with it). If it does not the new window has url 'ab...
2012/09/28
[ "https://Stackoverflow.com/questions/12639914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507549/" ]
``` string uri = "file:\\C:\Users\...\...\App_Code\ClassDiagram.cd"; string localPath = new Uri(uri).LocalPath; ``` OR ``` @'C:\Users\...\...\App_Code\ClassDiagram.cd' ``` OR ``` 'C:\\Users\\...\\...\\App_Code\\ClassDiagram.cd' ``` uper three way to solution of you problem
Please see my full answer to a related post on stackoverflow for more details [here](https://stackoverflow.com/questions/18391113/cannot-load-classdiagram-cd-on-visual-studio-uri-formats-are-not-supported/28463971#28463971). Under "WEBSITE", select "Use Visual Studio Development Server..." and then try right clicking ...
6,390,297
I have downloaded a javascript script and one of the first line is : ``` qq = qq || {}; ``` What does it mean?
2011/06/17
[ "https://Stackoverflow.com/questions/6390297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
It checks `qq` for a pre-existing [truthy value](http://11heavens.com/falsy-and-truthy-in-javascript) or else (`||`) sets it as an empty object (`{}`). In essence, it's purpose is to quickly ensure that any further references to qq will not be undefined, so you can check for properties of the object without your scrip...
Explanation: ``` qq = qq || {}; // ^^ is equal to iself, but if it does not exist, // then it is equal to an empty object ``` For example: ``` for(var i = 0; i < 5; i++){ qq = qq || {}; qq[i] = 'something!'; } ``` Fiddle: <http://jsfiddle.net/maniator/dr5Ra/>
13,799,533
**FINAL EDIT - ANSWER** : Thanks for your help everyone. In the end it came down to some htaccess problems in changing the url names and for some odd reason, even when referencing the root (./ajax) it didn't like it. I don't know why still, but it just didn't. When I hard-coded the whole URL in, it worked. Ridiculous -...
2012/12/10
[ "https://Stackoverflow.com/questions/13799533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1312839/" ]
From the commments: To be specific, the problem is that Java's open file operation triggers the OS operation that runs the virus scan, and the solution is to add Java to the list of trusted processes
The problem you have is mostly caused by JNI you are using. As your code wait during constructor for FileInputSream(String). That veryfie the existance of passed path and call a method `private native void open(String)`. Then openJDK implementation of [FileInputSream#open(String)](http://hg.openjdk.java.net/jdk7/jd...
665,903
I need to create a new db in **SQL Server**, and move some data from an **Oracle** db to this SQLServer db; I read that this function can be implemented by using **SSIS** or the **SQL Server Migration Assistant for Oracle**; I wonder if someone can point me to a tutorial or a document where I can see how this task ...
2009/03/20
[ "https://Stackoverflow.com/questions/665903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Have you looked at the [SQL Server Migration Assistant for Oracle](http://www.microsoft.com/sqlserver/2005/en/us/migration-oracle.aspx)? [Step by step document on how to use it](http://download.microsoft.com/download/e/c/8/ec8d5025-7ef7-4dcc-a9f3-9c297cf5350e/SSMAOracle.docx).
How about this: <http://aspalliance.com/947_building_a_sql_server_2005_integration_services_package_using_visual_studio_2005> and this: <http://msdn.microsoft.com/en-us/library/ms169917.aspx>
590,968
I have vdi with quite a number of snapshots taken from it - say, 50 or 70 snapshots. I want to have one plain vdi with a current state. These snapshots take way too much disk space and are not needed as snapshots. I know that if I call ``` VBoxManage clonehd thedisk.vdi thedisk-full.vdi (50-70 times) VBoxManage clone...
2013/05/03
[ "https://superuser.com/questions/590968", "https://superuser.com", "https://superuser.com/users/129273/" ]
Found the solution. It is as simple as the last step from the commands I wrote here. I.e. ``` VBoxManage clonehd fullpath/{uuid-of-last-snapshot}.vdi thedisk-full.vdi ``` So I should clonehd only the last snapshot, not every snapshot from the chain. And it is thousands percent faster. The uuid can be found from `V...
You can try to [export](http://www.virtualbox.org/manual/ch08.html#vboxmanage-export) to [OVF](https://en.wikipedia.org/wiki/Open_Virtualization_Format) and then [import](http://www.virtualbox.org/manual/ch08.html#vboxmanage-import) back the generated file. As explained [here](http://www.virtualbox.org/manual/ch01.htm...
37,945,958
Working with Spark dataframes imported from Hive, sometimes I end up with several columns that I don't need. Supposing that I don't want to filter them with ``` df = SqlContext.sql('select cols from mytable') ``` and I'm importing the entire table with ``` df = SqlContext.table(mytable) ``` does a `select` and ...
2016/06/21
[ "https://Stackoverflow.com/questions/37945958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/307283/" ]
Try getting the information from the input fields with .val() and store it in arrays for AJAX querys or another process operations: JS example: ``` var key = []; var value = []; $("input").filter('.form1').each(function(){ key.push($(this).attr('id');); value.push($(this).val()); }); ``` You can also store ...
Try this: ``` $('<div>').append($('#formId').clone()).html(); ``` I found it [here](https://stackoverflow.com/questions/652763/how-do-you-convert-a-jquery-object-into-a-string). **[Example](https://jsfiddle.net/myrluk3/ns9u6krz/1/)**.
56,684,215
In my application, I need to secure controller access with Spring Security In particular, I would like to allow / disallow the access to all controller methods to users based on grants. Here is an example of Controller: ``` @Controller @RequestMapping("${path.myapp}" + "/accounts") public class AccountsController ex...
2019/06/20
[ "https://Stackoverflow.com/questions/56684215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1537580/" ]
you can use `Stream.from(from: Int, step: Int)` : ``` def generate(): Stream[Int] = { Stream.from(1, 2) } println(generate().take(10).toList) // this will print List(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) ```
As you asked in a comment how to do this with Scala's `2.13` [`Stream.unfold`](https://www.scala-lang.org/files/archive/api/2.13.x/scala/collection/immutable/Stream$.html#unfold[A,S](init:S)(f:S=%3EOption[(A,S)]):CC[A]): ``` Stream.unfold(-1)(i => Some(i+2, i+2)) // immutable.Stream[Int] = Stream(1, <not computed>) `...
26,811,101
I'll caveat this with the fact that I am not a Javascript expert. Not even close. That said, I'm using a [Javascript Polyfill](https://github.com/chuckcarpenter/REM-unit-polyfill/) to allow me to use rem units for text size on a web page and maintain IE8 compatibility: <http://www.joannecorryhair.co.uk/> The script ...
2014/11/07
[ "https://Stackoverflow.com/questions/26811101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1824285/" ]
Note that Vagrant itself, in [the Vagrant::Util::Platform class](https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/util/platform.rb) already implements a more advanced version of the platform checking logic in [the answer](https://stackoverflow.com/a/26889312) by [BernardoSilva](https://stackoverflow.com/use...
When I read the original question according to me it is not how to find out on which OS vagrant it self runs, but which OS do the virtual machines to be provisioned have. That is why you want to run a different provision script depending on the diffent OSses of the new VMs, eg: "/vagrant/provisioning/only\_run\_this\_o...
6,126,433
> > **Possible Duplicate:** > > [How can one close html tags in vim quickly](https://stackoverflow.com/questions/130734/how-can-one-close-html-tags-in-vim-quickly) > > > One of my favorite features of TextMate is the ability to type out a tag, say `<div>`, and press `⌥`+`⌘`+`.`, it will automatically insert th...
2011/05/25
[ "https://Stackoverflow.com/questions/6126433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32154/" ]
I use the [`xmledit`](http://www.vim.org/scripts/script.php?script_id=301) plugin for this. > > ...When in insert mode and you finish a tag (pressing '>') the > tag will be completed. If you press '>' twice it will complete the tag and > place the cursor in the middle of the tags on it's own line. > > >
I've not used TextMate so I'm not sure if this is quite the same thing but there is a vim plugin called snipmate that may help you out. <http://www.vim.org/scripts/script.php?script_id=2540>
38,640,339
For classic UI there is a option to set `defaultValue` for fields, this is shown to user when user first time opens the dialog after dragging the component. If user clears the value in dialog and saves, on editing the dialog, value of field is not shown again. For touch UI dialog, couldn't find the equivalent of `defa...
2016/07/28
[ "https://Stackoverflow.com/questions/38640339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4920566/" ]
I'm planning to set a `select` field in the `design dialog` with `dropdown` for default values and then work with it in the cq-dialog with `value="${cqDesign.type}"`
Since `numberfield` is also mentioned in this discussion. I have got `value` working instead of `defaultValue` in granite UI. ``` <numberOfResults jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/numberfield" fieldLabel="Number Of Results" required="{Boo...
7,374,810
I have a Fundamental question in using Jquery with PHP when making ajax calls with respect to performance. Is it right to do a Get or a POST. Which is faster when using ajax calls. I know this question has got nothing to do with PHP though, but would like to understand the different view points. All I am trying to do ...
2011/09/10
[ "https://Stackoverflow.com/questions/7374810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/748546/" ]
`addEventListener` is a method of the DOM element. `fadeOut`, `fadeIn` and `delay` are jQuery methods. If you want to use the bind method, you need a jQuery object, so it would be like ``` $(audioElement).bind('ended', function() { $('span#pause').fadeOut('slow'); $('span#play').delay(1500).fadeIn('slow'); }...
addEventListener works on DOM elements, while bind works on jquery objects. The event handler contains JQuery code, but addEventListener is JavaScript. You could change it to: ``` $(audioElement).bind('ended', function() { $('span#pause').fadeOut('slow'); $('span#play').delay(1500).fadeIn('slow'); }); ``` Th...
900,867
I create a button and set title as "Click here". When I press that button I want to get that button title and log it. Here's my code, where am I going wrong? ``` -(void)clicketbutton { UIButton *mybutton = [UIButton buttonWithType:UIButtonTypeCustom]; [mybutton setTitle:@"Click here" forState:UIControlStateNo...
2009/05/23
[ "https://Stackoverflow.com/questions/900867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/108639/" ]
Your displayvalue: method should look something like this: ``` -(void)displayvalue:(id)sender { UIButton *resultButton = (UIButton *)sender; NSLog(@" The button's title is %@.", resultButton.currentTitle); } ``` (Please check out the documentation in XCode, it would have given you the right answer.)
I know it's a bit of an old question, but this is probably the neatest way to resolve this one. ``` NSLog(@"The button title is: %@", [sender currentTitle]); ``` **Edit** I've just realised that this is depending on the fact that you have set the receiving parameter to `UIButton*`. Rather than using the d...
239,722
I have generated a custom entity using Drupal Console. ``` drupal generate:entity:content ``` The entity doesn't have the permission `edit own content` which we usually have in node types etc... The entities `entity_name.permissions.yml` the file has the following enteries. ``` add company entities: title: 'Crea...
2017/06/30
[ "https://drupal.stackexchange.com/questions/239722", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/3028/" ]
A little surprised how easy this was to fix; but it seems to be working. Console originally created permissions similar to what @esefwan posted and in MyEntityAccessConrtolHandler.php it created this code: ``` protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @...
I added two additional permissions in my permissions.yml file (view own and edit own...) and altered the checkAccess by adding the following conditions in the switches. Everything was initially created by drush generate. ``` /** * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity, $oper...
25,180,021
I have two tables , table1 and table2 with the following structure Table1: ``` ID Location Date ---------------------------- 1 abc 2014-6-3 2 xyz 2013-6-5 ``` Table2: ``` ID Location Date ---------------------- 1 abc NULL 2 xyz NULL 3 hgf 2012-...
2014/08/07
[ "https://Stackoverflow.com/questions/25180021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1315013/" ]
You can give an alias to the new value in the cte and then update the value using that alias: ``` WITH cte AS ( SELECT t2.Date ,t1.Date AS NewDate FROM #Table1 t1 JOIN #Table2 t2 ON t1.Location=t2.Location ) UPDATE cte SET Date=NewDate; ```
Problem Analysis : The Update using Common Table Expression is possible only when the updated record affects one base base and this is not possible when the update statement affects more than one base table. In the Above query, Update action is possible by using CTE. Solutions: ``` With Data(t2Date,t2Location,t1Date,...
30,138,017
I'm trying to play a bit with Firebase and Android. I have one `RegisterActivity`, and one `MainActivity`. My current flow is - start with `MainActivity` - check if user is registered, if not, call `RegisterActivity` - after registeration call `MainActivity`. I'm having trouble with where to put the `Firebase.setAn...
2015/05/09
[ "https://Stackoverflow.com/questions/30138017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2649154/" ]
I do not know FireBase but i know Android.. A `Context` is a global information about an application environment. Your `Activity` is a `Context` so i am pretty sure `Firebase.getAndroidContext()` retrieves your Application `Context` which is `getApplicationContext()`, Since that seems sensible. > > Should I only call...
You can do both. If you set it just once then it should be here. Anywhere else and your app will crash. Debugger will say that you have not setAndroidContext(): ``` protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Firebase.setA...
24,858,633
I have 4 columns `A`, `B`, `C`, `D`. In `A` I have some part numbers, and in `B` I have the quantity. In `C` I have almost the same part numbers but in `D` I have a different quantity. I need to make the difference between `D` & `B` (`D-B`) if the part number from `C` is found in `A`. The good results should be in `...
2014/07/21
[ "https://Stackoverflow.com/questions/24858633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3859315/" ]
I have a MacBook Air 2012 with 4GB of Ram. It worked well to run Eclipse and Android Studio. It's enough for development, and 8GB is better :)
The environment you have is good enough to run the [ADT](http://developer.android.com/tools/help/adt.html) (i.e. Eclipse + Android plugin). However, the default emulator that comes with ADT would run slow and may be choppy. But, as an alternative to this, you can use [Genymotion](http://www.genymotion.com/) which allow...
46,066,824
I encountered some problem when writing c++. The problem might be symplified as below. The function named as "test" return a pointer. And I tried to modify it but failed with error information. ``` void* test(){ void * p1; return p1} test() = new string(); ``` ERROR: expression must be a modifiable lvalue. In my cas...
2017/09/06
[ "https://Stackoverflow.com/questions/46066824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8331937/" ]
@MikaelMello is correct that you cannot set the value of a function. Extending your code and @MikaelMello 's, you can take the pointer that your function returns and make it point to an object like this: ``` void* test(){ void * p1; return p1} ... void* voidPointer = test(); voidPointer = new string(); ```
the function `test` has a return type of `void *`, thus the expression `test()` is a rvalue, which cannot be assigned to. only lvalue can appear on the left of an assignment operator. see the [explanation](http://en.cppreference.com/w/cpp/language/value_category) of lvalue, rvalue, and others. I'm guessing you probabl...
11,770,716
Python is my first language, and I am very new to it, so the answer may be very clear, but after many hours looking and experimenting, I am not sure what is causing the problem. An overview of the module: The DicePool module is meant to manage collections of "dice", stored as dictionary items. Each dictionary key (her...
2012/08/02
[ "https://Stackoverflow.com/questions/11770716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1570231/" ]
The problem is in this line: ``` self.dictPool[poolKey] = senderPool.dictPool[poolKey] ``` The values in your dictPools are lists. Here, you set one object's dictPool value to *the same list* as in the other one. Not a copy of the list, but the same list. So later if you add or subtract from that list, it will affec...
Here is a version of the Transfer() method that seems to work as intended (more or less), although it's very clumsy looking: ``` def Transfer(self, poolKey, targetPool, sendQuant, senderPool = None): '''targetPool must be DicePool instance''' if isinstance(targetPool, DicePool): #valid target, so subtr...
1,460
Is there a graph of known black holes, with their estimated mass in the X axis and their estimated radius in the Y axis? If so, where can we find it? I would like to know if a black whole with the whole estimated mass of our universe would have the estimated radius of our universe (which means our universe could be a b...
2014/01/15
[ "https://astronomy.stackexchange.com/questions/1460", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/813/" ]
The [Schwarzschild radius](http://en.wikipedia.org/wiki/Schwarzschild_radius) of a black hole is probably the closest we can get to your question. $$ r\_s = (2G/c^2) \cdot m \mbox{, with }\ 2G/c^2 = 2.95\ \mbox{km}/\mbox{solar mass}. $$ This means, that the Schwarzschild radius for a given mass is proportional to that...
According to the standard [ΛCDM](http://en.wikipedia.org/wiki/%CE%9BCDM) cosmological model, the observable universe has a density of about $\rho = 2.5\!\times\!10^{-27}\;\mathrm{kg/m^3}$, with a cosmological consant of about $\Lambda = 1.3\!\times\!10^{-52}\;\mathrm{m^{-2}}$, is very close to spatially flat, and has a...
58,947,142
I cannot figure out what is causing the top margin (pink div) to be greater on top (while left, right, bottom are correct); I've specified padding:10px; on the container. Any ideas? Full page below, or try link here <https://codepen.io/joe-oli/pen/ZEEVKZz> **UPDATE** after too many rushed answers, along the lines of ...
2019/11/20
[ "https://Stackoverflow.com/questions/58947142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90259/" ]
``` p{ margin:0 } ``` Use this line after theModal id this will fix this.
Try with this code: HTML: ``` <div id="wrapper"> <div id="theModal">Loading...</div> <div class="pink_div" style="background-color:hotpink;"> <p>Hello World !</p> <input placeholder="enter something" value="" /> <input placeholder="and something else" /> <select> <option>apples<...
107,472
I flagged a question as offensive, figuring that it may not get the 6 votes needed to shut it down, but it was the right thing to do (no, I won't point out which one, since that would derail the discussion of this issue, **this is not about the particular flag**). I got the following feedback on the flag page: ![Offe...
2011/09/26
[ "https://meta.stackexchange.com/questions/107472", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/13295/" ]
> > I **did not** flag the moderator, I just flagged the post as offensive. If they don't want to fix it, then fine just leave it alone, but there is no reason to decline an offensively flagged post. > > > Yes, you did flag for a moderator. The fact that the community can vote to deal with spam/offensive flags wit...
Moderators are also members of the community. If they happen across offensive and spam flags in the mod queue, it's up to their judgement and discretion to either nuke the steamroll or drive in the final nail with their blood diamond sledgehammer. Users are known to at times flag posts that are neither offensive nor s...
10,847,031
I am trying to extract two sentences out of a bunch of paragraphs, and I am stuck... Basically, the paragraphs look like this: ``` <p class="some_paragraph">This is a sentence. Here comes another sentence. A third sentence.</p> <p class="some_paragraph">Another sentence here. Interesting information. Very interesting....
2012/06/01
[ "https://Stackoverflow.com/questions/10847031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/921295/" ]
``` var snt = []; $('.some_paragraph').each(function() { var text = $(this).text(); text.replace(/[A-Z][^.]+\./g, function(s) { if (snt.length < 2) { snt.push(s); } else { snt[+(snt[0].length <= snt[1].length)] = s; } }); }); console.log(snt); // outpu...
``` var smallest = 0; var smaller = 0; var bigger = 0; var smallest_sen; var smaller_sen; $('p.some_paragraph').each(function(){ plength = $(this).text().length; if(smallest == 0){ smallest = plength; ...
29,817,656
I am using glob to find directories inside the current one where my index file is. Inside it i am saving html pages extracted from EXCEL and they create folders directories ending in .files Is there a way to glob all directories but exclude those ending in .files? Here is my code as it's currently: ``` <?php // set t...
2015/04/23
[ "https://Stackoverflow.com/questions/29817656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3785886/" ]
You could use the [substr](http://php.net/manual/en/function.substr.php)-function to do the following: ``` <?php // set to current directory $dir = ''; // directories only. ignore files, etc. foreach( glob( $dir.'*', GLOB_ONLYDIR ) as $folder ){ // do not include wordpress directories if( ($folder != '*') && (sub...
I am sorry for the message, I do not how to use it properly, I write it here ``` <?php $cur = getcwd(); chdir($dir); $src = glob("*",GLOB_ONLYDIR); chdir($cur); $nomatch = preg_grep("/.*\.files$|^wp\-includes$/i",$src,PREG_GREP_INVERT); foreach($nomatch as $folder) { ?> <li><a href="<?php echo $dir."/files/".$fo...
44,441,070
Hello I need some inspiration, I have a waypoint class like so: ``` public class Waypoint<T> { } ``` and I would like to add all my waypoints to one list like so: ``` var w1 = new Waypoint<Item>(); var w2 = new Waypoint<Player>(); var waypoints = new List<Waypoint<?>>(); ``` Problem is, they are not all of the ...
2017/06/08
[ "https://Stackoverflow.com/questions/44441070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6655608/" ]
Instead of a generic base class, you could define Waypoint as an interface and have Item and Player implement it. That way you can have a list of IWaypoints like you want. ``` interface IWaypoint { Point GetPosition();//whatever a waypoint should do } class Item : IWaypoint { Point location; public Point ...
Assuming you are coding in C#, there is no common base class for `Waypoint<Item>` and `Waypoint<Player>` except for `object` so the type of collection would be `List<object>` (or even `ArrayList`). Even if `Item` and `Player` both derived from the same base class, you wouldn't be able to define a `List<Waypoint<Base>>...
12,570,807
Instead of doing this, I want to make use of `string.format()` to accomplish the same result: ``` if (myString.Length < 3) { myString = "00" + 3; } ```
2012/09/24
[ "https://Stackoverflow.com/questions/12570807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41508/" ]
``` string.Format("{0:000}", myString); ```
You can also do : string.Format("{0:D3}, 3);
447,319
I have a 5 year old notebook computer. It uses Windows XP, and as you might know, this OS now has no support at all. It has a 1.60GHz, 0.98GB of RAM. What would you guys recommend me , in order for me to happily migrate from Windows XP to Ubuntu program. I appreciate in advance any help you can provide me regarding t...
2014/04/13
[ "https://askubuntu.com/questions/447319", "https://askubuntu.com", "https://askubuntu.com/users/268247/" ]
Seeing the hardware you have (CPU: 1.6 GHz, RAM: 1 GB) I recommend to download Xubuntu or Lubuntu before testing Ubuntu. This is not related to which one is better but I am trying to make sure that the Ubuntu version works OK on your hardware. I also would recommend, like Devesh said, to wait until 14.04 is out (Which ...
Since your configuration is a bit low, it would be getter if you go for the lighter version of Ubuntu called Lubuntu. its a light weight version of Ubuntu. It is a fast and lightweight operating system developed by a community of Free and Open Source enthusiasts. The core of the system is based on Linux and Ubuntu. It ...
17,596,827
The following connects the js client to all the existent hubs: ``` $.connection.hub.start({ transport: 'longPolling' }).done(function () {}); ``` Is there some way to connect to some particular hub instead? If not, what is the point of "OnConnected()" and "OnDisconnected()" being in EVERY hub? if all of them are go...
2013/07/11
[ "https://Stackoverflow.com/questions/17596827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1387588/" ]
You only subscribe to hubs that you have client side events associated with. So lets say you had two hubs: 1. **hubA** 2. **hubB** In your client if you have: ``` var hubA = $.connection.hubA; hubA.client.foo = function() {}; $.connection.hub.start(); ``` You will only be subscribed to events on hubA (not hubB).
You can choose to use or not use the connection events in any hubs you create. You certainly can separate your code into logical sections using hubs, no harm in that.
25,642,691
I'm developing an Android app on my Nexus 5 device (~445 ppi) and I'm using Roboto Light as the font for a few sections in the application. When displayed in my device, the Roboto Light text looks clean and crisp, however when testing the app on device with screens that have a lower pixel density, Roboto Light looks pr...
2014/09/03
[ "https://Stackoverflow.com/questions/25642691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989647/" ]
DisplayMetrics metrics = getResources().getDisplayMetrics(); int densityDpi = (int)(metrics.density) depends on your density you can set font type to textview and other controls like below code use Typeface font = Typeface.createFromAsset(getAssets(), "/fonts/Avenir.ttf"); textView.setTypeface(font);
You could do this programmatically by > > float density = getResources().getDisplayMetrics().density; > > > This will give you: > > > 0.75 - ldpi > > > 1.0 - mdpi > > > 1.5 - hdpi > > > 2.0 - xhdpi > > > 3.0 - xxhdpi > > > 4.0 - xxxhdpi > > > [Source](https://stackoverflow.com/a/10948031/3249477) > ...
3,830,833
I (mostly) use git to download and compile various projects from their source code, keeping my source in `/usr/local/src` and installing the binaries in `/usr/local/bin`. Following the building procedure, usually with `./configure && make && make install`, I'm left with a lot of cruft that ends up as 'new' files in my...
2010/09/30
[ "https://Stackoverflow.com/questions/3830833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63984/" ]
1. First, you can NOT hide command line arguments. They will still be visible to other users via `ps aux` and `cat /proc/$YOUR_PROCESS_PID/cmdline` at the time of launching the program (before the program has a chance to do run-time changes to arguments). Good news is that you can still have a secret by using alternati...
If the secret doesn't change between executions, use a special configuration file, `".appsecrets"`. Set the permissions of the file to be read-only by owner. Inside the file set an environment variable to the secret. The file needs to be in the home directory of the user running the command. ``` #!/bin/bash #filenam...
1,106,339
An easy problem, but for some reason I just can't figure this out today. I need to resize an image to the maximum possible size that will fit in a bounding box while maintaining the aspect ratio. Basicly I'm looking for the code to fill in this function: ``` void CalcNewDimensions(ref int w, ref int h, int MaxWidth,...
2009/07/09
[ "https://Stackoverflow.com/questions/1106339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/65070/" ]
Based on Eric's suggestion I'd do something like this: ``` private static Size ExpandToBound(Size image, Size boundingBox) { double widthScale = 0, heightScale = 0; if (image.Width != 0) widthScale = (double)boundingBox.Width / (double)image.Width; if (image.Height != 0) heightScale ...
Tried Mr. Warren's code, but it didn't produce reliable results. For example, ``` ExpandToBound(new Size(640,480), new Size(66, 999)).Dump(); // {Width=66, Height=49} ExpandToBound(new Size(640,480), new Size(999,50)).Dump(); // {Width=66, Height=50} ``` You can see, height = 49 and height = 50 in another. Here'...
8,339,030
I have an array like ``` Array ( [select_value_2_1] => 7 ) ``` I want to explode index into `Array ([0]=select_value, [1]=2, [2]=1)`
2011/12/01
[ "https://Stackoverflow.com/questions/8339030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685713/" ]
Or if you want to split the keys as in your example, use a more complex function: ``` foreach ($array as $key=>$value) { $key_parts = preg_split('/_(?=\d)/', $key); } ```
``` <?php $arr=array("select_value_2_1" => 7); $keys= array_keys($arr); $key=$keys[0]; $new_arr=explode("_",$key); print_r($new_arr); ?> ```
140,916
I have 30 years of professional experience as a software engineer and I'm at the point in my career where I can volunteer lots of time. I have helped with several childhood cancer organizations over the years but mostly was pulled into raising money. At this point in my life, I would like to help with a closer connec...
2019/12/01
[ "https://academia.stackexchange.com/questions/140916", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/116861/" ]
I work in a biomedical field and most of us are awful programmers. We tend to be more interested in getting the underlying back-end algorithm to work than worrying about the front-end, comments, documentation, version control, unit tests, etc. My suggestion, would be to look through the web pages at a nearby universit...
I can't speak specifically to cancer in children but drug design is a highly computer-oriented field. Drugs are designed, tested and analysed using computational chemistry before they are produced in a lab. The tools for this work are largely written by academics who produce great underlying theory but don't usually ha...
496,173
How can i uninstall a program in Windows 8 in desktop without going to the start screen?
2012/10/30
[ "https://superuser.com/questions/496173", "https://superuser.com", "https://superuser.com/users/168834/" ]
1. Open the **Computer** in **File Explorer**. 2. Click **Computer** on the **Ribbon** and select **Uninstall or change a program** ![enter image description here](https://i.stack.imgur.com/shF5G.png)
You can access the control panel from the File Explorer browsing your Computer, then **Uninstall a program**. Uninstalling a program is quite similar to in Windows 7. From the start screen, just go to **Control Panel > More settings > Programs and Features**, and select the program to Uninstall. If you know where the...
6,260,475
I can't google the ~ operator to find out more about it. Can someone please explain to me in simple words what it is for and how to use it?
2011/06/07
[ "https://Stackoverflow.com/questions/6260475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/747871/" ]
One usage of the ~ (Tilde) I have seen was getting boolean for .indexOf(). You could use: `if(~myArray.indexOf('abc')){ };` Instead of this: `if(myArray.indexOf('abc') > -1){ };` [JSFiddle Example](http://jsfiddle.net/mmuv1hwt/1/) --- Additional Info: [The Great Mystery of the Tilde(~)](http://www.joezimjs.com/jav...
It's a tilde and it is the bitwise NOT operator.
49,185,133
I have a Pandas data frame with multiple columns whose types are either float64 or strings. I'm trying to use `to_csv` to write the data frame to an output file. However, it outputs big numbers with scientific notion. For example, if the number is 1344154454156.992676, it's saved in the file as 1.344154e+12. How to s...
2018/03/09
[ "https://Stackoverflow.com/questions/49185133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317643/" ]
The float\_format argument should be a str, use this instead ``` df.to_csv('example.csv', float_format='%f') ```
> > For python 3.xx (tested on 3.6.5 and 3.7): > > > [Options and Settings](https://pandas.pydata.org/pandas-docs/stable/options.html) [For visualization of the dataframe pandas.set\_option](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.set_option.html#pandas.set_option) ``` import pandas as pd #...
38,957,978
In the below example, I have a simple `<table>` with a checkbox inside it. I have click events on the td, tr and checkbox. I want to be able to click the checkbox and stop the bubbling to the td and tr. A simple "event.stopPropagation()" works great. The problem is that if I want to connect a `<label>` to the checkbo...
2016/08/15
[ "https://Stackoverflow.com/questions/38957978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1809053/" ]
The `label` doesn't have a click handler of it's own, and can't stop propagation, so when you click the `label` normal event bubbling takes place. This means that all the parent's event handlers are invoked in the correct order. In addition, because of the `htmlFor`, the `checkbox` click handler is also triggered, but ...
Try wrapping with a span and add `evt.stopPropagation()` to span's onClick ``` <span onClick={evt => evt.stopPropagation()}> <input id="thing" type="checkbox" onClick={this.func3} /> <label htmlFor="thing"> label for checkbox</label> </span> ```
5,891,312
I have Entity Relationship Model (ERD) where entities `IndividualCategory` and `TeamCategory` relate to entity `Category`. Now I want to create tables in Oracle DB. I started like this: ``` CREATE TABLE Category( category_id INT PRIMARY KEY, ... ); CREATE TABLE Individual_category( category_id INT CONSTRA...
2011/05/05
[ "https://Stackoverflow.com/questions/5891312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311865/" ]
A completely different way to do this using deferrable constraints: ``` CREATE TABLE Category( category_id INT PRIMARY KEY, team_category_id INT, individual_category_id INT, ... ); CREATE TABLE Individual_category( individual_category_id INT PRIMARY KEY, category_id INT NOT NULL, ..., ); ...
ERD inheritance is a classic example of the gen-spec design pattern. There are numerous articles on how to design gen-spec in a relational DBMS like Oracle. you can find some of them by doing a Google search on "generalization specialization relational modeling". Much of what you will see in these articles has alread...
8,875,854
I am an experienced C++ programmer but new to Java. I have an algorithm that does some string manipulation and I want to terminate a string in the middle. Say, I want to do something like this ``` String str("hello, world"); char[] str2 = str.toCharArray(); //pass str2 to some function myFunc(str2); ... //inside m...
2012/01/16
[ "https://Stackoverflow.com/questions/8875854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903083/" ]
In Java, `char[]` and `String` are completely different. Forget the association from C, As far as you're concerned for now, they're not connected in any way. (For completeness, that `String` objects hold a `final char[]` representing the string (and it's *not* null-terminated), which you can obtain as you did in your e...
Use java **substring** method [String#substring()](http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#substring%28int%29) ``` str3 = str.substring(0, 3); ```
41,602,495
I want to inject some HTML to another HTML page dynamically like this : ``` <div id="jwplayer-player"> ... </div> ``` In the parent HTML page, there is CSS rules for DIV as generic (This is sample , may be different according to the page) : ``` div { margin-top: 15px; line-height: 200%; white-space: nor...
2017/01/11
[ "https://Stackoverflow.com/questions/41602495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4189602/" ]
I think you could use the ShadowDOM to achieve what you are trying to do. <https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM> It is designed to allow you to separate your components in this way, and provides isolation of CSS and JavaScript for the encapsulated DOM. ``` var shadow = document.query...
Try ``` #jwplayer-player { margin-top: initial; line-height: initial; white-space: initial; } ``` It will change all those rules to its initial values - default. I am not sure if it will work in this case.
1,634,995
hey there could someone please help me determine the complexity?. An example given in my class was *bubble sort* ``` int main() { int a[10] = {10,9,8,7,6,5,4,3,2,1}; int i,j,temp; for (j=0;j<10;j++) { for (i=0;i<9;i++) { if (a[i] > a[i+1]) { temp = a[i]; a[i] = a[i+1]...
2009/10/28
[ "https://Stackoverflow.com/questions/1634995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197793/" ]
The previous answers describe quicksort and its running time pretty well, but I want to comment on the worst-case running time. It is true that quicksort in general is O(n log n) in the average case (given a random permutation of inputs) and O(n^2) in the worst case. However, quicksort in general doesn't specify which...
Contrary to the opinion of all people here, the complexity of your program is O(1). You haven't defined what n is. I know, my answer seems a bit daft, but in practice it is often more important to find the bounds of your problem than the complexity of the algorithm. If your dataset will never be bigger than a given si...
14,651,187
*I´ve read a lot of posts about this but all of them were to limit the number digits to show them(NSString) .In my case I have:* I compare two double values(wich are the "same"), each of them got from different mathematical operations. For example: (4.800000 and 4.800000) double result1=4.800000, result2=4.800000 /...
2013/02/01
[ "https://Stackoverflow.com/questions/14651187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1479793/" ]
Generally speaking, you want a thread pool to service requests. A typical structure will start with a single thread that does nothing but queue up incoming requests. Since it doesn't do very much, it's typically pretty easy for one thread to keep up with the maximum speed of the network. That puts the items into some...
select or poll or epoll These are facilities on \*nix systems to aggregate multiple event sources (connections) into a single waiting point. The server adds the connections to a data structure, and then waits by calling select etc. It gets woken up when stuff happens on any of these connections, figures out which one,...
11,055,897
For our app, we use the following code to check for internet connection whenever the app user is trying to post a message. When we test the feature, it works fine when turning on the airplane mode. Then when we turn off the airplane mode, the call to connected still returns NO. What could be the reason for that? Do we ...
2012/06/15
[ "https://Stackoverflow.com/questions/11055897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/180862/" ]
Apple Engineers have suggted that completely relying on Rechability. From a [SO post](https://stackoverflow.com/questions/12490578/should-i-listen-for-reachability-updates-in-each-uiviewcontroller#12490864) (source of blockquote) ``` On a WWDC talk this year the Apple engineer on stage recommended users to never base...
You're using some kind of *convenience constructor* to check for reachability - this will not work. One of best examples of how to use reachability is found here on SO: <https://stackoverflow.com/a/3597085/653513> Or so what EricS suggests and don't use reachability at all - it's a viable option.
3,032,768
I have made an out-of-browser **silverlight** application which I want to **automatically update** every time there is a **new .xap file** uploaded to the server. When the user right-clicks the application and clicks on **Updates**, the default is set to "**Check for updates, but let me choose whether to download and ...
2010/06/13
[ "https://Stackoverflow.com/questions/3032768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
The first dialog is about how updates to Silverlight itself are installed and has nothing to do with your application. Using the CheckAndDownloadUpdateAsync the new XAP should be downloaded automatically. Acording to the doc there is no way to prevent the new version from being installed one you call CheckAndDownloadU...
You might get what you're wanting by incorporating an external version control check. have it look to see if the version that's installed and the version on the server is different. If it's different ask the user if they want to update. If they choose yes, then invoke `CheckAndDownloadUpdateAsync();` otherwise skip ...
9,241,054
My Android app has a tab bar that uses an Intent to launch the content in each tab, as in Android's API Demos [example](http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html). I've put an AndEngine activity under one of the tabs. My first question is: is this a reasonable ...
2012/02/11
[ "https://Stackoverflow.com/questions/9241054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11575/" ]
you've set up your rails code so that it requires a call to `/hotels.json` in order to return json, but your backbone code is calling `/hotels` only. the easiest way to fix this is to have a separate api for json data, than for html pages. for example: `/hotels` returns html and `/api/hotels` return json. see Ryan Bat...
When your javascript application runs on a different domain, port or protocol than your server, strange things will happen. This is called Same Origin Policy. Just load the javascript from your rails server and everything will be fine.
34,280,094
In pandas.fillna, ``` method : {‘backfill’, ‘bfill’, ‘pad’, ‘ffill’, None}, default None Method to use for filling holes in reindexed Series pad / ffill: propagate last valid observation forward to next valid backfill / bfill: use NEXT valid observation to fill gap ``` How can I fill values both backward and forwar...
2015/12/15
[ "https://Stackoverflow.com/questions/34280094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/308827/" ]
It seems very simple and there may be a quicker way, but simply chaining the two, like so ``` df.fillna(method='ffill').fillna(method='bfill') ``` This will fill forwards first and then backwards.
It depends on the precise result you are looking for and where are the NaNs in your dataframe. In the following situation you will see that only using two succesive `fillna` calls will actually pad the dataframe with values. The `interpolate` functions both fall short. ``` # Modules # import pandas from six import Str...
72,316,073
Let's say I have 3 lists. Two of them are basic lists while the last one is an observable. The issue is I now want to merge a non-observable list into the observable one. Right now I do something like this but I feel like it's "against observables' nature" ``` listToMerge = [] listObs$: BehaviorSubject<[]> = new B...
2022/05/20
[ "https://Stackoverflow.com/questions/72316073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18710595/" ]
Issue <http://github.com/aspnet/Logging/issues/441> is closed and MS officially recommends to use 3rd party file loggers. Please see answers from: [How to log to a file without using third party logger in .Net Core?](https://stackoverflow.com/questions/40073743/how-to-log-to-a-file-without-using-third-party-logger-in-n...
A little different approach, but if you're using Datadog consider just writing to the Windows Event Viewer ``` public void WriteToEventLog(string sLog, string sSource, string message, EventLogEntryType level) { if (!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource, sLog); EventLog.Write...
520,755
I'm designing a PCB with 4 layers, but I've seen different recommendations about layer distribution. I'm considering that: Top layer - Signal + short traces of VCC 2nd layer - Signal 3rd layer - VCC 4th layer - GND Can I fill all area around with ground in each plane and place several vias to connect grounds...
2020/09/09
[ "https://electronics.stackexchange.com/questions/520755", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/262643/" ]
Your stackup is a poor choice in most cases. Most 4 layer stackups are like ``` Top thin insulator Mid 1 Thick insulator Mid 2 Thin insulator Bottom. ``` So your stackup places your signal traces far away from any reference plane. The most common arrangement would be to use mid1 for ground and mid 2 for power, thi...
Signal, Ground, Power, Signal is the most common 4 layer board stack up. In many cases when this is used the power plane acts like a return plane for the signals on the bottom layer. Ideally not all the layers are equally spaced depending on what you are trying to accomplish. **Remember engineering is always a trade o...
170,259
I have webex installed on ubuntu 12.04 with wine as per the instructions at [this link](http://my.opera.com/rembrant/blog/2011/11/16/installing-webex-player-on-ubuntu-11-04-arf). I'm able to open .arf files but the video is not showing up. This is the output i get when i open the application using terminal ``` wine:...
2012/07/31
[ "https://askubuntu.com/questions/170259", "https://askubuntu.com", "https://askubuntu.com/users/22589/" ]
1. Install WINE 2. Download the MSI installer from the webex web-site <http://www.webex.com/play-webex-recording.html> 3. Right click on it and install using WINE 4. Run the player from the terminal wine "/home/username/.wine/drive\_c/Program Files (x86)/WebEx/WebEx/500/nrplay.exe"
The tool does not like any *whitespace*, neither in the directory path where it is residing nor the MP4 directory. The directory path and filename of the file to be converted must not contain any whitespace either. So no whitespace anywhere -)
5,521,518
I have been searching for over an hour and I can not for the life of me figure out how to search a string variable starting on the right. What I want to do is to get the last folder of a path (right before the file name), In VB6 I would do something like this: ``` Dim s As String s = "C:\Windows\System32\Foo\Bar\" D...
2011/04/02
[ "https://Stackoverflow.com/questions/5521518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100283/" ]
Presumably you want to ignore the last `\` in the string, because your VB code is searching all but the last character. Your C# code isn't working because it's searching the whole string, finding the `\` as the last character in the string, causing your substring to return nothing. You have to tell `LastIndexOf` to sta...
``` var fullPath = @"C:\foo\bar\file.txt"; var folderName = new FileInfo(fullPath).Directory.Name; //folderName will be "bar" ``` Edit: Clarified example
251,204
I want to fade out an element and all its child elements after a delay of a few seconds. but I haven't found a way to specify that an effect should start after a specified time delay.
2008/10/30
[ "https://Stackoverflow.com/questions/251204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2648/" ]
``` setTimeout(function() { $('#foo').fadeOut(); }, 5000); ``` The 5000 is five seconds in milliseconds.
I use this pause plugin I just wrote ``` $.fn.pause = function(duration) { $(this).animate({ dummy: 1 }, duration); return this; }; ``` Call it like this : ``` $("#mainImage").pause(5000).fadeOut(); ``` Note: you don't need a callback. --- **Edit: You should now use the [jQuery 1.4. built in delay()](ht...
49,500,213
I'm trying to join my `users` table with my `jobs` table based on a mapping table `users_jobs`: Here is what the `users` table looks like: ``` users |--------|------------------| | id | name | |--------|----------------- | | 1 | Ozzy Osbourne | | 2 | Lemmy Kilmister | | 3 | Ro...
2018/03/26
[ "https://Stackoverflow.com/questions/49500213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6454033/" ]
I found a solution. Using @stackFan approach adding an `EXISTS` clause to make sure that the user is in. ``` SELECT u.id, u.column3 , u.column4 FROM users u INNER JOIN user_jobs uj on u.id = uj.user_id INNER JOIN jobs j on j.id = uj.job_id WHERE uj.job_id = <job-ID> AND EXISTS ( SELECT * FROM use...
Try `LEFT JOIN`. It will display all users, whether they have job or not. ``` SELECT u.id, u.name, uj.colum3, uj.column4 FROM users AS u LEFT JOIN users_jobs uj ON uj.user_id = u.id LEFT JOIN jobs j ON j.id = uj.job_id ```
28,780,675
please read my code ask solution how to create folder public class CameraActivity extends ActionBarActivity { ``` private static final int ACTION_TAKE_IMAGE = 1; Button btnImage; ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setConte...
2015/02/28
[ "https://Stackoverflow.com/questions/28780675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4565853/" ]
try this code ``` public class CameraActivity extends ActionBarActivity { // private static final int ACTION_TAKE_IMAGE = 1; Button btnImage; ImageView imageView; File image; String picturePath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedIns...
To use different name for image everytime you can use method getTimeInMillis() as `Calendar mCalendar = Calendar.getInstance(); String n = ""+mCalendar.getTimeInMillis(); String fname = "Pic-" + n.substring(5) + ".png"; //Asign name for image File image = new File(imagesFolder, fname); Uri uriSavedImage = Uri.fromF...
2,426,230
I'm trying to port the following Java snippet to Scala. It takes a list of `MyColor` objects and merges all of the ones that are within a delta of each other. It seems like a problem that could be solved elegantly using some of Scala's functional bits. Any tips? ``` List<MyColor> mergedColors = ...; MyColor lastColor ...
2010/03/11
[ "https://Stackoverflow.com/questions/2426230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111777/" ]
I'm assuming that you somehow have your colors arranged in the list such that colors "close" in color space (i.e. with a low `diff` value) are adjacent in the list. Then I'd use a fold: ``` val unmergedColors: List[MyColor] = ... val mergedColors = (Nil:List[MyColor] /: unmergedColors)( (list,c) => { list match { ...
I'd try folding: ``` def merge(lotsOfColor: List[MyColor], delta: Double): List[MyColor] = lotsOfColor.tail.foldLeft((List(lotsOfColor.head), lotsOfColor.head)) { case ((mergedColors, lastColor), aColor) if (lastColor diff aColor) < delta => (mergedColors, lastColor merge aColor) case ((mergedColors, _...
5,929,765
I am trying to order by lowest however this sql term below order's by highest number ``` SELECT * FROM questions ORDER BY question_ref DESC LIMIT 1; ``` Any help would be appreciated
2011/05/08
[ "https://Stackoverflow.com/questions/5929765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/393273/" ]
Use `ASC` instead of `DESC`: ``` SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1; ```
Using ascending rather than descending ordering should do the trick: `SELECT * FROM questions ORDER BY question_ref ASC LIMIT 1;`
1,110,404
So, if I try to remove elements from a Java *HashSet* while iterating, I get a *ConcurrentModificationException*. What is the best way to remove a subset of the elements from a *HashSet* as in the following example? ``` Set<Integer> set = new HashSet<Integer>(); for(int i = 0; i < 10; i++) set.add(i); // Throws ...
2009/07/10
[ "https://Stackoverflow.com/questions/1110404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can manually iterate over the elements of the set: ``` Iterator<Integer> iterator = set.iterator(); while (iterator.hasNext()) { Integer element = iterator.next(); if (element % 2 == 0) { iterator.remove(); } } ``` You will often see this pattern using a `for` loop rather than a `while` loop:...
you can also refactor your solution removing the first loop: ``` Set<Integer> set = new HashSet<Integer>(); Collection<Integer> removeCandidates = new LinkedList<Integer>(set); for(Integer element : set) if(element % 2 == 0) removeCandidates.add(element); set.removeAll(removeCandidates); ```
71,550,031
I'm having trouble understanding how to properly end a firestore trigger. From what I read from [this](https://stackoverflow.com/questions/69931652/returning-null-from-firebase-cloud-function-background-triggers) and [this](https://stackoverflow.com/questions/59561961/do-i-need-to-explicitly-end-firebase-cloud-function...
2022/03/20
[ "https://Stackoverflow.com/questions/71550031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17483742/" ]
First, select the Pictures you want by ids list: ``` var pictures = _dbContext.Pictures .Where(s => ids.Contains(s.Id)); ``` Second, calculate the IsAnnotated field with foreach - this is not a case of 'select', this is an update case. (Convert to 'List' for using the ForEach linq function, you can use ...
You can do something like this. ``` Var pictures = _dbcontext.Pictures.Where(x=> IDs.Contains(x.id)); var annotations = await pictures.Join(_dbContext.annotation, pic => pic.id, ann => ann.pictureId, (pic, ann) => new { Annotation = ann.IsAnnotated }.ToListAsync(); ``` Or instead an anonymous ty...
438,312
Let $W\_t$ be a Wiener process with $W\_0=0$, and let $L=\{at+by=c\}$ be a line with $c/b<0$ (i.e. the line crosses the $Y$-axis below $0$). Assume that $W\_t$ stayed above $L$ up to time $T$. What is the PDF of $W\_T$ under this assumption? Does it have a closed form?
2023/01/11
[ "https://mathoverflow.net/questions/438312", "https://mathoverflow.net", "https://mathoverflow.net/users/64302/" ]
The problem can be restated as follows: > > For a real $a>0$ and a real $b$, let > $$X\_t:=a+bt+W\_t$$ > for real $t\ge0$, where $W$ is a standard Wiener process. Let > $$\tau:=\inf\{t>0\colon X\_t=0\}.$$ > For a real $t>0$, find the joint distribution of $X\_t$ and $\tau$. > > > The answer is well known: $$P(X\_...
As I mentionned in my comment, there is an ambiguity in the statement of you question. Anyway, if $B$ is a standard one dimensional Brownian motion, if $\lambda$ is a real number, then $(B\_t-\lambda t)$ is a diffusion. The joint distribution of its position and its current minimum at time $T$ can be derived from <htt...
616,254
Background: I'm attempting to derive the Friedmann Equations in Mathematica. The code works with the FLRW metric employing natural units where c=1. However, to insure the calculation works for all cases, I'm inputting other versions of known metrics see if the result are still correct. When I switch from natural units,...
2021/02/21
[ "https://physics.stackexchange.com/questions/616254", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/260164/" ]
A conceptual error: The parallel axis theorem is used to find the inertial moment about an **rotating axis** which is not the CM. In this problem, the disk is not rotating about the CM (for rock and disc joint system) but it rotates around the center of disk. Therefore, it should be think in decomposing the motion int...
This problem has a major difference from many similar textbook problems dealing with the conservation of angular momentum. In many of the textbook problems the axis of rotation of the disk about its center of mass (CM) is fixed by a constraining force/torque and does not move. If that were the case here, the axis of r...
205,593
I'am trying to check whether a user is logged-in or not; with `\Drupal::currentUser()->id()` I am getting the user ID for the anonymous user (i.e. 0), even though I'm logged in. How can I resolve this? I'm just calling this function in the `.module` file, and it is not run from cron. I am using the following code. `...
2016/06/29
[ "https://drupal.stackexchange.com/questions/205593", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/62722/" ]
Try this. ``` use Drupal\Core\Session\AccountInterface; function mymodule_function() { $account = \Drupal::currentUser(); if ($account->isAuthenticated()) { // User is logged in. } } ``` Refer the below Link for more details <https://www.drupal.org/node/2017231>
It appears that the code in the original post is not in any function, it's just in the global spec of whichever file it's in, so the current user probably hasn't been loaded yet.
49,836,702
The situation is that when I modify a `Card` view background from a program then the corner radius of the `Card` view reset. But why? *(I don't think I need to provide any other information (code, picture of the result, etc.), because I think it's clear enough to understand. If you need more information then you sho...
2018/04/14
[ "https://Stackoverflow.com/questions/49836702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9377499/" ]
I found a solution to the question. I needed to retrieve the background of the view and set its color, then I assigned the new background to the view. ``` Drawable backgroundOff = v.getBackground(); //v is a view backgroundOff.setTint(defaultColor); //defaultColor is an int v.setBackground(backgroundOff); ``` *(...
Same problem and fix the problem this way At first, create the shape named in Drawable "shape\_background\_cardview" and this add below code ``` <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/gray500" /> <corners android:radius="5dp" /> </sh...
39,722,694
In my conversion program I am using a dictionary to gives names to specific rows read from a pre defined text file. Then creating a multidimensional array named "Rows" an error occurs: > > An item with the same key has already been added. > > > The following piece of code is written: ``` Dictionary<st...
2016/09/27
[ "https://Stackoverflow.com/questions/39722694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6822608/" ]
If you have multiple lines, you will start at `"array" + i` == `array0` again. That item has already been added to the dictionary, hence the exception. You have to keep in mind to number the lines too, so maybe you should format it like `"array" + "line" + lineNumber + "row" + i` or so.
You probably want to associate *multiple* int's to the key in the dictionary. A Dictionary won't do for this, but rather a ``` Dictionary<string, List<int>> or Dictionary<string, HashSet<int>> ``` If you are using ("array" + i) as key, an int would do it. Initializing an array with many 0's is not very nice, rat...
303,864
My system (Debian squeeze) uses anti-aliasing for fonts, which is fine for the most part. However, I would like to disable it for terminal fonts in xterm and urxvt (rxvt-unicode), and can't get that to work. I tried using `antialias=false`, like explained e.g. in the [urxvt man page](http://linux.die.net/man/1/urxvt) ...
2011/06/29
[ "https://superuser.com/questions/303864", "https://superuser.com", "https://superuser.com/users/5026/" ]
Usually xterm does not apply antialiasing to fonts. However, I think some windowmanagers like compiz generally apply antialias to windows, hence your problem would be your window manager, not your terminal emulator. Try checking your window manager for antialiasing and try disabling it.
xterm actually work with font antialiasing like below. > > ~/.Xdefaults > > > ``` !xterm font antialiasing variant xterm*faceName: DejaVu Sans Mono:size=10:antialias=true xterm*font: 7x13 !rxvt-unicode fontantialiasing variant URxvt*font: xft:DejaVu Sans Mono:pixelsize=12:antialias=true:hinting=true URxvt*boldFon...
18,308,972
I am using PlayN to build a game involving stone a user has to move in a physic world (with gravity etc.) I want the user to be able to manipulate directly the stones using the touch pad and give them a velocity by dragging and throwing them. For now I have an implementation where every stone is on his own layer and I...
2013/08/19
[ "https://Stackoverflow.com/questions/18308972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2534331/" ]
Found an interesting presentation about playN. <http://playn-2011.appspot.com/slides/index.html#34> In the example the author uses following code: ``` touch().setListener(new Touch.Adapter() { @Override public void onTouchStart(Event[] touches) { // Process touch events into a zoom start pos...
The best way I found to handle this type of problem is actually to use a MouseJoint in Box2d. Suspending the physic is not the correct approach as it breaks the simulation (among other things, the body will not be taken into account for collisions) I will post some links I found explaining the different possible appro...
14,369,032
I can compile from the command line by running **vcvarsall.bat**, then running **cl.exe** with my source file as the only argument. The problem is that just running **cl.exe** without first setting up the environment using the aforementioned batch file causes errors due to "missing libraries". I can picture a couple o...
2013/01/16
[ "https://Stackoverflow.com/questions/14369032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388916/" ]
You can update environment variables from within Vim. For instance, to add "c:\foo" to the start of your PATH: ``` let $PATH='c:\\foo;'.$PATH ``` I copied the relevant portions of my vcvars\*.bat file to my vimrc: ``` if !exists("visual_studio_paths_added") let visual_studio_paths_added = 1 let $PATH="C:\\P...
Expanding on the comment by David Rodríguez - dribeas, and seeing how `vcvarsall.bat` accepts parameters, I found it helpful to have the following file in my source trees: `vc.bat`: ``` call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 & %* ``` Adjust MSVS version and platform as appropriate, or make them additi...
161,977
It seems like I am only able to centre my zoom around the camera and no longer with the object I've made. I can't even really zoom in that far at all anymore either. This is my first time trying to make something on Blender so I am very unfamiliar with the program, but none of the suggestions for solutions I've found o...
2019/12/27
[ "https://blender.stackexchange.com/questions/161977", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/86010/" ]
Welcome to Blender! Have you tried changing the camera lock settings? Press `N` to bring up the sidebar. On the right-hand side of the sidebar, press the *View* tab then expand the *View Lock* options. Here, you can toggle locking to the 3D cursor, to View, or to an object. If you would like your view to always rotat...
This sounds like it would be solved with the "Show Active" action. You can select the object you want to zoom into and execute the "Show Active" command. To use Show Active, hit full stop (.) on the number pad. Since you're on a Macbook and probably don't have a number pad, you should make sure you have "emulate nump...
7,641,013
I have added some testers to my Facebook application while it is still in Sandbox mode. I have already added them as testers within a group called testers. However, they are having issues accessing the application directly (while logged in) and the APPs page. Do these testers need a developer ID to access my applicati...
2011/10/03
[ "https://Stackoverflow.com/questions/7641013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54627/" ]
Problem solved on my end. Apparently when you add people as testers they don't get a "Developer App" invite like people added as developers do, so the testers need to make sure they are approved for the Developer App at <https://developers.facebook.com/apps>. Then they should be able to get to your sandboxed app and ...
No, I don't think they do. I have recently added a friend as a tester and they do not have a developer ID/added the developer application. My app is still in sandbox mode and is an iframe app btw.
35,910,001
In my magento website, whenever i am trying to view the product details page,its not loading the product details page properly,after the Product Image its not displaying anything. [![enter image description here](https://i.stack.imgur.com/6tHx8.png)](https://i.stack.imgur.com/6tHx8.png)
2016/03/10
[ "https://Stackoverflow.com/questions/35910001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6041121/" ]
In order to invoke a controller method from the directive you need to create a "reference" function with `&` scope configuration: ``` .directive('radio', () => { return { restrict: 'E', replace: true, templateUrl: 'radio', scope: { data: '=', onupdate: '&' ...
Hello I stick to your **question title** '*how to call controller function from directive*'. I've made an example that uses a `<select>` element and calls the controller function `$scope.filterHall()` to send the selected object, whenever the user changes value. **Directive** (i get the changeHall function and i call...
69,894,036
I have a dataframe where columns are numneri ``` asd <- data.frame(`2021`=rnorm(3), `2`=head(letters,3), check.names=FALSE) ``` But when I reference the columns names as variable, it is returning error ``` x = 2021 asd[x] Error in `[.data.frame`(asd, x) : undefined columns selected ``` Expected output ``` x = 2...
2021/11/09
[ "https://Stackoverflow.com/questions/69894036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16935119/" ]
Use `deparse` ``` asd[,deparse(x)] [1] 1.3445921 -0.3509493 0.5028844 asd[deparse(x)] 2021 1 1.3445921 2 -0.3509493 3 0.5028844 ```
If the value is numeric, just convert to character with `as.character` - column/row names attributes are all `character` values ``` asd[as.character(x)] 2021 1 -0.4438473 2 -0.8904154 3 -0.9319593 ```
29,142
How could one put, in a single word, language that has multiple meanings at once?
2011/06/09
[ "https://english.stackexchange.com/questions/29142", "https://english.stackexchange.com", "https://english.stackexchange.com/users/9607/" ]
There's also [polysemous](http://dictionary.reference.com/browse/polysemous) or [polysemantic](http://dictionary.reference.com/browse/polysemantic), both of which mean "having many meanings."
you do it [ostensibly](http://www.wordnik.com/words/ostensibly/) > > "So maybe there’s a legal convention > concerning how definitions such as > this are to be > circumscribed/overridden/whatever by > the common English meaning however > vague by comparison of the term > ostensibly being defined?" *— The > Vol...
52,552,143
This question is related to [Applying Cost Functions in R](https://stackoverflow.com/questions/42372821/applying-cost-functions-in-r/42374307) I would like to know how to save the coefficients generated for each iteration of `optim`. `trace=TRUE` enables me to get the coefficients for each iteration printed, **but how...
2018/09/28
[ "https://Stackoverflow.com/questions/52552143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1993932/" ]
``` ## use `capture.output` to get raw output out <- capture.output(df <- optim(par=rep(0,ncol(X1)), fn = cost.glm, method='CG', X=X1, control=list(trace=TRUE))) ## lines that contain parameters start <- grep("parameters", out) param_line <- outer(seq_len(start[2] - start[1] - 1) - 1, ...
So, the other solution works... but involves parsing the response inside the trace. Here's an approach that gives you access to the objects directly. (And would be general in any other optimization function that doesn't allow you to easily show a text trace): (This works because you can assign inside of an environmen...
52,419,505
On my script I need to match two words after a specific command executed. I need to greep on **karaf-ids** and **DEPLOYED** I used `grep -F` but it don't match exactly the first word and the second after ``` #helm ls NAME REVISION UPDATED STATUS CHART ...
2018/09/20
[ "https://Stackoverflow.com/questions/52419505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9923968/" ]
``` awk '$1 == "karaf-ids" && $8 == "DEPLOYED"' ``` prints any line which matches these criteria. If that's not what you want, add something like `{ print $3, $4, $5, $6, $7 }` to print just the date, for example.
If you need to match two words (word1 AND word2) with `grep` you have 2 choices: If the order of words is known: ``` $ grep word1.*word2 file ``` or if the order is unknown: ``` $ grep word1 file | grep word2 ``` In your case they both work. If you want to use a list of words to search from file (`grep -F`), yo...
20,710,766
I have a website for my business coded entirely in HTML. No CSS at all. The problem is that every page except my index.html home page is scaling the text (on android) and reflowing it so that it is a readable size on the page. So my question is: how would I go about making my website display properly on mobile devices...
2013/12/20
[ "https://Stackoverflow.com/questions/20710766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1527258/" ]
``` ?modestbranding=1&autohide=1&showinfo=0&controls=0 autohide=1 ``` is something that I never found... but it was the key :) I hope it's help
To remove you tube **`controls`** and **`title`** you can do something like this ```html <iframe width="560" height="315" src="https://www.youtube.com/embed/zP0Wnb9RI9Q?autoplay=1&showinfo=0&controls=0" frameborder="0" allowfullscreen ></iframe> ``` [code with output](https://jsfiddle.net/umanguSp/pt5gcv2r/) `showi...
48,095,622
I have a tab system which uses some Javascript to switch tabs. I want them to fade in and out when you switch tabs. The JS at the moment just removes and adds the clicked tab the user chooses. I have made the fade in JS kind of work however it does not remove tabs. ```js $(document).ready(function() { $('ul.tabs li...
2018/01/04
[ "https://Stackoverflow.com/questions/48095622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8113906/" ]
`AbstractQueuedSynchronizer` provides lots of `public` methods and it is very unlikely that all of them make sense as part of your own `public` API. Exposing those unwanted methods can distract from the your actual API or even harm the stability of your code. Even worse, the API of this class could evolve, providing ev...
AbstractQueuedSynchronizer is a framework that provides blocking mechanish for FIFO like structures. You can see many blocking structures extending this class's functionality to implement locking mechanism. For example you can see ReentrantLock class providing fair/unfair locking through Sync class which extends AQS. ...
14,749,404
I change the content of an UIView by clicking of some UIButtons. (Buttons and UIView are included in the same UIScrollView) For Example: Case 1: I add content and raise the height of the View and the ScrollView. Case 2: I remove content and reduce the height of the View and the ScrollView. At both cases i set the s...
2013/02/07
[ "https://Stackoverflow.com/questions/14749404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1862913/" ]
Almost all money in the world IS "purely representative of your money, its just a value in a database"! The next part of money is the paper money which in a sense real in that it's physical but it can become worthless at any time if the government who backs the paper goes belly up. After that comes physical stuff like ...
It boils down to a secure token that can be trusted, I can issue a cheque for an amount and send it to you, you go to the bank and get that honoured/paid A cheque can be "written" (I use the term loosely, because it can also be a barcode or an encrypted code) in any way (Bullet cases have been used and honoured) So all...
17,502,337
I have a problem...what's a nondeterministic procedure? I have this exercise Provide a nondeterministic procedure for the following language: L = {: G=(V,E) has an Indipendent Set I s.t. |I| >= k and the vertices V\I form a Hamilton cycle} Thanks!
2013/07/06
[ "https://Stackoverflow.com/questions/17502337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2057119/" ]
A non-deterministic procedure or function is a procedure that for a given input value will *not* always produce the same output. For example: DateTime.GetCurrent would be non-deterministic. Random.Next() would be non-deterministic. Math.Sin() would hopefully be deterministic. If you enter the same value 10 times you w...
A non-deterministic function can rely on an "oracle". In your example, the oracle would produce the set `I` and the function only needs to check whether it has specified properties, i.e. `I` is independent, `|I| >= k` and `V\I` forms a Hamilton cycle.
34,019,990
In my app/views/phrases/\_forms.html.erb, I have a button with an id which I want to show or hide a particular section with id preview-section. ``` <%= button_tag(type: 'button', class: "btn btn-default", id: 'preview-button') do %> Preview <% end %> <section id="preview-section"> Some Content </section> ``` I'...
2015/12/01
[ "https://Stackoverflow.com/questions/34019990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3561894/" ]
Pre-standard C had no `void*` but only `char*`, so you had to cast all parameters passed. If you come across ancient C code, you might therefore find such casts. [Similar question with references](https://stackoverflow.com/questions/32652213/why-does-the-book-say-i-must-cast-malloc). When the first C standard was re...
Here is another alternative hypothesis. We are told that the program was written pre-C89, which means it can't be working around some kind of mismatch with the prototype of `free`, because not only was there no such thing as `const` nor `void *` prior to C89, there was no such thing as a *function prototype* prior to ...
710,393
I have read this question: [![enter image description here](https://i.stack.imgur.com/iuEcV.png)](https://i.stack.imgur.com/iuEcV.png) <http://hyperphysics.phy-astr.gsu.edu/hbase/Forces/funfor.html> > > So , in a nutshell, it is the fitting of data with a specific standard model that organizes the particle interact...
2022/05/24
[ "https://physics.stackexchange.com/questions/710393", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/132371/" ]
As mentioned in the other answer, we can take $\mathbf{q}$ to point in the $z$-direction: $$\int \frac{d^3k}{(2\pi)^3} \theta(k\_F - k)(\mathbf{k}\cdot\mathbf{q})^n = \int d\Omega\int\_{0}^{k\_F}\frac{dkk^2}{8 \pi^3} (kq\cos{\theta})^n$$ $$=\frac{q^n}{4\pi^2}\int\_{-1}^{1}\cos^n\theta ~d(\cos\theta)\int\_{0}^{k\_F}k^...
The integral is spherically symmetric so we can put $\mathbf{q}$ along the $z$-axis: $$\int \frac{d^3k}{(2\pi)^3} \theta(k\_F - k)(\mathbf{k}\cdot\mathbf{q})^n = \int d\Omega\int\_{0}^{k\_F}\frac{k^2dk}{8 \pi^3} (kq\cos{\theta})^n$$ the integral then factorizes $$\frac{q^n}{4\pi^2}\int\_{-1}^{1}\cos^n\theta ~d(\cos\th...
419,016
I faced a strange problem with the following circuit. [![The circuit](https://i.stack.imgur.com/OfjRX.png)](https://i.stack.imgur.com/OfjRX.png) I'm using some buck converters and an Arduino. The buck converter (Vout = 5.25v) is for a USB charger (up to 2 Amps). Well, I think the circuit itself has no problem, but in...
2019/01/26
[ "https://electronics.stackexchange.com/questions/419016", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/208458/" ]
The conventional way to deal with externally applied ESD is to protect the circuit with TVS diodes and ESD clamp devices. There are a plethora of these types of devices in the market including a slew of them designed specifically for USB applications.
Use apparel that grounds you before using any kind of electronics. I personally screwed up a monitor while disassembling it because of electrostatic charge. The easiest thing to do is touching grounded metal pieces every few minutes. If that's irritating, buy an ESD mat to stand on. Also, I bought a device that I can...
27,003
I am starting to write some functions while studying how to program in C. In this small function I take a string as an argument and print it out in reverse order. ``` #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { int aLen = argc; char *sWord = argv[aLen - 1]; char *reversed; ...
2013/06/04
[ "https://codereview.stackexchange.com/questions/27003", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/17028/" ]
Your code has a number of issues, the main one being that it doesn't work. If you want to reverse a string in place then I suggest you write a function just for that, separate from `main`. The function will need a temporary variable and will, for example: ``` swap first and last characters swap 2nd and 2nd-from-last ...
You need to allocate storage for the reversed string using `malloc` unless that's changed in the last twenty years and place a `'\0'` string terminator at the end. ``` char *reversed = malloc(sLen + 1); reversed[sLen] = '\0'; ``` Also, you're writing to cells 1 .. `sLen` when you should be writing to 0 .. `sLen - 1`...
10,869,484
This has been asked a lot, but I'm after more specific answers. I'm designing/developing a suite of applications that are dependent on communicating with a agent and a manager. They will be communicating commands (from manager to agent) and statistics (agent to manager). At the moment, this suite of applications will ...
2012/06/03
[ "https://Stackoverflow.com/questions/10869484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/421023/" ]
Does this snippet give the output you want? (It is compileable and executeable) ``` import java.util.ArrayList; import java.util.List; public class SO { static ArrayList<Integer> specs = new ArrayList<Integer>(); static int[] i; public static void main(String[] args) throws Exception { specs.add...
You can try this : ``` public static void loops(ArrayList<Integer> specs, int idx, StringBuilder res){ if(idx==specs.size()-1){ for (int i = 0; i < specs.get(idx); i++) { System.out.println(i+" "+res); } } else{ for(int i=0;i<specs.get(idx);i++){ res.insert(0...
52,078,391
I have the following code from a tutorial on youtube (im just getting started with react native): ``` import React, {Component} from 'react'; import { Text, StyleSheet, View, TextInput, ScrollView, TouchableOpacity} from 'react-native'; type Props = {}; export default class Main extends Component<Props> { render() ...
2018/08/29
[ "https://Stackoverflow.com/questions/52078391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9231880/" ]
This is just a typo, this happens sometimes, just change "Veiw" to "View". Since you are new to React Native you can always head over to the [official documentation](https://facebook.github.io/react-native/docs/view) and be sure that the components you are working with actually exist when importing them (the official c...
I believe you spelt 'view' wrong, Try this: ``` import React, {Component} from 'react'; import { Text, StyleSheet, View, TextInput, ScrollView, TouchableOpacity} from 'react-native'; type Props = {}; export default class Main extends Component<Props> { render() { return ( <View st...
46,484,989
I'm trying to design the database schema with the ability to both private chat and group chat. Here's what I've got so far: [![enter image description here](https://i.stack.imgur.com/qnLFa.png)](https://i.stack.imgur.com/qnLFa.png) So - the theory is that even if the user is just in a one on one private chat, they ar...
2017/09/29
[ "https://Stackoverflow.com/questions/46484989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1445985/" ]
Your schema looks perfectly fine, you might see the others (including myself today) came with more or less the same structure before ([Storing messages of different chats in a single database table](https://stackoverflow.com/q/39810106/1657819), [Database schema for one-to-one and group chat](https://stackoverflow.com/...
I think you may need to refine your domain model a little - without that, it's hard to say whether your schema is "right". Taking Slack as a model (note - I haven't done a huge amount of research on this, so the details may be wrong), you might say that your system has "chats". A chat can be public - i.e. listed for ...
171,975
In Harry Potter and the Half-Blood Prince, Ollivander is missing and his shop is closed. In Harry Potter and the Deathly Hallows, Bellatrix gets a new wand ([somehow](https://scifi.stackexchange.com/questions/171969/whose-wand-did-bellatrix-use-at-the-battle-of-hogwarts)) and: > > Voldemort / Death Eaters have taken...
2017/10/16
[ "https://scifi.stackexchange.com/questions/171975", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/55637/" ]
Even though Olivander's Shop is an important part of the Harry Potter story, it's not reasonable to assume all wands were distributed through that shop alone. There would be other shops around the world, and as with the Weasley family, there would be hand-me-downs. And of course there must be some number of other wizar...
What do you think the Ministry of Magic under Voldemort's control was doing with the wands of [Muggle-borns](http://harrypotter.wikia.com/wiki/Muggle-born) that were sentenced to Azkaban? > > The Commission punished anyone who could not prove to have wizarding heritage for this alleged action, sentencing them to Azka...
11,446,395
I am working on some large web projects at work, and a lot of HTML ID's and Classnames are being used. When I create something new in one of those huge projects, naming new ID's and classes can be frustrating, because I always end up with something like `#subprojectname_title` , `.subprojectname_editor` to make sure ...
2012/07/12
[ "https://Stackoverflow.com/questions/11446395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/561545/" ]
I have a simple solution for this in my projects. I use "unique" names for globally effective styles and "common" names for local scope. i.e. My site.css uses names such as "defaultList" or "defaultWhiteButton", where as my pageX.css uses "list" and "button". I never make use of IDs for my selectors, since IDs are u...
Instead of .subproject\_thingie1 and .subproject\_thingie2 everywhere I usually go for adding a root class or id to differentiate between projects/pages. That way you can have global styling maintained on all pages on the same class names while being able to add specific rules for specific pages. But as always, the b...
44,742,705
``` #include <stdio.h> void fun(int *i) { (*i) = (*i) + 1; } int main() { int pskills[] = { 10, 20, 30, 40, 50 }; int i, *ptr ; ptr = pskills; for (i = 0; i < 4; i++) { fun(ptr++); printf("%d\n", *ptr); } return 0; } ``` After I compile the code, the results are: ``` 20...
2017/06/25
[ "https://Stackoverflow.com/questions/44742705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8210760/" ]
In the first pass, you pass a pointer to `pskills[0]` to `fun` (incrementing `10` to `11`), but you increment `ptr` before the `printf`, so you print `pskills[1]` (`20`). In short, you incremented `ptr` too soon. You want ``` fun(ptr); printf("%d\n", *ptr); ++ptr; ``` or ``` fun(ptr); printf("%d\n", *(ptr++)); ``...
You are increasing the pointer before you print the content `fun(ptr++);`. You want to increase the content, then print, then increase the pointer. ``` #include <stdio.h> void fun(int *i) { (*i) = (*i) + 1; } int main(void) { int pskills[] = { 10, 20, 30, 40, 50 }; int i, *ptr ; ptr = pskills; for ...
1,003,823
Find the last two digits of $3^{2002}$. How should I approach this question using modulo? I obtained 09 as my answer however the given answer was 43. My method was as follows: $2002\:=\:8\cdot 250+2$ $3^{2002}=\:3^{8\cdot 250+2}\:=\:3^{8\cdot 250}\cdot 3^2$ The last two digits is the remainder when divided by 100...
2014/11/03
[ "https://math.stackexchange.com/questions/1003823", "https://math.stackexchange.com", "https://math.stackexchange.com/users/177860/" ]
Observe that $\text{gcd(3,100)} = 1$, by Euler totient formula: $3^{\phi(100)} \cong 1(\mod 100)$. But $\phi (100) = 100\left(1-\dfrac{1}{2}\right)\left(1-\dfrac{1}{5}\right) = 40$. Thus: $3^{40} \cong 1(\mod 100)$. So $3^{2002} = (3^{40})^{50}\cdot 3^2 \cong 1\cdot 9(\mod 100) \cong 9(\mod 100)$. Thus the remainder is...
Using [Carmichael function](http://en.wikipedia.org/wiki/Carmichael_function), $\lambda(100)=20$ As $(3,100)=1$ and $2002\equiv2\pmod{20},$ $$\implies3^{2002}\equiv3^2\pmod{100}$$ --- $$3^{2002}=(3^2)^{1001}=9^{1001}=(10-1)^{10001}$$ $$=-1+\binom{1001}110\pmod{100}\equiv10010-1\equiv9$$
23,253,609
I am asking this question because I'm unsure of the best way to solve my problem. Problem: I have a pre-populated drop down list of 1,000 or so numbers. I need to limit which numbers appear in the drop down based on which user is using the drop down. Solution I thought of: 1. Hide all numbers with jQuery 2. Use jQ...
2014/04/23
[ "https://Stackoverflow.com/questions/23253609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007416/" ]
I would go only with steps 2-3 of your approach; however, I would not store the numbers in the way you showed. A better approach would be to store them in a table called user\_value -or something like that-: ``` user_id | value ---------+------- user1 | 101 user1 | 102 user2 | 101 ``` Just because you ...
i think a good way to do it would be using JSON for all users. prepare a json array for users with options and render it based on users to populate options. eg. ``` var user1 = '["101","102","103"]'; ```