Accessing files in specific folder in classpath using Java

Accessing files in specific folder in classpath using Java

I want to read a bunch of text files in com.example.resources package. I can read a single file using the following code:InputStream is = MyObject.class.getResourceAsStream("resources/file1.txt")InputStreamReader sReader = new InputStreamRe

For pthread, How to kill child thread from the main thread

For pthread, How to kill child thread from the main thread

I use pthread_create to create several child threads. At a time, the main thread wants to kill all child threads or there will be segment falut. Which function should I use to finish that? I searched the answer from google and got function

PHP get_called_class() alternative

PHP get_called_class() alternative

I've got an Abstract PHP superclass, which contains code that needs to know which subclass its running under.class Foo { static function _get_class_name() { return get_called_class(); //works in PHP 5.3.*, but not in PHP 5.

AutoComplete with name and number as in native sms app Android

AutoComplete with name and number as in native sms app Android

I want to add an AutoCompleteTextView in my app and search contacts by name and number as done in the native SMS app with android. I have looked on the internet and tried quite a few things, but I want my application to display it exactly a

How to define a Kendo grid Column filter between two dates?

How to define a Kendo grid Column filter between two dates?

In our application we want the filter on a date column to prompt the user for a start date and an end date, with the filter returning rows where the field in question falls between (or on) those two dates.Initial ApproachOur initial approac

Get visible rectangle of QGraphicsView?

Get visible rectangle of QGraphicsView?

I've been pulling my hair out with this one for hours. There's a thread here about it, but nothing seems to be working. QGraphicsView::rect() will return the width and height, but the left and top values aren't set properly (always 0 -- ign

Change working directory in shell with a python script

Change working directory in shell with a python script

I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with

Android resize bitmap keeping aspect ratio [duplicate]

Android resize bitmap keeping aspect ratio [duplicate]

This question already has an answer here: Scaled Bitmap maintaining aspect ratio 11 answers I have a custom view (1066 x 738), and I am passing a bitma

how to find the position of item in a AutoCompletetextview filled with Array

how to find the position of item in a AutoCompletetextview filled with Array

I have an array (array1 with States) and AutoCompleteTextview in which I'm filling it with array1. When I select the value from AutocompleteTextView I select a state from AutoCompleteTextView Dropdown What I want is to get the position of

Responsive fullscreen youtube video with no black bars?

Responsive fullscreen youtube video with no black bars?

I have a fullscreen youtube video embedded on my website.It looks good when the size of the browser is proportional to the video’s width and height. However, when I resize the browser to a different proportion, I get black bars around the v

how to get object from listview in setOnItemClickListener in android?

how to get object from listview in setOnItemClickListener in android?

I have added arraylist in arrayadapter which contains objects each consists of two elements/items, I have successfully set that adapter for setListAdapter, now i want to get those items in setOnItemClickListener of listview.here is my code

nodeJS exec does not work for “cd ” shell cmd

nodeJS exec does not work for “cd ” shell cmd

var sys = require('sys'), exec = require('child_process').exec;exec("cd /home/ubuntu/distro", function(err, stdout, stderr) { console.log("cd: " + err + " : " + stdout); exec("pwd", function(err, stdout, stderr) {

Scala XML Building: Adding children to existing Nodes

Scala XML Building: Adding children to existing Nodes

I Have an XML Node that I want to add children to over time:val root: Node = But I cannot see methods such as addChild(), as I would like to write something along the lines of:def addToModel() = { root.addChild(content)}So after a single

Xcode Couldn't Generate Swift Representation for my own framework

Xcode Couldn't Generate Swift Representation for my own framework

I have created a framework which I want to use in my OS X app. Since updating to Xcode 7 on El Capitan, when I try to command-click on the import statement, Xcode goes to the following view.How can I get Xcode to display the Swift represen

Storing the state of checkbox in listview while using custom BaseAdapter in android?

Storing the state of checkbox in listview while using custom BaseAdapter in android?

i have a listview which is having image, text and checkbox i have inflated this using BaseAdapter. i want to send only those images which are selected but how to store the state of checkbox ?may be i am wrong as i am using baseadapter. you

Cannot reduce visibility of method inherited method from parent [duplicate]

Cannot reduce visibility of method inherited method from parent [duplicate]

This question already has an answer here: java access modifiers and overriding methods 7 answers I got this compiler error: You cannot reduce the visi

How to pop-up the Windows context menu for a given file using Delphi?

How to pop-up the Windows context menu for a given file using Delphi?

I want to write the following procedure / function:procedure ShowSysPopup(aFile: string; x, y: integer);Which will build and show (at the coordinates x and y) the right-click shell menu which one sees in the Windows Explorer for the given f

Crossover operation in Genetic algorithm for TSP

Crossover operation in Genetic algorithm for TSP

I'm trying to solve the Travelling Salesman Problem (TSP) with Genetic algorithmMy Genome is permutation of vertex in graph (path for Salesman). How should I perform the crossover operation over my genomes?Where can I find implementations

Python and ElementTree: return “inner XML” excluding parent element

Python and ElementTree: return “inner XML” excluding parent element

In Python 2.6 using ElementTree, what's a good way to fetch the XML (as a string) inside a particular element, like what you can do in HTML and javascript with innerHTML? Here's a simplified sample of the XML node I am starting with:This is

Selecting an element which has another element as direct child

Selecting an element which has another element as direct child

I need to select all divs which contain object as their direct child. :has just checks for descendants of any kind, so now I'm using:$('div > object').parent().css('text-align', 'center');is there a more direct way? 1:You can simplify yo

Add / Remove Tabs Dynamically in Bootstrap - Make created tab active

Add / Remove Tabs Dynamically in Bootstrap - Make created tab active

Here is the snippet to dynamically add / remove bootstrap tabs. Everything works fine, but I would like newly created tab to be active and in focus rather than the tab used to dynamically add a tab.This is fiddle: http://jsfiddle.net/isherw

Hg sub-repository dependencies

Hg sub-repository dependencies

There have been a couple of questions about Hg sub-repo dependencies in the past (here and here) but the accepted answers don't seem to address the problem for me.A project of mine has 4 dependencies: A, B, C, D. D is dependent on A, B and

How to assign parent reference to a property in a child with AutoMapper

How to assign parent reference to a property in a child with AutoMapper

I'm trying to find a way of configuring AutoMapper to set a property in a destination object with a reference of its source parent object. The code below shows what I'm trying to achieve. I'm moving data into the Parent & Child instances fr

GtkDialog mapped without a transient parent

GtkDialog mapped without a transient parent

I have a GUI built in Glade (3.18) which is called by a Python 3 program (using PyGObject). I get a lot of warnings when running the program (Fedora 21) that say:Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Why is my onItemSelectedListener not called in a ListView?

Why is my onItemSelectedListener not called in a ListView?

I'm using a ListView that is setup like this:In my code I add an OnItemSelectedListener to the ListView like this:getListView().setAdapter(adapter);getListView().setOnItemSelectedListener(this);my Activity implements the listener like that: