Questions

Get visible items in RecyclerView

I need to know which elements are currently displayed in my RecyclerView. There is no equivalent to the [OnScrollListener.onScroll(...)](http://developer.android.com/reference/android/widget/AbsListVi...

28 Jul at 06:0

Get Specific Columns Using “With()” Function in Laravel Eloquent

I have two tables, `User` and `Post`. One `User` can have many `posts` and one `post` belongs to only one `user`. In my `User` model I have a `hasMany` relation... ``` public function post(){ r...

Get dictionary value by key

How can I get the dictionary value by a key on a function? My function code (and the command I try doesn't work): ``` static void XML_Array(Dictionary<string, string> Data_Array) { String xmlfile ...

8 Nov at 04:4

How can I check if a checkbox is checked?

I am building a mobile web app with jQuery Mobile and I want to check if a checkbox is checked. Here is my code. ``` <script type=text/javascript> function validate(){ if (remember.checked == 1...

12 Aug at 13:8

Can I make 'git diff' only display the line numbers AND changed file names?

[see this question and answer](https://stackoverflow.com/q/1552340/124486) --- Basically, I don't want to see the changed content, just the file names and line numbers.

14 Jun at 11:41

How do I connect to a specific Wi-Fi network in Android programmatically?

I want to design an app which shows a list of Wi-Fi networks available and connect to whichever network is selected by the user. I have implemented the part showing the scan results. Now I want to co...

25 Sep at 09:14

Test for multiple cases in a switch, like an OR (||)

How would you use a `switch` `case` when you need to test for in the same case? ``` switch (pageid) { case "listing-page": case "home-page": alert("hello"); break; case "details-page"...

Default value of 'boolean' and 'Boolean' in Java

What are the default values of `boolean` (primitive) and `Boolean` (primitive wrapper) in Java?

26 Mar at 03:4

Error: Jump to case label in switch statement

I wrote a program which involves use of switch statements, however on compilation it shows: > Error: Jump to case label. Why does it do that? ``` #include <iostream> int main() { int choice; ...

3 Oct at 21:27

MySQL SELECT only not null values

Is it possible to do a select statement that takes only NOT NULL values? Right now I am using this: ``` SELECT * FROM table ``` And then I have to filter out the null values with a php loop. Is t...

30 Jul at 23:2

Print an integer in binary format in Java

I have a number and I want to print it in binary. I don't want to do it by writing an algorithm. Is there any built-in function for that in Java?

8 Oct at 14:31

How can I check if a scrollbar is visible?

Is it possible to check the `overflow:auto` of a div? ``` <div id="my_div" style="width: 100px; height:100px; overflow:auto;" class="my_class"> * content </div> ``` ``` $('.my_class').live...

26 Oct at 17:34

How to pick just one item from a generator?

I have a generator function like the following: ``` def myfunct(): ... yield result ``` The usual way to call this function would be: ``` for r in myfunct(): dostuff(r) ``` My question, is...

30 Jun at 00:16

Compare if BigDecimal is greater than zero

How can I compare if `BigDecimal` value is greater than zero?

10 Dec at 16:56

Get a list of resources from classpath directory

I am looking for a way to get a list of all resource names from a given classpath directory, something like a method `List<String> getResourceNames (String directoryName)`. For example, given a class...

13 Oct at 12:31

How do you UrlEncode without using System.Web?

I am trying to write a windows client application that calls a web site for data. To keep the install to a minimum I am trying only use [dlls in the .NET Framework Client Profile](http://msdn.microsof...

10 Jan at 19:17

How to pass parameters to ThreadStart method in Thread?

How to pass parameters to `Thread.ThreadStart()` method in C#? Suppose I have method called 'download' ``` public void download(string filename) { // download code } ``` Now I have created one...

25 Aug at 09:12

Compiled vs. Interpreted Languages

I'm trying to get a better understanding of the difference. I've found a lot of explanations online, but they tend towards the abstract differences rather than the practical implications. Most of my ...

PHP: How to send HTTP response code?

I have a PHP script that needs to make responses with HTTP response codes (status-codes), like HTTP 200 OK, or some 4XX or 5XX code. How can I do this in PHP?

25 Dec at 12:53

What's the u prefix in a Python string?

Like in: ``` u'Hello' ``` My guess is that it indicates "Unicode", is that correct? If so, since when has it been available?

19 Oct at 16:51

How can I truncate a datetime in SQL Server?

What's the best way to truncate a datetime value (as to remove hours minutes and seconds) in SQL Server 2008? For example: ``` declare @SomeDate datetime = '2009-05-28 16:30:22' select trunc_date(@S...

Random float number generation

How do I generate random floats in C++? I thought I could take the integer rand and divide it by something, would that be adequate enough?

6 Dec at 05:44

How can I ssh directly to a particular directory?

I often have to login to one of several servers and go to one of several directories on those machines. Currently I do something of this sort: I have scripts that can determine which host and whic...

9 Mar at 14:52

How can I add a string to the end of each line in Vim?

I want to add `*` to the end of each line in Vim. I tried the code unsuccessfully ``` :%s/\n/*\n/g ```

20 May at 14:59

Singleton: How should it be used

Edit: From another question I provided an answer that has links to a lot of questions/answers about singletons: [More info about singletons here:](https://stackoverflow.com/questions/1008019/c-sing...

23 May at 11:54