qid
int64
1
74.7M
question
stringlengths
0
70k
date
stringlengths
10
10
metadata
list
response
stringlengths
0
115k
16,035,976
I create a loop in Wordpress with the condition like this: 1. Display a specific post format (example: video) 2. Limiting the post number. In this case, I only want to display 2 posts. Here my code: ``` <?php $i = 1; if (have_posts()) : while (have_posts() && $i < 3) : the_post(); ?> <?php get_template_part( 'cont...
2013/04/16
[ "https://Stackoverflow.com/questions/16035976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2098167/" ]
You can [use `Assume`](http://junit.sourceforge.net/javadoc/org/junit/Assume.html) to turn tests on/off conditionally: > > A set of methods useful for stating assumptions about the conditions in which a test is meaningful. A failed assumption does not mean the code is broken, but that the test provides no useful info...
13,456,834
I need to execute the following function in a specific context. ``` setTimeout(function () { myFunction(); }, 1000 * 60); var changeDateFormat = function () { console.log(this); // this should be $('.myClass') // but I need to set it from setTimeout // any hints ...
2012/11/19
[ "https://Stackoverflow.com/questions/13456834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1113216/" ]
You can use [jQuery.proxy](http://api.jquery.com/jQuery.proxy/). ``` setTimeout($.proxy(myFunction, $(".myClass")), 1000 * 60); ``` Here's an example: <http://jsfiddle.net/UwUQD/1/> As James said you can also use `apply` as jQuery does internally: ``` proxy = function() { return fn.apply( context, args.concat(...
38,753,092
Say I have two dataframes like the following: ``` n = c(2, 3, 5, 5, 6, 7) s = c("aa", "bb", "cc", "dd", "ee", "ff") b = c(2, 4, 5, 4, 3, 2) df = data.frame(n, s, b) # n s b #1 2 aa 2 #2 3 bb 4 #3 5 cc 5 #4 5 dd 4 #5 6 ee 3 #6 7 ff 2 n2 = c(5, 6, 7, 6) s2 = c("aa", "bb", "cc", "ll") b2 = c("hh", "nn", "ff", "...
2016/08/03
[ "https://Stackoverflow.com/questions/38753092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4962535/" ]
A coupld of problems: 1) you have built a couple of dataframes with factors which has a tendency to screw up matching and indexing, so I used stringsAsFactors =FALSE in hte dataframe calls. 2) you have an ambiguous situation with no stated resolution when both s2 and b2 have matches in the s column (as does occur in yo...
33,095,072
How can I launch a new Activity to a Fragment that is not the initial fragment? For example, the following code is wrong. I want to launch the MainActivity.class AT the SecondFragment.class. Seems simple enough but cannot find an answer anywhere. All help is greatly appreciated! ``` public void LaunchSecondFragment(Vi...
2015/10/13
[ "https://Stackoverflow.com/questions/33095072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4950598/" ]
So, before starting an activity you have to do something like: ``` Intent intent = new Intent(this, MainActivity.class); intent.putExtra("launchSecondFragment", true) startActivity(intent) ``` and in your MainActivity onCreate() ``` if(getIntent().getBooleanExtra("launchSecondFragment", false)) { //do fragment tran...
39,787,004
``` <% if(session == null) { System.out.println("Expire"); response.sendRedirect("/login.jsp"); }else{ System.out.println("Not Expire"); } %> <% HttpSession sess = request.getSession(false); String email = sess.getAttribute("email").toString(); Connection conn = Database.getC...
2016/09/30
[ "https://Stackoverflow.com/questions/39787004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5533485/" ]
TimeSpan can be negative. So just substract the TimeSpan for 4PM with current [TimeOfDay](https://msdn.microsoft.com/en-us/library/system.datetime.timeofday), if you get negative value, add 24 hours. ``` var timeLeft = new TimeSpan(16, 0, 0) - DateTime.Now.TimeOfDay; if (timeLeft.Ticks<0) { timeLeft = timeLeft.Ad...
770,179
I have simple code that does a head request for a URL and then prints the response headers. I've noticed that on some sites, this can take a long time to complete. For example, requesting `http://www.arstechnica.com` takes about two minutes. I've tried the same request using another web site that does the same basic t...
2009/04/20
[ "https://Stackoverflow.com/questions/770179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39539/" ]
Try simplifying it a little bit: ``` print htmlentities(file_get_contents("http://www.arstechnica.com")); ``` The above outputs instantly on my webserver. If it doesn't on yours, there's a good chance your web host has some kind of setting in place to throttle these kind of requests. **EDIT**: Since the above happ...
41,292,734
First off, this is my first post, so if I incorrectly posted this in the wrong location, please let me know. So, what we're trying to accomplish is building a powershell script that we can throw on our workstation image so that once our Windows 10 boxes are done imaging, that we can click on a powershell script, have...
2016/12/22
[ "https://Stackoverflow.com/questions/41292734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7332516/" ]
Two things as per my observation: ``` (Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey | out-file c:\license.txt ``` I don't think that it is returning any value to your license.txt. If yes, then I would like you to see if there is any space before and after the license key. You...
23,567,099
I have an query related to straight join the query is correct but showing error ``` SELECT table112.id,table112.bval1,table112.bval2, table111.id,table111.aval1 FROM table112 STRAIGHT_JOIN table111; ``` Showing an error can anybody help out this
2014/05/09
[ "https://Stackoverflow.com/questions/23567099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3612276/" ]
There is missing the join condition. ``` SELECT table112.id,table112.bval1,table112.bval2, table111.id,table111.aval1 FROM table112 STRAIGHT_JOIN table111 ON table112.id = table111.id ```
35,219,203
``` import iAd @IBOutlet weak var Banner: ADBannerView! override func viewDidLoad() { super.viewDidLoad() Banner.hidden = true Banner.delegate = self self.canDisplayBannerAds = true } func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool { return true...
2016/02/05
[ "https://Stackoverflow.com/questions/35219203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3843135/" ]
Your connection string looks like it's not in line with what's specified in the [documentation](https://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx). Try changing your connection string from: ``` "jdbc:sqlserver://localhost:1433;sa;VMADMIN#123;" ``` To: ``` "jdbc:sqlserver://localhost:1433;user=sa;p...
29,804,680
I am working with `ViewPager` i.e on top of the `MainActivity` class and the `Viewpager` class extends fragment. The problem is that, normally when we need a class to return some `result` then while passing the `intent` we use `startActivityforresult(intent,int)` hence it passes the result captured in the secondactivi...
2015/04/22
[ "https://Stackoverflow.com/questions/29804680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4578454/" ]
Some suggested improvements: ``` BEGIN { split("KS .07 MO .08",tmp) for (i=1;i in tmp;i+=2) taxRate[tmp[i]] = tmp[i+1] fmtS = "%12s%s\n" fmtF = "%12s$%.2f\n" } NR>1 { name=$1" "$2 state=$3 payRate=$4 hoursWorked=$5 overtime=$6 grossPay=(hoursWorked+(overtime*1.5))*payRa...
6,030,137
I am trying to build a WCF service that allows me to send large binary files from clients to the service. However I am only able to successfully transfer files up to 3-4MB. (I fail when I try to transfer 4.91MB and, off course, anything beyond) **The Error I get if I try to send the 4.91MB file is:** **Exception Mes...
2011/05/17
[ "https://Stackoverflow.com/questions/6030137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/402186/" ]
*(While I agree that [streaming transfer](http://msdn.microsoft.com/en-us/library/ms789010.aspx) would be preferrable, the below should make it work without any other changes)* You also need to increase the maximum message length in the Web.config: ``` <configuration> <system.web> <httpRuntime maxMessageLength="4...
4,608,257
I evaluated the integral as follow, $$\int\_0^\pi \cos^3x dx=\int\_0^\pi(1-\sin^2x)\cos xdx$$ Here I used the substitution $u=\sin x$ and $du=\cos x dx$ and for $x\in [0,\pi]$ we have $\sin x\in [0,1]$ Hence the integral is, $$\int\_0^11-u^2du=u-\frac{u^3}3\large\vert ^1\_0=\small\frac23$$But the answer I got is wrong ...
2022/12/30
[ "https://math.stackexchange.com/questions/4608257", "https://math.stackexchange.com", "https://math.stackexchange.com/users/794843/" ]
The substitution rule can only be applied if the substitution is by a monotonous function. This is not the case for the sine on $[0,\pi]$. You would have to split the domain and apply the substitution rule separately on the intervals $[0,\frac\pi2]$ and $[\frac\pi2,\pi]$. In the other way you computed the primitive or...
44,887,617
I'm trying to make a code that's verified if someone (1) is checking out his name but it does not really ``` <?php if($usrn['verified'] == 1): { ?> <i class="fa fa-check-circle verified verified-sm showTooltip" title="Verified User" data-toggle="tooltip" data-placement="right"></i> <?php } endif; ?> <?php $usern ...
2017/07/03
[ "https://Stackoverflow.com/questions/44887617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8248870/" ]
Just Remove Override Method like this ``` @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_and_add, menu); return true; } ``` This Override Method is responsible to for creating three dote as you mention it's really `OptionMenu`. If you don't want it, don't ov...
49,438,437
I am working on this game on checkio.org. Its a python game and this level I need to find the word between two defined delimiters. The function calls them. So far I have done alright but I can't get any more help from google probably because I don't know how to ask for what i need. Anyways I am stuck and I would like...
2018/03/22
[ "https://Stackoverflow.com/questions/49438437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`expand` method is equivalent to flatMap in Dart. ``` [1,2,3].expand((e) => [e, e+1]) ``` What is more interesting, the returned `Iterable` is lazy, and calls fuction for each element every time it's iterated.
18,383,773
I'm facing the problem described in [this question](https://stackoverflow.com/questions/4031857/way-to-make-java-parent-class-method-return-object-of-child-class) but would like to find a solution (if possible) without all the casts and @SuppressWarning annotations. A better solution would be one that builds upon the ...
2013/08/22
[ "https://Stackoverflow.com/questions/18383773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586682/" ]
No cast, no @SuppressWarning, few lines only: ```java public abstract class SuperClass<T extends SuperClass<T>> { protected T that; public T chain() { return that; } } public class SubClass1 extends SuperClass<SubClass1> { public SubClass1() { that = this; } } public class SubClas...
45,993,468
I'm using angular 4 and I try to get data from 2 endpoints but I have a problem understanding rxjs. with this code I can only get list of students and users only. ``` getStudent() { return this.http.get(this.url + this.student_url, this.getHeaders()).map(res => res.json()); } getUsers() { return this.http...
2017/09/01
[ "https://Stackoverflow.com/questions/45993468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8525484/" ]
You can use the `switchMap` operator (alias of `flatMap`) in the following code : ``` // Observables mocking the data returned by http.get() const studentObs = Rx.Observable.from([ {"ID" : 1 , "SchoolCode": "A150", "UserID": 1 }, {"ID" : 5 , "SchoolCode": "A140" , "UserID": 4}, {"ID" : 9 , "SchoolCode": "C140"...
23,130,785
I have a query as follows ``` SELECT s.`uid` FROM `sessions` s ``` (this was an extended query with a LEFT JOIN but to debug i removed that join) FYI the full query was ``` SELECT s.`uid`, u.`username`, u.`email` FROM `sessions` s LEFT JOIN `users` u ON s.`uid`=u.`user_id` ``` There are three results in the ses...
2014/04/17
[ "https://Stackoverflow.com/questions/23130785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/780128/" ]
You can add a meta tag to your page header to prevent mobile safari turning telephone numbers into links ``` <meta name="format-detection" content="telephone=no"> ```
10,701,493
I need to get div id and its child class name by using div name . But div Id will be different and unique all the time. **HTML** ``` <div class="diagram" id="12" > <div class="121"> ... </div> </div> <div class="diagram" id="133" > <div class="33"> ... </div> </div> <div class="diagram" id="199" ...
2012/05/22
[ "https://Stackoverflow.com/questions/10701493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1383645/" ]
``` $('div.diagram').each(function() { // this.id -> get the id of parent i.e div.diagram // $('div:first', this) -> get the first child of diagram, here this refers to diagram // $('div:first', this).attr('class') -> get the class name of child div o.circle(this.id, $('div:first', this).attr('class')); }); ...
19,588,606
I am using this code to search for a specific file pattern recursively in a given directory: ``` if (file.isDirectory()) { System.out.println("Searching directory ... " + file.getAbsoluteFile()); if (file.canRead()) { System.out.println("Can read..."); if (file.l...
2013/10/25
[ "https://Stackoverflow.com/questions/19588606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1506071/" ]
Try this: ``` if (file.isDirectory()) { System.out.println("Searching directory ... " + file.getAbsoluteFile()); if (file.canRead()) { System.out.println("Can read..."); if (file.listFiles() == null) { System.out.println("yes it is null"); ...
45,433,817
I try to make server-side processing for [DataTables](https://datatables.net) using Web API. There are two actions in my Web API controller with same list of parameters: ``` public class CampaignController : ApiController { // GET request handler public dtResponse Get(int draw, int start, int length) { ...
2017/08/01
[ "https://Stackoverflow.com/questions/45433817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7914637/" ]
The only workaround is to get the keycode and cast it to String: ``` var str = ''; var el = document.getElementById('#test'); document.addEventListener('keypress', function(event) { const currentCode = event.which || event.code; let currentKey = event.key; if (!currentKey) { currentKey = String.fromCharCode(...
55,780,439
Hi guys I am totally new in oop in python. I am trying to write a class of students that gets the number of students, their ages, their heights and their weights and store these information as 3 separate lists. I aim to compute the average of ages and weights as well as heights. I don't have any problem so far. In ...
2019/04/21
[ "https://Stackoverflow.com/questions/55780439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10781523/" ]
You mix class attributes and instance attributes. Class attributes are *shared* between instances: ``` class Banks: total = 0 def __init__(self,name,money): self.name=name self.money=money Banks.total += money b1 = Banks("one",100) b2 = Banks("two",5000000) # prints 5000100 - all the ...
177,528
I downloaded and enabled translations for my Drupal core and modules using these Drush commands: ``` drush dl l10n_update && drush en -y $_ drush language-add lt && drush language-enable $_ drush l10n-update-refresh drush l10n-update ``` I got almost everything translated, and in "Administration » Configuration » Re...
2015/10/14
[ "https://drupal.stackexchange.com/questions/177528", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/50624/" ]
Here is a custom function I use in update hooks, to translate some missing translations, just in case you want to do this programmatically: ```php function translateString($source_string, $translated_string, $langcode) { $storage = \Drupal::service('locale.storage'); $string = $storage->findString(array('source' =...
5,914,978
I am currently in the planning stages for a fairly comprehensive rewrite of one of our core (commercial) software offerings, and I am looking for a bit of advice. Our current software is a business management package written in Winforms (originally in .NET 2.0, but has transitioned into 4.0 so far) that communicates d...
2011/05/06
[ "https://Stackoverflow.com/questions/5914978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82187/" ]
*(I am working on the assumption that by "stateful" you mean session-based).* I guess one big question is: Do you want to use SOAP in your messaging stack? You may be loathe to, as often there is no out-of-box support for SOAP on mobile platforms (see: [How to call a web service with Android](https://stackoverflow.co...
14,530,617
I am new to CSS/HTML and I am having some trouble adjusting the width of my page. I'm sure the solution is very simple and obvious lol. On this page: <http://www.bodylogicmd.com/appetites-and-aphrodisiacs> - I am trying to set the width to 100% so that the content spans the entire width of the page. The problem I am ...
2013/01/25
[ "https://Stackoverflow.com/questions/14530617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2012426/" ]
``` #main, #content, .landing-wrapper, #column2 .box2 {width: auto;} #column2 {width: auto; float: none;} ``` You should be able to place this in the head of your template's index.php, though I would personally add it to the bottom of the theme's main stylesheet. How long it's there isn't a factor.
36,096,204
How do I create a Custom Hook Method in a Subclass? No need to duplicate Rails, of course -- the simpler, the better. My goal is to convert: ``` class SubClass def do_this_method first_validate_something end def do_that_method first_validate_something end private def first_validate_something; ...
2016/03/19
[ "https://Stackoverflow.com/questions/36096204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5298869/" ]
Here's a solution that uses `prepend`. When you call `before_operations` for the first time it creates a new (empty) module and prepends it to your class. This means that when you call method `foo` on your class, it will look first for that method in the module. The `before_operations` method then defines simple metho...
30,065,899
I know the logic/syntax of the code at the bottom of this post is off, but I'm having a hard time figuring out how I can write this to get the desired result. The first section creates this dictionary: ``` sco = {'human + big': 0, 'big + loud': 0, 'big + human': 0, 'human + loud': 0, 'loud + big': 0, 'loud + human': 0...
2015/05/06
[ "https://Stackoverflow.com/questions/30065899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4652988/" ]
The actual problem is that, instead of adding 1 to the values, you're doubling them: ``` sco[i][1] += sco[i][1] ``` And no matter how many times you add 0 to 0, it's still 0. To add 1, just use `+= 1`. --- But you've got another problem, at least in the code you posted. Each `sco[i]` value just a number, not a li...
17,143,401
What I'm having is that this error is displayed when I wanted to copy a exe debug project that I have created (which works witout any problems) to another machine (the error message is displayed). According to the [question posted previously](https://stackoverflow.com/questions/7904213/msvcp100d-dll-missing), the best...
2013/06/17
[ "https://Stackoverflow.com/questions/17143401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2441175/" ]
MSVCP100.dll is part of the Microsoft Visual Studio 10 runtime. MSVCP100d.dll is the debug build of the same dll - useful for running your program in debug mode. <http://www.microsoft.com/en-us/download/details.aspx?id=5555> Basically it is a relatively new package and is not guaranteed to be on all systems, especial...
43,704,514
I would like to factor an equation by completing the square: ``` >>>> import sympy >>>> x, c = symbols('x c') >>>> factor(x**2 - 4*x - 1) x**2 - 4*x - 1 ``` However, I was expecting to see: ``` (x - 2)**2 - 5 ``` How can this be done in sympy?
2017/04/30
[ "https://Stackoverflow.com/questions/43704514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033422/" ]
In a circumstance like that you can get the factors using `solve`: ``` >>> solve(x**2-4*x-1) [2 + sqrt(5), -sqrt(5) + 2] ``` I would not expect `factor` to give me the factors in the form suggested in the question. However, if you really want to 'complete the square' sympy will do the arithmetic for you (you need to...
40,298,290
In MSDN, "For **reference types**, an explicit cast is required if you need to convert from a base type to a derived type". In wiki, "In programming language theory, a **reference type is a data type that refers to an object in memory**. A pointer type on the other hand refers to a memory address. Reference types can...
2016/10/28
[ "https://Stackoverflow.com/questions/40298290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3902173/" ]
First of all don't try to write all your code in a single statement. Its is easier to debug using multiple statements: ``` itemCode.setText((String)showItem.getValueAt(showItem.getSelectedRow(), 0)); ``` Can easily be written as: ``` Object value = showItem.getValueAt(rowCount, 0); itemCode.setText( value.toString(...
7,900
[The Axis of Awesome](http://en.wikipedia.org/wiki/The_Axis_of_Awesome) has a song called "4 Chords", a medley of various songs all written, or so it's claimed, using the same four chords. Now, from what I understand, a chord is just a bunch of tones played at the same time so they sound like one. For example, a 300 H...
2012/11/27
[ "https://music.stackexchange.com/questions/7900", "https://music.stackexchange.com", "https://music.stackexchange.com/users/400/" ]
**tl;dr - your definition of chord is wrong.** Your initial assumption > > a 300 Hz note and a 500 Hz note played simultaneously will be a 100 > Hz sound > > > is unfortunately incorrect. When you play a 300Hz note and a 500Hz note what you will get is a 300Hz note, and a 500Hz note, **and** a 200Hz note (the ...
56,606,827
Currently working on a very basic three table/model problem in Laravel and the proper Eloquent setup has my brain leaking. COLLECTION -> coll\_id, ... ITEM -> item\_id, coll\_id, type\_id, ... TYPE -> type\_id, ... I can phrase it a thousand ways but cannot begin to conceptualize the appropriate Eloquent relationsh...
2019/06/15
[ "https://Stackoverflow.com/questions/56606827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11558094/" ]
`HasManyThrough` isn't the right relationship between Collection and Type. `HasManyThrough` is kind of like chaining 2 `HasMany` relationships together: ``` Country -> State -> City ``` Notice how the arrows all go one way. That's because City has a foreign key to State, and State has a foreign key to Country. Your...
58,545,828
I know that JAWS, by default, will ignore `<span/>` tags. My team got around that issue. Now, however, we have some content that is displayed using `<span/>` tags where the text displayed for sighted users doesn't play well with JAWS reading the information out. In our specific case, it would be international bank acco...
2019/10/24
[ "https://Stackoverflow.com/questions/58545828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/394484/" ]
The technical answer is always the same, and has been repeated many times here and elsewhere: **aria-label has no effect if you don't also assign a role**. Now, for the more user experience question, I'm blind myself, and I can tell you, it may not be a good idea to force a spell out of each digit individually. * We ...
44,878,541
I have a few activities: * Splash screen * Login * Registration * Dashboard If the user has never logged in, it will go like this: > > Splash screen > Login > Registration > Dashboard > > > When I `back` from the Dashboard, it should exit the app, skipping through the other activities. `noHistory` on the Logi...
2017/07/03
[ "https://Stackoverflow.com/questions/44878541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1402526/" ]
Java defines two types of streams, byte and character. The main reason why System.out.println() can't show Unicode characters is that System.out.println() is a byte stream that deal with only the low-order eight bits of character which is 16-bits. In order to deal with Unicode characters(16-bit Unicode character), yo...
24,662,079
I am trying to make all the table cells equal to the image size, but for some reason, they won't be set to it. <http://jsfiddle.net/gzkhW/> HTML(shortened a bit) ``` <table> <tr> <td><img src="http://i.imgur.com/CMu2qnB.png"></td> <td></td> <td></td> <td></td> <td></td> ...
2014/07/09
[ "https://Stackoverflow.com/questions/24662079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077972/" ]
You would like to do these: 1. You can directly select using `.slide`. 2. Check the length of `nextUp` instead. Try this, seems to be a workaround: **JS** ``` $('.next').click(function() { var current = $('.slide'); var nextUp = $('.slide').next('.hello'); if( nextUp.length == 0 ) { $('div.hell...
17,373,866
I wrote an android library for some UI utilities. I have a function that return ImageView. But, my problem is that I want that the resource of the drawable image, will be in the project that contains the library. I will explain... I want that the ImageView will always take the drawable with the source name: `R.drawabl...
2013/06/28
[ "https://Stackoverflow.com/questions/17373866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1725836/" ]
I found the answer. You need to create a file called `drawables.xml` in the library. Then inside it write: ``` <resource> <item name="ic_img_logo" type="drawable" /> </resource> ``` Its make fake resource `R.drawable.ic_img_logo`. Then if the project that include the library have drawable called `ic_img_logo`. T...
60,817,243
I have large data files formatted as follows: ``` 1 M * 0.86 2 S * 0.81 3 M * 0.68 4 S * 0.53 5 T . 0.40 6 S . 0.34 7 T . 0.25 8 E . 0.36 9 V . 0.32 10 I . 0.26 11 A . 0.17 12 H . 0.15 13 H . 0.12 14 W . 0.14 15 A . 0.16 16 F . 0.13 17 A . 0.12 18 I . 0.12...
2020/03/23
[ "https://Stackoverflow.com/questions/60817243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441735/" ]
There are several way to perform this. One solution is to read the file line by line. I advise you to have a look at this very good [tutorial](https://stackabuse.com/read-a-file-line-by-line-in-python/) on how to read file. Once you did it, you can try the following: * Iterate over each line of the file: + If the...
19,056,546
I want to create an HTML Message to send an email in PHP. ``` $message = $mess0 . "</br>" . $mess1 . "</br>" . $mess2 . "</br>" . $mes1 . "</br></br>" . $mes2 . "</br>" . $mes23 . "</br></br>" . $mes3 . "</br></br>" . $mes4 . "</br>" . $mes5 . "</br>" . $mes6 . "</br>" . $mes7 . "</br>" . $mes8 . "</br>" . $mes9 ...
2013/09/27
[ "https://Stackoverflow.com/questions/19056546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1921872/" ]
Add HTML tags between double quotes. ``` $message = "<html><body><p>".$message."</p></body></html>"; ```
23,859,259
I would like to ask a question about "foreach loop" in PHP. Towards the bottom of the code below, the "while" loop accesses elements from an array individually. How can I rewrite the BODY of the while loop using a "foreach" loop? ``` <?php require_once('MDB2.php'); $db = MDB2::connect("mysql://mk:mk@shark.compa...
2014/05/25
[ "https://Stackoverflow.com/questions/23859259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975787/" ]
If you dereference a `char **`, you should get a pointer to `char`. There are no pointers in a `char[3][10]`. They're just not interchangeable. It works for a one-dimensional `char *` array because the array name implicitly converts to a pointer to the first element in this context, and if you dereference a `char *` y...
1,300,792
In Windows I would like to be able to run a script or application that starts an another application and sets its size and location. An example of this would be to run an application/script that starts notepad and tells it to be 800x600 and to be in the top right corner. Does anyone have any ideas regardless of languag...
2009/08/19
[ "https://Stackoverflow.com/questions/1300792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143074/" ]
Do you mean something like this: ``` $ xterm -geometry 135x35+0+0 ``` which puts an xterm at the top-left of the screen (`+0+0`) and makes it 135 columns by 35 lines? Most X apps take a -geometry argument with the same syntax (though often in pixels, not characters like xterm), and you can obviously put that in a sh...
7,847,778
I send a invite ,Below code is used to give you the request id. I'm the sender A. I send invite to b.I can get the request\_id but how to get the A UID. ``` //get the request ids from the query parameter $request_ids = explode(',', $_REQUEST['request_ids']); //build the full_request_id from request_id and user_id ...
2011/10/21
[ "https://Stackoverflow.com/questions/7847778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Set it: `$user_id_A = $facebook->getUser();` Here's some info about the getUser() method: <https://developers.facebook.com/docs/reference/php/facebook-getUser/>
1,645,166
image naturalWidth return zero... that's it, why ? ``` var newimage = new Image(); newimage.src = 'retouche-hr' + newlinkimage.substring(14,17) + '-a.jpg'; var width = newimage.naturalWidth; alert (width); ``` HELP, i dont know why ! \*\*\* that path is good, the image show up !
2009/10/29
[ "https://Stackoverflow.com/questions/1645166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71830/" ]
I'd guess it's because you're not waiting for the image to load - try this: ``` var newimage = new Image(); newimage.src = 'retouche-hr' + newlinkimage.substring(14,17) + '-a.jpg'; newimage.onload = function() { var width = this.naturalWidth; alert(width); } ```
544,156
When cloning git repositories in automated tools - web front ends, CI systems, sometimes the git clone invocation opens up a prompt asking for the username and password (for example, when cloning a non-existent Github repo or on a new node missing ssh keys). How do I make git just fail (preferably with a sensible erro...
2013/10/06
[ "https://serverfault.com/questions/544156", "https://serverfault.com", "https://serverfault.com/users/109581/" ]
In git version 2.3 there's an environment variable `GIT_TERMINAL_PROMPT` which when set to `0` will disable prompting for credentials. You can get more info about it in `man git` (after updating to git version `2.3`) or in [this blog post on github](https://github.com/blog/1957-git-2-3-has-been-released). Examples: ...
2,963,436
I have the following: ``` echo time()."<br>"; sleep(1); echo time()."<br>"; sleep(1); echo time()."<br>"; ``` I wrote the preceding code with intention to echo `time()."<br>"` ln 1,echo `time()."<br>"` ln 4, wait a final second and then echo the final `time()."<br>"`. Altough the time bieng echoed is correct when ...
2010/06/03
[ "https://Stackoverflow.com/questions/2963436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/98204/" ]
You have output buffering turned on. It is more efficient for PHP to buffer up output and write it all to the browser in one go than it is to write the output in small bursts. So PHP will buffer the output and send it all in one go at the end (or once the buffer gets to a certain size). You can manually flush the buf...
34,458,383
Sorry if the Question Title is a bit off, couldn't think of something more descriptive. So I have 2 Domains: `aaa.com` and `bbb.com`. I want my second domain `bbb.com` to redirect always to `aaa.com` EXCEPT IF it has a certain path: `bbb.com/ct/:id` Both domains right now hit the same Heroku App. So in my `Applicat...
2015/12/24
[ "https://Stackoverflow.com/questions/34458383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1609496/" ]
I prefer to do your redirects in an actual controller and not in the route file so you can write a controller spec for it. ``` # app/controllers/application_controller.rb before_action :redirect_bbb_to_aaa def redirect_bbb_to_aaa if request.host == "http://bbb.com" redirect_to some_aaa_path unless request.url ...
28,374,712
I have a class: ``` public class NListingsData : ListingData, IListingData { private readonly IMetaDictionaryRepository _metaDictionary; //Constructor. public NListingsData(IMetaDictionaryRepository metaDictionary) { _metaDictionary = metaDictionary; } ...
2015/02/06
[ "https://Stackoverflow.com/questions/28374712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/475882/" ]
Just add an additional private, parameterless, constructor. This will get picked by Dapper.
203,829
We have a point-of-sale system that was developed using ado.net, our current concern is to make the application real fast in creating transactions (sales). Usually there are no performance concerns with high end PCs but with with low end PCs, the transactions take really slow. The main concern is on saving transaction...
2013/07/05
[ "https://softwareengineering.stackexchange.com/questions/203829", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/79820/" ]
I would like to point out that Entity Framework (full name: [ADO.NET Entity Framework](http://msdn.microsoft.com/en-us/library/bb399572.aspx)) is an ORM (Object Relational Mapper) that uses ADO.NET under the hood for connecting to the database. So the question "should we use ADO.NET or EF?" doesn't really make sense in...
1,699,836
I am newbie for ASP.NET MVC 1.0. I am converting from a classic application built up with VS2008 .NET3.5. I created a master page, and the menu must be read from the database. Now the code that generate the HTML into the appropriate menu div in classic ASP.NET3.5 VS2008 was in the code behind of the master page. I can...
2009/11/09
[ "https://Stackoverflow.com/questions/1699836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
In MVC there are no longer Code-Behind classes. What you want is a Partial. You'd use it like so: ``` <% Html.RenderPartial("MainMenu.ascx", ViewData["Menu"]); %> ``` If this Menu is going to be in all of your pages you can make your controllers subclass a custom controller class that always fills the Menu data fir...
277,955
I have 10 servers running on Ubuntu 14.04 x64. Each server has a few Nvidia GPUs. I am looking for a monitoring program that would allow me to view the GPU usage on all servers at a glance.
2016/04/20
[ "https://unix.stackexchange.com/questions/277955", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/16704/" ]
[munin](http://munin-monitoring.org/) has at least one [plugin](http://munin-monitoring.org/browser/munin-contrib/plugins/gpu/nvidia_gpu_) for monitoring nvidia GPUs (which uses the `nvidia-smi` utility to gather its data). You could setup a `munin` server (perhaps on one of the GPU servers, or on the head node of you...
28,185,048
I've read several guides on how to use GTK+ for a GUI in C programs and I came across [this tutorial](https://wiki.gnome.org/Projects/GTK+/OSX/Building) for getting GTK+ on my system. Here's everything I ran, line by line: ``` chmod +x gtk-osx-build-setup.sh ./gtk-osx-build-setup.sh cd ~/.local/bin ./jhbuild build pyt...
2015/01/28
[ "https://Stackoverflow.com/questions/28185048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1541563/" ]
My recommendation is to extract the meaningful portions of each handler into methods that can be called independently and can have useful return values. This is particularly important for your second button's handler, since the handler for button1 also depends on it. Upon extracting the code, you can transform the ex...
33,818
I recently bought a Sandisk Cruzer USB drive. Part of the drive (6.66 MB) is formatted with CDFS and shows as a CD drive. Why do they do this ? Is it to protect the software on that part of the disk to trick the OS (Vista) into not overwriting or amending, because it thinks this is a read-only CD ? Is the 6.66 MB sig...
2009/09/01
[ "https://superuser.com/questions/33818", "https://superuser.com", "https://superuser.com/users/7891/" ]
This is part of the U3 software that comes on it. It is garbage and I always remove it, the link for the removal tool is here:<http://u3.com/support/default.aspx#CQ3> Keep in mind, this will format your drive.
59,994,928
We are using the excellent Tabulator JS library. We poll our server at intervals to refresh the data in our table. We are trying to achieve the following behaviour when this happens. 1. Update the existing data in the table 2. Add any new rows that "Match" the current filters 3. Remove any rows that have changed and d...
2020/01/30
[ "https://Stackoverflow.com/questions/59994928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2141347/" ]
The latest version of Tabulator, 4.9, adds a [refreshFilter](http://tabulator.info/docs/4.9/filter#manage) function. This should accomplish most of your request. My own testing also show that the sorters are also refreshed by this function. `table.refreshFilter();`
7,037,273
I looking for way to animate text with jQuery. I want to display 'logging in...' message where 3 dots should be hidden on page load and after every lets say 300ms 1 dot to become visible. Which all together should create animation. Is there any jQuery function created to do exact that or I will have to right my own? ...
2011/08/12
[ "https://Stackoverflow.com/questions/7037273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/616643/" ]
This can be done rather nicely with a jQuery plugin. This makes it re-usable and configurable. Something like this is simple enough. It has 3 defaults, which can be overriden * **text** defaulted to "Loading" * **numDots** the number of dots to count up to before recycling back to zero, defaults to 3 * **delay** the ...
5,389
In the comments to [this answer](https://christianity.stackexchange.com/a/5258/85) to [the question of why Abraham lied to Pharaoh about his relationship with Sarah](https://christianity.stackexchange.com/questions/3524/why-did-abraham-lie-to-pharaoh-about-sarah-being-his-sister-in-gen-12/5258#5258), the following ques...
2012/01/13
[ "https://christianity.stackexchange.com/questions/5389", "https://christianity.stackexchange.com", "https://christianity.stackexchange.com/users/85/" ]
Like my answer [here](https://christianity.stackexchange.com/questions/5049/did-adam-and-eves-progeny-commit-incest), you need to keep the chronology right. There is no levitical law at the time of Abraham. Thus, even if he did marry his sister, remember that he was breaking no covenantal restriction on doing so. As I...
719,342
I have no idea how to solve these two, any help? $\mathtt{i)}$ $$\frac{1}{2\pi i}\int\_{a-i\infty}^{a+i\infty}\frac{e^{tz}}{\sqrt{z+1}}dz$$ $$ a,t\gt0$$ $\mathtt{ii)}$ $$ \sum\_{n=1}^\infty \frac{\coth (n\pi)}{n^3}=\frac{7\pi^3}{180}$$
2014/03/20
[ "https://math.stackexchange.com/questions/719342", "https://math.stackexchange.com", "https://math.stackexchange.com/users/135386/" ]
I'll do (i). Consider the contour integral $$\oint\_C dz \frac{e^{t z}}{\sqrt{z+1}}$$ where $C$ is the contour consisting of the line $\Re{z}=a$, $\Im{z} \in [-R,R]$; a circular arc of radius $R$ from $a+i R$ to $R e^{i \pi}$; a line from $R e^{i \pi}$ to $((1+\epsilon) e^{i \pi}$; a circle arc about $z=-1$ of radius...
15,007,104
I have a script I'm writing that makes a connection to a SOAP service. After the connection is made, I need to pass in a the username/pass with every command I send. The problem I have is that when I use read-host to do this, my password is shown in cleartext and remains in the shell: ``` PS C:\Users\Egr> Read-Host "E...
2013/02/21
[ "https://Stackoverflow.com/questions/15007104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/776890/" ]
$Password is a Securestring, and this will return the plain text password. ``` [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)) ```
39,713,134
I have a circle, consisting of 12 arc segments and I want to allow the user to see the transition from the start pattern to the end pattern. (there will be many start and end patterns). I have included the transition property in the css file, so that is not the issue. Here is my code so far: ``` function playAnimati...
2016/09/26
[ "https://Stackoverflow.com/questions/39713134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4162438/" ]
Give your Elements a `transition-delay` value. Of course a different one for each, like this ``` #LED1 { transition-delay: 0.1s; } #LED2 { transition-delay: 0.2s; } ... #LED2 { transition-delay: 1.2s; } ``` That should do it. You should be able to set the `transition-duration` directly in the **CSS** ...
4,299,089
I'm working on a journaling system in C# at our local church, but I've run into trouble with the database connection when storing birth dates. According to [MSDN](http://msdn.microsoft.com/en-us/library/system.datetime.minvalue.aspx?appId=Dev10IDEF1&l=EN-US&k=k%28SYSTEM.DATETIME%29;k%28TargetFrameworkMoniker-%22.NETFRA...
2010/11/28
[ "https://Stackoverflow.com/questions/4299089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/523204/" ]
You are going to have to roll your own class to handle BC dates in .NET, and store them in the database either as strings or as separate fields for year, month day (depending on what accuracy is required) if you require searching and sorting to be performed on the database side (which I assume you would). SQL Server's...
19,814,890
well this is my problem.. ``` <html> <body> <marquee id="introtext" scrollamount="150" behavior="slide" direction="left"> <p> this is the sliding text. </p> </marquee> </body> </html> ``` What chrome does is just weard. it repeats the "marquee" action after 4 seconds. what can i do...
2013/11/06
[ "https://Stackoverflow.com/questions/19814890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2960837/" ]
try loop="0" : ``` <marquee id="introtext" scrollamount="150" behavior="slide" direction="left" loop="0"> ```
31,972,045
Is there a reason to prefer using shared instance variable in class vs. local variable and have methods return the instance to it? Or is either one a bad practice? ``` import package.AClass; public class foo { private AClass aVar = new AClass(); // ... Constructor public AClass returnAClassSetted() { ...
2015/08/12
[ "https://Stackoverflow.com/questions/31972045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Instance variables are shared by all methods in the class. When one method changes the data, another method can be affected by it. It means that you can't understand any one method on its own since it is affected by the code in the other methods in the class. The order in which methods are called can affect the outcome...
494,571
I am currently studying for the GRE Physics subject test by working through published past tests. My question is about problem 44 from the test GR8677: > > [![Top-down diagram of point mass and stick before collision](https://i.stack.imgur.com/DzNMT.png)](https://i.stack.imgur.com/DzNMT.png) > > > $44.$ A uniform s...
2019/07/31
[ "https://physics.stackexchange.com/questions/494571", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/237071/" ]
The GRE question seems to be erroneous. You see, if one specifies that the collision is elastic then they cannot also specify what would be the speed of the ball (the mass $m$) after the collision. That over-constraints the problem. That is the reason you are finding inconsistencies in your two ways to approach the pro...
59,344,426
The input can only include two chemical elements: `C` and `H` The program must control. How can I provide that? ``` if (formul.Contains('C') == true && formul.Contains('H') == true) return true; ``` When my input is `HCA` it is still true. I want it only includes `C` and `H`.
2019/12/15
[ "https://Stackoverflow.com/questions/59344426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12278081/" ]
```cs using System.Linq; \\put this on top return formul.All(c => c == 'C' || c == 'H'); ``` This will return `true` if all characters of `formul` string are either 'C' or 'H'
12,091
Concerning "[Uranium-series dating](https://en.wikipedia.org/wiki/Uranium%E2%80%93thorium_dating)", also known as "Uranium-thorium dating". Uranium is present in deposits, "typically at levels of between a few parts per billion and few parts per million by weight", according to the wikipedia article on the subject. ...
2017/08/15
[ "https://earthscience.stackexchange.com/questions/12091", "https://earthscience.stackexchange.com", "https://earthscience.stackexchange.com/users/10777/" ]
The chemistry of lead is very different from that of uranium and thorium. There are key kinds of rock that could not possibly have been formed with even the smallest amount of primordial lead. The lithophilic nature of uranium and thorium means that those same kinds of rock could easily have readily accepted primordial...
5,568,904
I occasionally have Python programs that take a long time to run, and that I want to be able to save the state of and resume later. Does anyone have a clever way of saving the state either every x seconds, or when the program is exiting?
2011/04/06
[ "https://Stackoverflow.com/questions/5568904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/619962/" ]
Put all of your "state" data in one place and use a [pickle](http://docs.python.org/library/pickle.html). > > The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure. “Pickling” is the process whereby a Python object hierarchy is converted into a...
54,186,894
We are using .NET Core 2.1 and Entity Framework Core 2.1.1 I have the following setup in Azure West Europe * Azure SQL Database -- Premium P2 250 DTU -- Public endpoint, no VNET peering -- "Allow access to Azure Services" = ON * Azure Functions -- Consumption Plan -- Timeout 10 Minutes * Azure Blob storage -- hot ti...
2019/01/14
[ "https://Stackoverflow.com/questions/54186894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10871024/" ]
I've found this good documentation around sql database transient errors: * [Working with SQL Database connection issues and transient errors](https://learn.microsoft.com/en-us/azure/sql-database/sql-database-connectivity-issues) From the documentation: > > A transient error has an underlying cause that soon resolve...
9,073
It is often said that Nibbana is unconditioned. But isn't Nibbana to be attained through practice of the Noble Eightfold Path (abandoning desire, meditation, realizing paticcasamuppada etc)? Aren't those practices conditions for Nibbana? What am I missing here :) ?
2015/05/18
[ "https://buddhism.stackexchange.com/questions/9073", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/125/" ]
The practice of the eightfold noble path leads to the *experience* of nibbāna, just like the act of adverting the mind to the eye door leads to seeing light. Light, the object of seeing, is saṅkhata (conditioned), but nibbāna, the object of supermundane consciousness, is asaṅkhata (unconditioned). So nibbāna isn't the ...
132,551
I have a Ubuntu 9.10 server. I have installed apache2 and php5 using the apt-get commands. How does one install php extensions? Are there commands like apt-get to get them? Or should I manually look for the files on the php website and set them up in the php.ini? More specifically, I need mcrypt, curl and gd. Thanks
2010/04/15
[ "https://serverfault.com/questions/132551", "https://serverfault.com", "https://serverfault.com/users/24213/" ]
All you need to do is: ``` sudo apt-get install php5-mcrypt php5-curl php5-gd ``` If you need to check what is installed php-wise you can: ``` dpkg --list | grep php ``` EDIT: Removed sudo in the command above as it's not needed with dpkg --list.
7,924,782
I'm searching for following issue i have. The class file names of our project are named logon.class.php But the interface file for that class is named logon.interface.php My issue i have is that when the autoload method runs I should be able to detect if it is a class call or an interface call. ``` <?php function __...
2011/10/28
[ "https://Stackoverflow.com/questions/7924782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/896201/" ]
You can use [ReflectionClass::isInterface](http://au.php.net/manual/en/reflectionclass.isinterface.php) to determine if the class is an interface. ``` $reflection = new ReflectionClass($name); if ($reflection->isInterface()){ //Is an interface }else{ //Not an interface } ``` In your case, you would probably hav...
270,438
``` Around[100.123456, 0.12] ``` gives ``` 100.12±0.12 ``` But ``` Around[100.123456, 0.42] ``` gives ``` 100.1±0.4 ``` why not `100.12±0.42`. What is the rule for `Around` to show number of significant digits in uncertainty? **Update** I found it seems that `Around` take 35 as a boundary for uncertainty, ...
2022/07/06
[ "https://mathematica.stackexchange.com/questions/270438", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/4742/" ]
TL;DR ===== The number of significant figures displayed both for the value and its uncertainty depends on the value of the uncertainty. The details are not documented, but there seems to be a threshold around $0.35\* 10^n$ ##### EDIT An important comment by Greg Hurst > > The threshold seems to be 35.5, not 35, an...
27,863,830
Is there a way using `CSS3` or `javascript` to highlight a table row containing 2 elements where each table element is highlighted a different background color upon hovering over that row? So for example you have a table row with two values like ``` 1.45 | 2.56 ``` and the table element containing `1.45` would hav...
2015/01/09
[ "https://Stackoverflow.com/questions/27863830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3922295/" ]
Use [`:nth-child`](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-ch) selector, like this: ```css td { padding: 15px; } tr:hover td { background-color: red; color: white; cursor:pointer; } tr:hover td:nth-child(1) { background-color: blue; } ``` ```html <table> <tr> <td>2.00</td> ...
1,317,256
I'm trying to learn BNF and attempting to assemble some Z80 ASM code. Since I'm new to both fields, my question is, am I even on the right track? I am trying to write the format of Z80 ASM as EBNF so that I can then figure out where to go from there to create machine code from the source. At the moment I have the follo...
2009/08/22
[ "https://Stackoverflow.com/questions/1317256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385364/" ]
Old-school assemblers were typically hand-coded in assembler and used adhoc parsing techniques to process assembly source lines to produce actual assembler code. When assembler syntax is simple (e.g. always OPCODE REG, OPERAND) this worked well enough. Modern machines have messy, nasty instruction sets with lots of in...
23,297,520
I'm currently writing some software in Go that interacts with a REST API. The REST API endpoint I'm trying to query returns an HTTP 302 redirect along with an HTTP Location header, pointing to a resource URI. I'm trying to use my Go script to grab the HTTP Location header for later processing. Here's what I'm current...
2014/04/25
[ "https://Stackoverflow.com/questions/23297520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194175/" ]
There's a much simpler solution right now: ``` client := &http.Client{ CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, } ``` This way, the `http` package automatically knows: "Ah, I shouldn't follow any redirects", but does not throw any error. Fr...
33,511,462
I have to write a code that counts the number of odd numbers, even numbers, and zeros in a multi-digit long variable, here is what I have so far: ``` #include <iostream> using namespace std; int lab14(long num, int &even, int &odd, int &zero){ while (num > 0){ long w = num; w = num%10; ...
2015/11/04
[ "https://Stackoverflow.com/questions/33511462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5505001/" ]
As I mentioned in my [comment](https://stackoverflow.com/questions/33511461/how-do-i-dereference-this-hash-in-perl#comment54806600_33511461), you're flattening a list when you create `%hash`. The fat comma (`=>`) is a synonym for the comma that causes barewords on the left to be interpreted as strings, but it doesn't m...
38,708,129
I have a QML file that imports a JavaScript library: ``` import "qrc:/scripts/protobuf.js" as PB ``` This library [modifies the 'global' object](https://github.com/dcodeIO/protobuf.js/blob/master/dist/protobuf.js#L29) during setup. Simplified, the JS library is: ``` .pragma library (function(global){ global.dcode...
2016/08/01
[ "https://Stackoverflow.com/questions/38708129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/405017/" ]
The points listed under [JavaScript Environment Restrictions](http://doc.qt.io/qt-5/qtqml-javascript-hostenvironment.html#javascript-environment-restrictions) could be relevant here: > > JavaScript code cannot modify the global object. > > > In QML, the global object is constant - existing properties cannot be modi...
56,412,227
My angular 7 app is running using `ng serve` on port 4200. I have a node server running inside of a docker container, located at localhost:8081. I have verified that the server is up, and accessible, using postman. The url was `localhost:8081/login`. I was able to receive the data I expected when the POST request was ...
2019/06/02
[ "https://Stackoverflow.com/questions/56412227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5237611/" ]
As mentioned by @Austaras, an `Observable` must have at least one active subscription in order to execute it. You must subscribe to the `login()` method of `AuthenticationService` in the `LoginComponent` ``` import { Component, OnInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; i...
65,379,890
I have a database with four tables and I want my PHP to execute the query dynamically for one of these tables, based on the user's input. ``` $company = $_POST['company']; $model = $_POST['model']; $servername = "localhost"; $username = "user"; $password = "pass"; $database = "ref"; if ($company == "ford") { $tabl...
2020/12/20
[ "https://Stackoverflow.com/questions/65379890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14857827/" ]
The problem has already been pointed out (in your if-statements, you have `=` when it should be `==` and `==` where it should be `=`) so I just wanted to show a, in my opinion, cleaner way of doing the same thing. I would be to use an array for this. It's not only easier to read the relationships, but it also makes it...
14,468,001
Output I'm getting: * The base array * 7290 5184 6174 8003 7427 2245 6522 6669 8939 4814 The * Sorted array * -33686019 2245 4814 5184 6174 6522 6669 7290 7427 8003 * Press any key to continue . . . I have no idea where this, -33686019, number is coming from. I've posted all of the code because I really don't know wh...
2013/01/22
[ "https://Stackoverflow.com/questions/14468001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1715979/" ]
The following bit is not correct: ``` for( int i = 0; i < size; i++ ) { if( theArray[i+1] < theArray[i] ) ``` It is accessing one beyond the boundary of the array. The `for` loop should probably be: ``` for( int i = 0; i < size - 1; i++ ) ```
701,086
I am running a 10.04LTE server where I do want to upgrade openssl for apache. Therefore I downloaded openssl 1.0.2c and apache 2.2.29 and compiled both. The server is starting, but is using the old ssl version: ``` curl --head http://localhost HTTP/1.1 200 OK Date: Mon, 22 Jun 2015 06:00:06 GMT Server: Apache/2.2.29...
2015/06/23
[ "https://serverfault.com/questions/701086", "https://serverfault.com", "https://serverfault.com/users/84332/" ]
The problem is that your Apache installation is unable to link the shared libraries of your new OpenSSL installation. Run the command `ldd /usr/local/apache/modules/mod_ssl.so` (with the apporpriate path to your mod\_ssl.so). You'll see that mod\_ssl.so is not linking to the libraries in `/usr/local/ssl/lib` You have ...
10,864,333
Here's a strange one. We have a Google App Engine (GAE) app and a custom domain <http://www.tradeos.com> CNAME'd to ghs.google.com. In China we regularly get no response whatsoever from the server for 20 minutes or so then it works fine for a a while, sometimes for a few hours. Other non-Chinese sites like CNN seem t...
2012/06/02
[ "https://Stackoverflow.com/questions/10864333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1176505/" ]
Read portions of bytes to byte array and store them in new files when buffer is full or it is end of file. For example (code is not perfect, but it should help understanding the process) ``` class FileSplit { public static void splitFile(File f) throws IOException { int partCounter = 1;//I like to name pa...
35,015,850
Given that I have a `Supervisor` actor which is injected with a `child` actor how do I send the child a PoisonPill message and test this using TestKit? Here is my Superivisor. ``` class Supervisor(child: ActorRef) extends Actor { ... child ! "hello" child ! PoisonPill } ``` here is my test code ``` val prob...
2016/01/26
[ "https://Stackoverflow.com/questions/35015850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/532383/" ]
I think this [Testing Actor Systems](http://doc.akka.io/docs/akka/current/scala/testing.html) should answer your question: **Watching Other Actors from Probes** A TestProbe can register itself for DeathWatch of any other actor: ``` val probe = TestProbe() probe watch target target ! PoisonPill probe.expectTerminated...
2,573,501
* Given a triangle $\mathrm{A}\left(2,0\right),\ \mathrm{B}\left(1,3\right),\ \mathrm{C}\left(5,2\right)\ \mbox{with}\ \rho\left(x,y\right) = x$; I need to find it's centre of mass ?. * I know I need to integrate the density formula over the region, but I don't understand how to get the limits for the integrals to calc...
2017/12/19
[ "https://math.stackexchange.com/questions/2573501", "https://math.stackexchange.com", "https://math.stackexchange.com/users/392788/" ]
Denote by $\;AB,AC,BC\;$ the respective lines on which the sides $\;AB,AC,BC\;$ lie, thus: $$\begin{cases}AB:\;y=-3x+6\\{}\\AC:\;y=\cfrac23x-\cfrac43\\{}\\BC:\;y=-\cfrac14x+\cfrac{13}4\end{cases}$$ You should try to do a diagram, and then you need for the mass you need the integrals $$M=\int\_1^2\int\_{-3x+6}^{-\fra...
27,778,593
I am trying to install node.js on Red Hat Enterprise Linux Server release 6.1 using the following command: ``` sudo yum install nodejs npm ``` I got the following error: ``` Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel) Requires: libssl.so.10(libssl.so.10)(64bit) Error: Package: nodejs-devel-0.10.24...
2015/01/05
[ "https://Stackoverflow.com/questions/27778593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4088696/" ]
NodeJS provides a setup script that must run before you install it with yum ``` curl -sL https://rpm.nodesource.com/setup | bash - ``` Then the yum command should work ``` yum install -y nodejs ``` <https://github.com/joyent/node/wiki/installing-node.js-via-package-manager#enterprise-linux-and-fedora>
1,521,394
How can I send mail to Gmail using Perl? Here's what I'm trying: ``` my $mailer = Email::Send->new( { mailer => 'SMTP::TLS', mailer_args => [ Host => 'smtp.gmail.com', Port => 587, User => 'xxx', Password => 'xxx', ] } ); ...
2009/10/05
[ "https://Stackoverflow.com/questions/1521394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184311/" ]
Use [Net::SMTP::SSL](http://search.cpan.org/perldoc/Net::SMTP::SSL) to talk to GMail. See [MIME::Lite inline images](http://www.perlmonks.org/?node_id=784574) on [Perlmonks](http://www.perlmonks.org) for an example.
44,643,750
Consider the following code snippet: ``` [1]> (symbol-value '+) NIL [2]> + (SYMBOL-VALUE '+) [3]> (symbol-value '/) ((SYMBOL-VALUE '+)) [4]> (symbol-value '+) (SYMBOL-VALUE '/) [5]> * (SYMBOL-VALUE '/) ``` So, according to my observation, * symbol-value of `+` is the last input to the REPL. * symbol-value of `/` i...
2017/06/20
[ "https://Stackoverflow.com/questions/44643750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5345646/" ]
According the the [HyperSpec](http://www.lispworks.com/documentation/HyperSpec/Body/v__stst_.htm): > > The variables \*, \*\*, and \*\*\* are maintained by the Lisp read-eval-print loop to save the values of results that are printed each time through the loop. > > > The value of \* is the most recent primary value ...
26,897,502
I have to segregate the even and odd numbers in a 2D array in java in two different rows (even in row 1 and odd in row two). I have included the output of my code bellow here is what I have: ``` class TwoDimensionArrays { public static void main(String[] args) { int sum = 0; int row = 2; in...
2014/11/12
[ "https://Stackoverflow.com/questions/26897502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4092147/" ]
Instead of passing over the list twice try this: ``` for(int v = 0; v < 20; v++) { iArrays[v % 2][(int)v/2] = v; } ``` This will set `iArrays` to: ``` [[0,2,4,6,8,10,12,14,16,18], [1,3,5,7,9,11,13,15,17,19]] ``` What is happening is the `row` is being set to the remainder of `v % 2` (`0` if `v` is even, `1` ...
54,241,950
This is my first question in Stackoverflow and I am not a professional developer, so be kind guys :) If any additional information is needed, just let me know. So, I am trying to create a flatlist for a delivery man showing his daily itinerary. In this example he has 4 address to go to. When he arrives at the first pl...
2019/01/17
[ "https://Stackoverflow.com/questions/54241950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1075757/" ]
You can also try with one another approach as shown below. ``` Create Table Result(Id int, Title Varchar(10), Category Varchar(10), SubCategory Varchar(10), Value Int) Insert Into Result Values(1, 'Part-1','CatX', 'A', 100), (2 ,'Part-1','CatX', 'B', 0), (3 ,'Part-1','CatX', ...
35,079,608
I have an unordered dynamic list with same class list items. and I want to group the same class list items into one ul in the main ul. How can I group same class list items? I want to convert the below dynamic list ``` <ul> <li class="a1">Some Content</li> <li class="a1">Some Content</li> <li class="a1">...
2016/01/29
[ "https://Stackoverflow.com/questions/35079608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5740672/" ]
Here a solution for you: HTML: ``` <ul id="BaseNode"> <li class="a1">A</li> <li class="a1">B</li> <li class="a1">C</li> <li class="a1">D</li> <li class="a2">E</li> <li class="a2">F</li> <li class="a3">G</li> </ul> ``` --- jQuery: ``` $(document).ready(function(){ var lis = $("#Base...
11,324,750
I have table `types` and i want to build `selectbox` with all values from this table In my controller i wrote this code ``` $allRegistrationTypes = RegistrationType::model()->findAll(); $this->render('index', array('allRegistrationTypes' => $allRegistrationTypes)) ``` How build selectbox in view file ?
2012/07/04
[ "https://Stackoverflow.com/questions/11324750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1221313/" ]
Well then its pretty simple all you need to do is first create List Data like ``` CHtml::ListData(allRegistrationTypes,'value you want to pass when item is selected','value you have to display'); ``` for ex ``` typeList = CHtml::ListData(allRegistrationTypes,'id','type'); ``` now remember both ***id and type are...
42,164,949
Hello I am new at c# and I am doing a small game that I need to play mp3 files. I've been searching about this and using wmp to do it, like this: ``` WindowsMediaPlayer myplayer = new WindowsMediaPlayer(); myplayer.URL = @"c:\somefolder\project\music.mp3"; myplayer.controls.play(); ``` I am able to play...
2017/02/10
[ "https://Stackoverflow.com/questions/42164949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7547069/" ]
I think that your problem is the way you use `getResource()` : ``` Paths.get(getClass().getResource(filepath).toURI()); ``` You use a relative classpath (that is relative to the the current class location) to retrieve the `"extrapack-renew.sql"` file. It means that this resource has to be located inside this path...
26,433,429
I have an app that has a textbox, validation control and a button. The problem is that if someone copies text from a word document inside the textbox, some of the special characters won't be allowed because of the validation control. But if I delete those special characters and we typed them, the validation control wor...
2014/10/17
[ "https://Stackoverflow.com/questions/26433429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3896029/" ]
Copy the text into a `visibility: hidden` div with font styles equal to the textarea and a `max-width` that won't let it go beyond your number of columns. If the height of the hidden copy of the text exceeds your limit, remove the text that was added. The following is *close* to what you need. Unfortunately, it doesn'...
27,477,558
Here is the code for back button. I want to kill other activities by back button but its not working in one activity, but I have other activities and without one activity its working fine. Please help me out. ``` public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), ...
2014/12/15
[ "https://Stackoverflow.com/questions/27477558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4294246/" ]
Might be this code will help you: ``` public void onClick(View v) { Intent i = new Intent(getApplicationContext(), SomeActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } ```
74,247,005
In [this post](https://stackoverflow.com/questions/39538473/using-settimeout-on-promise-chain) it is mentioned that I can create a custom Promise with `setTimeout` like below: ```js const delay = t => new Promise(resolve => setTimeout(resolve, t)); ``` My operation needs to be executed after 100ms so `t` will be `10...
2022/10/29
[ "https://Stackoverflow.com/questions/74247005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19640633/" ]
We could do ``` nafilt_persample.ngsrep <- Map(function(dat, nm), { dat[c("lCI", "uCI")] <- nm[dat$Hugo_Symbol] dat }, nafilt_persample.ngsrep, cint) ``` Or with `for` loop ``` for(nm in names(nafilt_persample.ngsrep)) { nafilt_persample.ngsrep[[nm]][c("lCI", "uCI")] <- cint[[nm]...
5,474,767
I'm trying to solve [this problem.](https://stackoverflow.com/questions/5461191/creating-screens-and-underlying-data-access-layer-dynamically-on-android) I was wondering if it's possible to use ORMLite (or modify it) to support this use case ? Thanks.
2011/03/29
[ "https://Stackoverflow.com/questions/5474767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306346/" ]
Just use [db4o](http://www.db4o.com/android/) and forget all the sql and mappings hassle. Model your objects and persist them directly.
35,161,201
I have gone through almost all posts for this error. But i was unable for figure out the issue. I have tried to change build.gradle repositories to mavenCentral() and have also tried make changes in app.gradle. I just though of adding volley into my app, from then the sync is getting failed. I have also tried file->Inv...
2016/02/02
[ "https://Stackoverflow.com/questions/35161201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4994472/" ]
``` insert into table_a (f1, f2, f3, f4, f5, f6) select f1, f2, f3, f4, f5, f6 from ( ( select $1, $2, $3, f4, f5, f2, 1 from table_a where <conditionals> order by <ordering> limit 1 ) s union all select $1, $2, $3, '', '', null, 2 ) s (f1, f2, f3, f4, f5, f6, o) ...
48,862,529
I understand [why control characters are illegal in XML 1.0](https://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0), but still I need to store them somehow in XML payload and I cannot find any recommendations about escaping them. I cannot upgrade to XML 1.1. How should I escape e.g. ...
2018/02/19
[ "https://Stackoverflow.com/questions/48862529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4647853/" ]
One way is to use processing instructions: `<?hex 01?>`. But that only works in element content, not in attributes. And of course the processing instruction needs to be understood by the receiving application. You could also use elements: `<hex value="01"/>` but elements are visible in an XSD schema or DTD, while proc...
49,160,125
I have and Application which has a **singleton** that stores information across the whole app. However, this is creating some data race issues when using the singleton from different threads. Here there is a very dummy and simplistic version of the problem: **Singleton** ``` class Singleton { static var shared ...
2018/03/07
[ "https://Stackoverflow.com/questions/49160125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5761878/" ]
Thanks to @rmaddy comments which pointed me in the right direction I was able to solve the problem. In order to make the property `foo` of the `Singleton` thread safe, it need to be modified as follows: ``` class Singleton { static let shared = Singleton() private init(){} private let internalQueu...
60,772,541
This seems so simple I'm embarrassed to ask. I have a file with an unknown number of lines but at least 20. I always want to move lines 4-6 to lines 1-3. So this: ``` A B C D E F G H ``` becomes this: ``` D E F A B C G H ```
2020/03/20
[ "https://Stackoverflow.com/questions/60772541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13093997/" ]
``` $Lines = 'A'..'H' $Lines[3..5],$Lines[0..2],$Lines[6..99] ``` or ``` $Lines[3,4,5,0,1,2,6,7,8,9] ``` For details, see: [about arrays](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7)
21,563,414
I am using aptana studio v 3.4.2.201308081805 on windows 7, I know that v 3.5 is available because I was prompted to update to 3.5 on a different computer. I have not received the update prompt on my macbook air or on my work computer. Does anyone know how to force aptana to update to v 3.5?
2014/02/04
[ "https://Stackoverflow.com/questions/21563414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1922932/" ]
Aptana has removed version 3.5 due to several bugs. Current stable version is 3.4.2 You can check here [Aptana download](http://www.aptana.com/products/studio3/download)
62,315
After watching the thirteen films in the *Marvel Cinematic Universe*, I've been wondering if there is a longer running series of films that maps out a continuous storyline. [I've found this article on Wikipedia](https://en.wikipedia.org/wiki/List_of_film_series_with_more_than_twenty_entries), but I am unsure if any of...
2016/10/24
[ "https://movies.stackexchange.com/questions/62315", "https://movies.stackexchange.com", "https://movies.stackexchange.com/users/30280/" ]
According to [Wikipedia's entry for *Blondie* (the comic strip)](https://en.wikipedia.org/wiki/Blondie_(comic_strip)), of the 28 movies made based on the strip, at least the first 14 were a continuous series meeting your definition: > > Blondie was adapted into a long-running series of 28 low-budget theatrical B-fea...
29,774,038
Why is this query returning an error. I am trying to load the code for table as a constant string, the flag for data again a constant string, the time of insertion and the counts for a table. I thought, let me try and run the secelct before writing the inserts. But for some reason, it fails listing column names from ta...
2015/04/21
[ "https://Stackoverflow.com/questions/29774038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1725647/" ]
The double quotes on the literals is a problem. Here is a simpler version that I tested successfully: ``` hive -e "select 'WEB' , '1Hr' , from_unixtime((unix_timestamp(substr(sysDate, 0, 11), 'dd/MMM/yyyy')), 'MM/dd/yyyy') as time, count(*) from weblog where year=2015 and month=04 and day=17 group by 1,2 , from_unixti...
43,123
I'm getting aversion when someone do things that I don't like. This happens when a person do and not on natural things like rain. But It is hard to recorgnise it as aversion because that aversion is not towards a person. I just don't like certain actions that affect me (Only the things that affects me in someway). I do...
2020/11/03
[ "https://buddhism.stackexchange.com/questions/43123", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/17744/" ]
Very good question, focused on real and useful problem. Mind generates aversion when things go contrary to what it believes is "right". This belief is called "attachment". For example you believe that only certain weather is good and that it should be that same weather most of the time. So the first technique is to r...