C++ modules with nodejs in heroku

Some time ago I learned to handle the V8 and compile small modules through node-gyp. Going up files with heroku I see each time that node is compiled with his dependences. I wonder if there is any way to compile c++ to nodejs on heroku. Some mechanism, some command?

It would be interesting for increase performance, especially for functions that handle “native” types instead of V8 objects (as simple strings or numbers, before finally converting to V8::Number and V8::String), which is architecturally complex and reduce yield.


View original post at stackoverflow.com

C++: File lock between threads and processes

I would like to create file based locking that ensures exclusive access of an associated resource. The boost:interprocess::file_lock is good for separating processes, but not good for separating threads. That problem can be solved with an additional boost::recursive_mutex if we extract the file names to unique full paths (eg. no relatively specified lock files like something/x.lock) and associate the mutexes with them.

I would like to have an easier and relatively standard way of file based locking that work for threads and processes alike.

View original post at stackoverflow.com

How to open pdf file using iText in Android?

I’m new in Android . I’m implementing PDF document using iText in Android . I want to read PDF document in my application. I don’t have an idea how to access PDF doc in my app. I have created but when i run the application i get exception for FileNotFoundException and i also import a PDF file in SD card through DD-MS. But the PDF file doesnot open in Android. Please can anyone help me . Here is my code. Thanks in advanced .

import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.codec.Base64.InputStream;

public class MainActivity extends Activity 

    private static String FILE = "xyz.pdf";

    /** Called when the activity is first created. */

    public void onCreate(Bundle savedInstanceState)
        AssetManager assetManager = getAssets();
        InputStream istr = null;
        PdfReader reader = null;
        String str = null;
        int n = 0;
            istr =(InputStream) assetManager.open("xyz.pdf");

            reader=new PdfReader(istr);
            Log.e("n value:","-> " +n);
        catch(Exception e)
        TextView tv = (TextView) findViewById(R.id.textOne);



View original post at stackoverflow.com

Using one Google Maps API key for different android applications

I just generated the Google Maps API key to use in my android app. I had to provide the SHA-1 fingerprint and the package name for the application. It looked something like this:


As you can see I had to provide the package name for the app. So, does this mean that I need to get a different API key for different applications?

PS: Curiously, somehow, Google generated two API keys for the SHA-1 and package name combination I entered. Is this normal? And so, which one should I use?

View original post at stackoverflow.com

Laravel 4 – Container class: share function & closure logic

Hello stackoverflow community,

I have a follow-up question to the one dsicussed here:
Laravel core method confusion

I am in the same situation as driechel (author of quesion above) has been before, currently getting used to Laravel 4 FW and examining the core. Although a precise answer has been given I still don’t understand the logic and what is happening under the hood. So I would very much appreciate a further explanation.
I know this might be a duplicate but since I cannot post comments yet I’ll give it a shot with a new question. Hope it’ ok this way.

I have been looking at this from another angle starting at this article:

When examining the call File:get() I finally end up at the Container class’ share function which is called with this actual parameter share(function() { return new Filesystem; }.

What I just can’t figure out is the use of $ container. Especially at the second occurence within the closure:

$ object = $ closure($ container);

Could you please clarify this again? Why is $ container passed as a parameter here and what is actually contained in it? As far as I understand $ closure at that point holds and executes function() { return new Filesystem; } which has no input parameter.

I am lost. Studied this and the PHP anonymous functions/closures now for two days straight and still can’t figure it out. I neither understand the syntax of $ closure($ container) here nor the logic. So any help is appreciated.

Thank you very much.

View original post at stackoverflow.com

Animated gif does not play – mouse listener – event mouse entered

I have a button that I have replaced with an image, on hovering I want the image to play an animated gif. I have added a mouse listener and entered the code for changing the image to the gif. The image changes to the gif; however the gif does not animate. I have had a look for previous answers on this site, there are few but none have been able to help.

        public void mouseEntered(MouseEvent arg0) {
                Image img = ImageIO.read(getClass().getResource("images\\button_1_hover.gif"));
                btnShip1.setIcon(new ImageIcon(img));
            catch (IOException ex) {}

View original post at stackoverflow.com