text:
Q: AVAudioRecorder does not save file I am struggling with the AVAudioRecorder (and Player) now. I have an application in which there are three simple buttons which do record/play/stop calls, and I'm using AVAudioRecorder and AVAudioPlayer to record and play the sound. Right now, when I test the app (both on the iPhone and in the simulator) I am getting the Cocoa 260 - file not found exception when trying to play what I just recorded. When printing the path to the AVAudioRecorder's file URL, I get an URL to a file inside a folder which does not exist on my computer (running on simulator. My code looks like this:
- (void)viewDidLoad
{
    [super viewDidLoad];

    _plyBtn.enabled = NO;
    _stopBtn.enabled = NO;

    NSArray *dirPaths;
    NSString *docsDir;

    dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES);
    docsDir = dirPaths[0];

    NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"test.caf"];

    NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];

    NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithInt:AVAudioQualityMin],
                                    AVEncoderAudioQualityKey,
                                    [NSNumber numberWithInt:16],
                                    AVEncoderBitRateKey,
                                    [NSNumber numberWithInt:2],
                                    AVNumberOfChannelsKey,
                                    [NSNumber numberWithFloat:44100.0],
                                    AVSampleRateKey,
                                    nil];

    NSError *error = nil;
    _rec = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&error];

    if(error){
        NSLog(@"error: %@", [error localizedDescription]);
    } else {
        [_rec prepareToRecord];
    }

    NSLog(@"path: %@", soundFileURL);
}

I have no clue why that NSLog at the bottom there prints an invalid file path... Like I said, I don't get the error when recording, but when attempting to play the audio which I recorded afterwards. Here's my play function:
- (IBAction)playAudio:(id)sender {
    if(!_rec.recording){
        _recBtn.enabled = NO;
        _stopBtn.enabled = YES;

        NSError *error1;
        NSError *error2;

        NSData *soundFile = [[NSData alloc] initWithContentsOfURL:_rec.url options:NSDataReadingMappedIfSafe error:&error1];
        _ply = [[AVAudioPlayer alloc] initWithData:soundFile error:&error2];

        //_ply = [[AVAudioPlayer alloc] initWithContentsOfURL:_rec.url error:&error];

        _ply.delegate = self;

        if(error1){
            NSLog(@"error: %@", [error1 localizedDescription]);
        } else if (error2) {
            NSLog(@"error: %@", [error2 localizedDescription]);
        } else {
            [_ply play];
        }
    }
}

This doesn't seem to be working:
- (IBAction)recordAudio:(id)sender {
    NSLog(@"recordAudio called");
    _plyBtn.enabled = NO;
    _stopBtn.enabled = YES;
    [_rec record];
}

Thanks for any help in advance :)

A: Perhaps the recording path was invalid.
NSDocumentationDirectory... Shouldn't that be NSDocumentDirectory ?


text:
Q: LINQ to SQL: Grouping and limiting a record set I'm using LINQ to SQL and I have a stored procedure which brings back a result set that looks like so:
Type    Field1   Field2
 5        1        1
 6        2        0
21        0        0

I'm hoping to do a few things with this record set:
1) Have 3 groups of results, one that has values in both field1 and field2, one that has a value in field1 but not field2 and one that has zeros in field1 and field2.
2) I'm only interested in a subset of types. I have a list of type id's I'm looking for (say 5 and 21 for this example). Right now the type values are stored in an enumeration but I can move them to a better data type if appropriate.
I've gotten to where I can group each set but I'm unsure of how to limit the types so I only bring back those I'm interested in.
Here's what I have:
var result = from all in dataContext.sp(..variables...)
           group all by all into list
           let grp1 = (from a in list
                      where a.field1 != 0 && a.field2 != 0
                      select a)
           let grp2 = (from b in list
                     where b.field1 == 0 && b.field2 != 0
                     select b)
           let grp3 = (from c in list
                      where c.field1 == 0 && c.field2 == 0
                      select c)
           select new { grp1, grp2, grp3 };

Any help is appreciated.

A: Do you actually want all the data for those groups? If so, you might as well do the grouping back in .NET - just filter in SQL:
// Assuming interestingTypes is an array or list of the interesting types
var query = db.Whatever.Where(entry => interestingTypes.Contains(entry.Type)
                              // I understand you're not interested in this group
                              && !(entry.Field1==0 && entry.Field2==1));

var grouped = query.AsEnumerable()
                   .GroupBy(entry => new { entry.Field1, entry.Field2 });

An alternative to GroupBy is to use ToLookup:
var lookup = query.AsEnumerable()
                  .ToLookup(entry => new { entry.Field1, entry.Field2 });

Then:
var values00 = lookup[new { Field1=0, Field2=0 }];

(Then values00 will be an IEnumerable<T> of your entry type.)
If you're only interested in the types for each field group, you could change the lookup to:
var lookup = query.AsEnumerable()
                  .ToLookup(entry => new { entry.Field1, entry.Field2 },
                            entry => entry.Type);

You'd fetch values00 in the same way, but each entry would be the type rather than the whole record.

A: I dont think you will be able to do it in a single query (maybe, but not without it being ugly).
I would recommend storing the result of the stored proc, and just use 3 queries. Or modify the stored proc to return the 3 resultsets you are looking for.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Singleton public method getInstance is not a function after being defined I tested for other functions in the DataService class. I get the same error every time: TypeError: service.getInstance is not a function.
Im not sure what Im doing wrong. Im attempting to create a Singleton object to handle the data services for my app.
main_app/services/DataService.js
var DataService = (function() {

    var TIME = 15000;
    let Queue = require('../scripts/Queue')
    const uxQueue = new Queue();
    const uxQueue_Buffer =new Queue()
    const queueL1 = new Queue()
    const queueL1_Buffer = new Queue()
    const queueL2 = new Queue()
    const queueL2_Buffer =new Queue()
    const queueL3 = new Queue()
    const queueL3_Buffer =new Queue()
    const queueL4 = new Queue()
    const queueL4_Buffer =new Queue()

    const LEVEL_MINUTE = 4; //L1
    const LEVEL_HOUR = 60; //L2
    const LEVEL_DAY = 24; //L3
    const LEVEL_WEEK = 7; //L4
    const UX_LEVEL = 50; //L0

    //Response for last retrieved data source
    var current_response;

  function queueCheck(queue, level){
    if(level === 0){
        return queue.length === UX_LEVEL;
    }
    if (level === 1){
        return queue.length === LEVEL_MINUTE;
    };
    if(level === 2){
        return queue.length === LEVEL_HOUR;
    };
    if(level === 3){
        return queue.length === LEVEL_DAY;
    };
    if(level === 4){
        return queue.length === LEVEL_WEEK;
    };
};

function flush(queue){
    var size = queue.length;
    while(!queue.isEmpty()){
        var item = queue.dequeue();
    }
}
//Add item to queue
function queuer(queue, buffer, level, response){
    if (!queueCheck(queue, level)){ // If queue is not full
            queue.enqueue(response);
            console.log('Queuing');
        }else{
            console.log('Queue is full! Enqueuing buffer');
            buffer.enqueue(response);
        }
}

function executeQueue(response, levels){
    levels.forEach(element => {

        if(element === 0){
        queuer(queueL1, queueL1_Buffer, element, response);
        }else{
        queuer(uxQueue, uxQueue_Buffer, element, response);
        };

    });

}

function fetchData(){
        require("got").get("https://data.messari.io/api/v2/assets?sort")
        .json()
        .then(response => {
             const size = Buffer.byteLength(JSON.stringify(response));
             const kiloBytes = size / 1024;
             const megaBytes = kiloBytes / 1024;
             console.log('Mega bytes received', megaBytes);
    }).then(response => {
        current_response = response;

    }).then(response => {
        const levels = [0,1];
        executeQueue(response, levels);
    });
};
function getClientQueue(){
    return uxQueue;
};

function getCurrentTime(){
    const time = current_response['status'];
    return time['timestamp'];
};

function getSymbol(){
    const data = current_response['data'];
    return data['symbol'];
};
setInterval(fetchData, TIME);
var instance;
 return { // public interface
    getInstance : function(){
        if(instance == null){
            instance = new DataService();
            instance.constructor = null;
        };
        return instance;
    }
  };
})();

main_app/controllers/AnalyticsController.js
const service = require('../services/DataService')
 var dataService = service.getInstance();

var path = require('path');
//display home page
exports.home_page = function(req, res){
    res.sendFile(reqPath+'/views/home.html');
};

exports.get_mc_index = function(req, res){
    res.send('NOT IMPLEMENTED. Market caps ');
};

exports.get_mc_index = function(req, res){
    res.send('NOT IMPLEMENTED. Market cap index');
};

exports.get_ji_index = function(req, res){
    res.send('NOT IMPLEMENTED. J index');
};

exports.get_vi_index = function(req, res){
    res.send('NOT IMPLEMENTED. V index');
};

exports.get_symbol = function(req, res){
    try {

        sym = dataService.getCurrentTime();
        res.send('Success ' + sym);
    } catch (error) {

        res.send('Failed ' + error);
    }
}

exports.fetch_data = function(req, res){
    try {
        time = test.getCurrentTime();
        res.send('Successful');
        console.log('current time stamp ', time );
    } catch (error) {
        res.send('Failed');
    }
};

// Go back 1 directory
let reqPath = path.join(__dirname, '../');

A: i dont see a module.exports in DataService.
:)
so your "require" returns nothing;
Also every required file is a singleton so your singleton strategy may be unnecessary.
for exemple, if you require A.js in many files you still get the code of A executed only once.
try this for ex :
// A.js
console.log('a loaded');
module.exports = function() {};
// B.js
var a = require('a.js');
console.log('b loaded');
module.exports = function() {};
// C.js
var a = require('a.js');
var b = require('b.js');
console.log('c loaded');

will show
a loaded
b loaded
c loaded


text:
Q: Why not in caller's catch() but the try's catch? I have an interesting case that a Promise.reject() not caught in its caller's .catch() but in the try{ }catch{ }.
callDB() calls a pg db function to perform an Insert, when a run-time error (unique-key violation) raised, it goes to .then().catch():
const callDB = (param) =>
{
    return new Promise((resolve, reject) =>
    {
        var sql = "...myInsert($1, $2)";
        var dataValue = [param.p1, paramp2];
        db.any(sql, dataValue)
            .then
            (
                good => resolve(good),
                bad => reject(bad)
            )
            // Run-Time Err like unique-key violation caught here, returns a reject.
            .catch
            ( dbEr => { return reject(dbEr); })
    });
}

f2(), the caller, its callDB().catch() not catching the reject, but the try{} catch{tce}:
async function f2()
{
    try
    {
        ...
        // callDB's reject NOT caught here.
        const good2  = await callDB(param).catch((e2)=>{ return Promise.reject(e2); });
        ...
    }
    catch(tce)
    {
        // callDB's reject caught here!
        return Promise.reject(tce);
    }
}

An Azure Function calls f2():
module.exports = async function f1(context)
{
    try
    {
        await f2().then
        (
            good => ...
            bad =>
            {
                // Caught here as Expected!
                ...
                context.res = {status: 401, body: bad};
            }
        )
        .catch
        (
            (e1) =>
            {
                context.res = {status: 401, body: "never reach e1"};
            }
        )
    }
    catch (etry)
    {
        context.res = {status: 401, body: "never reach etry"};
    }
}

My questions are:

*

*why the callDB's reject goes into f2's try{} catch{}?

*what's the difference between .then().catch() and try{} catch{}?


text:
Q: Using RoboFragment with FragmentManager I've been trying to use RoboGuice and fragments with no luck. I have a fragment that extends RoboFragment, and an activity that extends RoboActivity, but it seems that within the RoboActivity, the method getFragmentManager is incompatible with RoboFragment.
It looks like RoboFragment extends android.support.v4.app.Fragmentment but getFragmentManager requires android.app.Fragment.
How is this meant to work?

A: As always I worked our my problem within 10 minutes of posting (sorry)!
I needed my activity to extend RoboFragmentActivity, which then exposed the getSupportFragmentManager method - which returns the android.support.v4.app.FragmentManager which is obviously compatible with android.support.v4.app.Fragment
Matt


text:
Q: Installer crashes installing qt and qt creator on ubuntu I'm attempting to install Qt 5.11.2 and Qt creator through the .run installer found on their website.
I can get through the installer just fine, but when the installer finishes downloading and starts installing to my filesystem it always hangs at the exact same point.
Specifically, when its writing /Qt5.11.2/Src/qtwebengine portions. However I don't believe this is the issue because even if I uncheck the box for web engine before installing it still crashes at a specific point somewhere else. Ubuntu gives me the option to force close every time, I have waited to make sure it doesn't come back but it never does.
Can anyone offer any help? I'm not sure if maybe i'm missing some dependencies the installer needs or there's just something wrong with Qt's installer?
Thanks.

A: I just needed to let it sit for 20 minutes.


text:
Q: Different ng-click based on another value I let the user to upload there own photo and while this happens I take the image, make it smaller, add attribute (ng-click), compile it and append to newelement. This is triggered once on photo upload:
 var myEl = angular.element(image); // getting an image
 myEl.attr('ng-click', 'openImage($event)'); // adding ng-click
 $compile(myEl)($scope); //compile
 newelement.append(myEl); // adding to an element in the DOM

The problem is that afterwards I want to either have ng-click attribute or dont based on the value which comes to $rootScope.activeTab (in one tab I want to have ng-click, in other - dont). Not sure yet how to handle such case.
$rootScope.activeTab is watched and changes dynamically based on in what tab the user is.
Tried something like this:  myEl.attr('ng-click', $rootScope.activeTab === 'stickers' ? '' : 'openImage($event)'); but it does not work as it is evaluated once on the upload. When I switch to a different tab this value does not update.

A: Forget about removing the ng-click. You can just handle your logic in the openImage function.
$scope.openImage = function($event) {
  if ($rootScope.activeTab === 'stickers') {
    return;
  }

  // Do whatever you were planning on doing.
};


text:
Q: ExpandableHeightListView ImageView Item layout_height wrap_content not showing all image anyone can help me. i have ExpandableHeightListView
<com.example.administrator.mosbeau.ExpandableHeightListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/paymentlist"
android:divider="@android:color/transparent"
android:dividerHeight="10dp"
android:layout_below="@+id/shortdesc"/>

with ImageView Item layout_height wrap_content
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/payment_icon"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:layout_below="@+id/borderfooter"/>

images have different height that's why i set wrap_content.
but the problem is not showing all image
class
paymentadapter = new ListViewAdapterPayment(getActivity(), paymentarraylist, listener);
paymentlistview.setAdapter(paymentadapter);
paymentlistview.setExpanded(true);

adapter
payment_icon = (ImageView) itemView.findViewById(R.id.payment_icon);
Glide.with(context).load(resultp.get(CheckoutFragment2.payment_icon)).apply(requestOptions).into(payment_icon);

when i set height to ImageView like layout_height="100dp", it show all the content.
anyone can help me with this problem. thanks in advance.

A: u should set imageView's height in you code
Glide.with(context).load(imgUrl).placeholder(R.mipmap.place_holder)
            .error(R.mipmap.place_holder).into(object : SimpleTarget<Drawable>(){
            override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
                var params =  payment_icon.layoutParams
                params.height = resource.intrinsicHeight
                imageView.layoutParams = params
                payment_icon.setImageDrawable(resource)
                }
        })


text:
Q: the best way to store shape, to later return the topmost shape per specified x, y location (java) I need to implement a class that stores shapes. A shape is defined by the following interface:
public interface IShape {
    int getLeft();
    int getTop();
    int getRight();
    int getBottom();
    Properties getProperties();
}

I need to store these shapes in an efficient manner, and to later return the topmost shape per specified x, y location.
(The solution should support a large number of shapes, and that the bounding shape can be extremely large, so a solution containing a simple collection of shapes isn't efficient enough performance-wise, and a solution containing a map of each point to its corresponding shape isn't efficient enough memory-wise.)
I understand that I have to use a nosql db. But, what is the most effective way to represent the shapes in the db and pull out the shape according to x and y.


text:
Q: Notify Windows system applications font has been uninstalled/deleted When installing fonts temporarily using AddFontResource/RemoveFontResource applications such as Adobe Photoshop, Illustrator recognize the change accordingly in real time.
The problem is when you permanently install a font, and make the font available after a system reboot by copying the file to the windows fonts directory + adding the font to the system registry, deleting the font after this point requires a complete reboot for system wide applications to realize what fonts are available.
My question is after permanently deleting a font file, removing the file from WINDIR/Fonts and removing it's entry from the system registry what needs to be done to inform system wide applications the font is not available and to update their lists accordingly? I was thinking SHChangeNotifymight be the right direction but utterly unsure.

A: You should send the WM_FONTCHANGE message to all top-level windows (using HWND_BROADCAST as the target of a SendMessage call):
SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);


text:
Q: ActiveModel::UnknownAttributeError: unknown attribute 'foreign_type' for PaperTrail::VersionAssociation I am migrating my application from Rails4.2.8 to Rails5.2.3, updated paper-trail gem version '7.1.2' to '10.3.1'.I am using Rspec - 3.8.2. Everything worked fine but my specs are failing for models which used 'has_paper_trail' macro.
Tried looking into my codes as well as gem repo, didn't found such attribute anywhere.
Found some similar issue but it didn't helped.
https://github.com/paper-trail-gem/paper_trail/issues/455
ActiveModel::UnknownAttributeError:unknown attribute 'foreign_type' for PaperTrail::VersionAssociation.

A: You need to add column foreign_type into version_associations tables after upgrading gem paper_trail.
Run rails g paper_trail_association_tracking:add_foreign_type_to_version_associations and then migrate your database.
These changes were done in gem paper_trail-association_tracking which is one of the dependencies for paper_trail gem.
Ref: CHANGELOG


text:
Q: Failed to start myunit service in Centos 7 Здравствуйте!
Я столкнулся с задачей связанной с написанием unit'a systemd в Centos 7.
сервис должен при старте системы запускать веб приложение.
Был написан такой юнит
[Unit]
DefaultDependencies=no
Description=eureka-service

[Service]
Type=forking
WorkingDirectory=/usr/crm/develop/crm-backend/crm-backend
ExecStart=/usr/crm/develop/crm-backend/crm-backend && gradle eureka-service:bootRun & echo $! >> eureka.pid
PIDFile=/usr/crm/develop/crm-backend/eureka.pid

[Install]
WantedBy=multi-user.target

Пишу следующие команды
systemctl enable eureka
systemctl daemon-reload
systemctl -l status eureka

В консоль выводится
eureka.service - eureka-service
Loaded: loaded (/etc/systemd/system/eureka.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-07-15 11:42:23 SAMT; 7min ago
Process: 2218 ExecStart=/usr/crm/develop/crm-backend/crm-backend && gradle eureka-service:bootRun & echo $! >> eureka.pid (code=exited, status=203/EXEC)
Starting eureka-service...
eureka.service: control process exited, code=exited status=203
Failed to start eureka-service.
Unit eureka.service entered failed state.
eureka.service failed.

используется centos 7


text:
Q: What is refractive index of a hollow glass container with a liquid inside? Suppose that a thin hollow glass slab with a refractive index of $1.5$ contains a liquid inside, which has a refractive index of $\mu$, and $\mu \neq 1.5$. If I now send a laser light at the medium and measure the angle of refraction, will it now be $ sin^{-1} (\frac{sin i}{\mu}) $ or $ sin^{-1} (\frac{sin i}{1.5})$? So will the refractive index of this medium become $\mu$ or does it remain $1.5$?

A: For an interface between two mediums $A$ and $B$ with absolute refractive index $\mu$ and angle from normal $i$, the relationship $\mu_{\rm A}\sin i_{\rm A} = \mu_{\rm B}\sin i_{\rm B} $ can be used.

A: Can you please clarify what is meant by $i$ - is it the angle of incidence on the hollow glass? If so, according to Snell's law you may write ($\alpha$ is angle of refraction in the glass and $\beta$ is the angle of refraction in the water): $\sin i = 1.5 \sin \alpha = \mu \sin \beta$.
As you are interested in the angle of refraction in the medium, the right answer is the first one $\beta = \arcsin (\frac{\sin i}{\mu})$.


text:
Q: How To Open Zoomify tile source in OpenLayers I try to switch from zoomify viewer to OpenLayers.
However, I did not manage to successfully load a zoomify image.
Here is the URL:
https://get.microvisioneer.com/scans/oltest2_stackoverflow.html
It loads one tile (7-57-24.jpg) from TileGroup18 successfully but nothing is displayed on the page.
What am I doing wrong?

A: You need to set up and open the view

<!doctype html>

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/css/ol.css" type="text/css">

    <title>OpenLayers example</title>

My Map


text:
Q: SPACY - Confusion about word vectors and tok2vec it would be really helpful for me if you would help me understand some underlying concepts about Spacy.
I understand some spacy models have some predefined static vectors, for example, for the Spanish models these are the vectors generated by FastText.
I also understand that there is a tok2vec layer that generates vectors from tokens, and this is used for example as the input of the NER components of the model.
If the above is correct, then I have some questions:

*

*Does the NER component also use the static vectors?

*

*If yes, then where does the tok2vec layer comes into play?

*If no, then is there any advantage on using the lg or md models if you only intend to use the model for e.g. the NER component?

*Is the tok2vec layer already trained for pretrained downloaded models, e.g. Spanish?

*If I replace the NER component of a pretrained model, does it keep the tok2vec layer untouched i.e. with the learned weights?

*Is the tok2vec layer also trained when I train a NER model?

*Would the pretrain command help the tok2vec layer learn some domain-specific words that may be OOV?

Thanks a lot!

A:
Does the NER component also use the static vectors?

This is addressed in point 2 and 3 of my answer here.

Is the tok2vec layer already trained for pretrained downloaded models, e.g. Spanish?

Yes, the full model is trained, and the tok2vec layer is a part of it.

If I replace the NER component of a pretrained model, does it keep the tok2vec layer untouched i.e. with the learned weights?

No, not in the current spaCy v2. The tok2vec layer is part of the model, if you remove the model, you also remove the tok2vec layer. In the upcoming v3, you'll be able to separate these so you can in fact keep the tok2vec model separately, and share it between components.

Is the tok2vec layer also trained when I train a NER model?

Yes - see above

Would the pretrain command help the tok2vec layer learn some domain-specific words that may be OOV?

See also my answer at https://stackoverflow.com/a/63520262/7961860
If you have further questions - happy to discuss in the comments!


text:
Q: wget vs load page with QtWebkit I am trying to understand the difference between the resulting output of a simple load page with QtWebkit and an wget command, apart from that QtWebkit has a large API that we can make use of in a webpage to do a lot of things with Python.
What is the process of a wget and how does it download a webpage with all its components (images, etc.). Is there a difference in the output size of both processes?
And last question: What is being executed (javascript) in a load page with QtWebkit (besides an onload event handler)?

A: By default, wget does not retrieve any page requisites unless you tell it to via the -p/--page-requisites or the -r/--recursive flags. It processes no JavaScript commands, nor does it attempt to do anything with the markup or CSS unless you specifically tell it to. Even then, I'm pretty sure it just uses simple string matching to determine resource names and link URLs. All in all, it's pretty stupid until you configure it correctly (the basis for just about every powerful *NIX tool).
Since the WebKit library is so extensive, it would be useful to know what you're trying to do with it, like what code are you executing. But, since you already know what you're doing is performing JavaScript calls, it's reasonable to assume that it's doing a lot more than just retrieving the page.
Perhaps if you gave some examples of what you're trying to do I would be able to more thoroughly answer your question.


text:
Q: Selenium browser capability fontSize Is it possible to change the fontsize of the browser through capabilities? if so how?
manually we can set it from chrome>>Settings>> Appearance>> font Size..
so, wanted to set it at initial launch of browser and work.
Had tried to find it in chromeOptions but couldn't
https://sites.google.com/a/chromium.org/chromedriver/capabilities
any possibility?
Couldnt tag, webdriverJS.
i am using typescript for webdriverJS API


text:
Q: Laravel Class 'GeneaLabs\LaravelCasts\FormFacade' not found (0) I'm a bit stuck here I cannot get the FormFacade to work everytime I load my view it throws the error.
ErrorException (E_ERROR)
Class 'GeneaLabs\LaravelCasts\FormFacade' not found (View:
C:\inetpub\wwwroot\Laravel\howlong\resources\views\index.blade.php)
Previous exceptions
Class 'GeneaLabs\LaravelCasts\FormFacade' not found (0)

I've added
'providers' => [
    Collective\Html\HtmlServiceProvider::class,
],

and also
'aliases' => [
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
],

In my composer.json I have
    "laravelcollective/html": "^5.7"

and I have run
composer update
php artisan config:clear
php artisan cache:clear

Still no luck, what am I doing wrong?
This is Laravel 5.7.14
My full composer.json
{
        "name": "laravel/laravel",
        "type": "project",
        "description": "The Laravel Framework.",
        "keywords": [
            "framework",
            "laravel"
        ],
        "license": "MIT",
        "require": {
            "php": "^7.1.3",
            "askedio/laravel5-profanity-filter": "^1.10",
            "fideloper/proxy": "^4.0",
            "genealabs/laravel-casts": "^0.8.2",
            "laravel/framework": "5.7.*",
            "laravel/tinker": "^1.0",
            "laravelcollective/html": "^5.7"
        },
        "require-dev": {
            "beyondcode/laravel-dump-server": "^1.0",
            "filp/whoops": "^2.0",
            "fzaninotto/faker": "^1.4",
            "mockery/mockery": "^1.0",
            "nunomaduro/collision": "^2.0",
            "phpunit/phpunit": "^7.0"
        },
        "config": {
            "optimize-autoloader": true,
            "preferred-install": "dist",
            "sort-packages": true
        },
        "extra": {
            "laravel": {
                "dont-discover": []
            }
        },
        "autoload": {
            "psr-4": {
                "App\\": "app/"
            },
            "classmap": [
                "database/seeds",
                "database/factories"
            ]
        },
        "autoload-dev": {
            "psr-4": {
                "Tests\\": "tests/"
            }
        },
        "minimum-stability": "dev",
        "prefer-stable": true,
        "scripts": {
            "post-autoload-dump": [
                "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
                "@php artisan package:discover --ansi"
            ],
            "post-root-package-install": [
                "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
            ],
            "post-create-project-cmd": [
                "@php artisan key:generate --ansi"
            ]
        }
    }

A: The path GeneaLabs\LaravelCasts\FormFacade is wrong, it should have been GeneaLabs\LaravelCasts\Facades\FormFacade, and belongs to genealabs/laravel-casts package. Are you using this package anywhere?
Please correct it to the bellow,

GeneaLabs\LaravelCasts\Facades\FormFacade


text:
Q: Java struts select and update lock We have a select query which check whether the status is edited or not if no then an update is performed on the same record with status as edited. If already present then error is displayed to user saying record cant be edited. This logic is written in dao layer which is called from a service layer which is called by a struts action.
When multiple user perform the same task at the same time we are getting two edited record. Is this because there is no synchronization??
Will Synchronizing the logic block will resolve the issue?? or we need handle using some table lock.
The application is in production. We have similar kind of logic in lots of other modules. What is the best and safest way to handle this.
We are using Struts 2 and ibatis.


text:
Q: I created a simple ball game. Now I try to make the ball moving faster.... does anyone have an idea? the ball i want to move faster  is the *enemy;
i want that *enemy move faster after 20 seconds without touching the ball.
The *player ball is the ball that you can control. In this game You aren't allowed to touch
the enemy ball.
I want the enemy ball to become faster every 20 seconds.. I was thinking about something with an array loop ....
thank you for helping

.h
#import <UIKit/UIKit.h>

@interface ViewController : UIViewController {
    IBOutlet UIButton *startButton;
    NSTimer *randomMain;

    CGPoint pos;
    IBOutlet UIImageView *enemy;
    IBOutlet UIImageView *player;

    int MainInt;
    IBOutlet UILabel *seconds;

    IBOutlet UILabel *lastTime;
    IBOutlet UILabel *theTime;
}

@property (nonatomic, retain) NSTimer *numro;

- (IBAction)start;
@end

.m
#import "ViewController.h"

@implementation ViewController

@synthesize numro;

- (IBAction)start {
    [startButton setHidden:YES];
    randomMain = [NSTimer scheduledTimerWithTimeInterval:(0.03)
      target:self selector: @selector(onTimer) userInfo:(nil) repeats:YES];
    numro = [NSTimer scheduledTimerWithTimeInterval:(1.0)
      target:self selector:@selector(countup) userInfo:nil repeats:YES];
    MainInt = 0;
    [lastTime setHidden:YES];
    [theTime setHidden:YES];
}

-(void)countup {
    MainInt += 1;
    seconds.text = [NSString stringWithFormat:@"%i", MainInt];

// I TRIED IT WITH "IF"  BUT IT I DONT WANT TO WRITE THIS FOR EVERY 20 SECONDS

    if (MainInt == 20) {
        randomMain = [NSTimer scheduledTimerWithTimeInterval:(0.002)
      target:self selector: @selector(checkCollision) userInfo:(nil) repeats:YES];
    }
     /*   if (MainInt == 40) {
        randomMain = [NSTimer scheduledTimerWithTimeInterval:(0.01)
      target:self selector: @selector(onTimer) userInfo:(nil) repeats:YES];
    }*/
}

-(void)onTimer{
    [self checkCollision];
    enemy.center = CGPointMake(enemy.center.x+pos.x,enemy.center.y+pos.y);
    if (enemy.center.x > 320 || enemy.center.x < 0)
        pos.x = -pos.x;
    if (enemy.center.y > 480 || enemy.center.y < 0)
        pos.y = -pos.y;
}

- (void)checkCollision {
    if( CGRectIntersectsRect(player.frame,enemy.frame))
    {
        [randomMain invalidate];
      [startButton setHidden:NO];

        CGRect frame = [player frame];
        frame.origin.x = 137.0f;
        frame.origin.y = 326.0;
        [player setFrame: frame];

        CGRect frame2 = [enemy frame];
        frame2.origin.x = 137.0f;
        frame2.origin.y = 20.0;
        [enemy setFrame: frame2];

  UIAlertView *alert =[[UIAlertView alloc]initWithTitle:@"AAA"
        message: [NSString stringWithFormat:@"BBB"] delegate:nil
                 cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
        [alert show];
        MainInt = 0 ;
        [numro invalidate];
        [lastTime setHidden:NO];
        [theTime setHidden:NO];
        theTime.text = seconds.text;
    }
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *myTouch = [[event allTouches] anyObject];
    player.center = [myTouch locationInView:self.view]; //player ball
}

-(void)viewDidLoad {
    [lastTime setHidden:YES];
    [super viewDidLoad];
    // X Speed Y Speed
    //I tried to do anything with the X and Y speed ... but it didn't work
    pos = CGPointMake(5.0,4.0);
}

@end

A: Change if block in your countup method as follows...
if(MainInt % 20 == 0) {    //True every 20th second

   int speedUpCount=MainInt/20;
   float interval=1.0-(speedUpCount/10.0);

   [randomMain invalidate];   //Must stop the previous timer

   randomMain = [NSTimer scheduledTimerWithTimeInterval:interval target:self selector: @selector(checkCollision) userInfo:(nil) repeats:YES];
}

Hope this would help solving your problem.

A: // Now, from the 20th second, the ball becomes faster every second :S
-(void)countup {

MainInt += 1;
seconds.text = [NSString stringWithFormat:@"%i", MainInt];

if(MainInt % 20 == 0) {    //True every 20th second

    int speedUpCount=MainInt/20;
    float interval=1.0 - (speedUpCount/1000.0);

    [randomMain invalidate];   //Must stop the previous timer
    randomMain = [NSTimer scheduledTimerWithTimeInterval:interval target:self selector: @selector(start) userInfo:(nil) repeats:YES];


text:
Q: DynamoDB/Dynamoose error using query with .in() operator I'm creating a chat application and using Dynamoose.js.  I have a conversations table and a messages table. I want to query on the messages table to find all messages belonging to a conversation.  When I make the query, I'm getting the following error:
message: 'Invalid operator used in KeyConditionExpression: IN',
code: 'ValidationException',

Here's what my schemas and query looks like:
conversation.model.js
let schema = {
        conversation_id: {
            hashKey: true,
            type: String,
            required: true
        },

        participants: {
            type: Array,
            schema: [String],
            required: true
        },

        lastModified: {
            type: Date,
            required: true,
            default: Date.now
        }
    };

message.model.js
let schema = {
        message_id: {
            hashKey: true,
            type: String,
            required: true,
            index: {
                name: 'conversationIndex',
                global: true,
                rangeKey: 'conversation_id',
                throughput: {'read': 10, 'write': 10}
            }
        },

        conversation_id: {
            rangeKey: true,
            type: String,
            required: true
        },

        from: {
            type: String,
            required: true
        },

        message: {
            type: String,
            required: true
        },

        ts: {
            type: Date,
            required: true,
            default: Date.now
        }

query
Message.query('conversation_id').in(userConversations).using('conversationIndex').exec((err, messages) => {
     // userConversations is an array of conversation_id's

     if (err) {
          console.error(err);
     } else {

     }
});

Any idea of where I'm going wrong here?  I think it may be related to how I'm creating and using the secondary indexes, but I'm not quite sure.  Any help is appreciated, thanks!

A: DynamoDB queries require you to query for where hashKey = ______. You can't do a query where you query for a hashKey using in.
On top of that, conversation_id isn't a hashKey in your index.

Kinda hard to tell, but it looks like this is a symptom of DB design that doesn't fit with DynamoDB patterns. I'd suggest looking more into DynamoDB table design, and redesigning your table to better fit within DynamoDB patterns.


text:
Q: batch file kill multiple programs on text file I am looking for a batch file to kill all programs listed on a text file this would be very useful
also i am looking for a batch file to link an exe or bat to a keyboard shortcut
Example would be when you click ctrl 5 to launch ie but the bat must link it to the keys
Justin

A: TEXTFILE.TXT
notepad.exe
iexplore.exe
chrome.exe

KILLIST.BAT
@echo off
for /f "tokens=*" %%x in (textfile.txt) do taskkill /IM %%x

Keep in mind that if there are multiple instances of the same program open that without more information than the name of the executable that taskkill.exe will simply kill the first instance it encounters, probably the first one opened.
A more exact method is to use the window name (even just a portion of it), use tasklist.exe to search for that, grab the PID (Process ID), then use taskill.exe /PID #### to kill that exact process.
Another choice would be to kill ALL the programs with the same file-name. Doing that could also be done by collecting PID's but is simpler to just 'count' them and kill them that way. (It's not really counting, but it's close.)
TEXTFILE.TXT
notepad.exe
iexplore.exe
chrome.exe

KILLIST.BAT
@echo off
for /f "tokens=*" %%x in (textfile.txt) do (
  for /f "skip=3" %%y in ('tasklist /FI "IMAGENAME eq %%x"') do (
    taskkill /IM %%y
  )
)

==================================================================================
EDIT: 2012/09/07
To create a keyboard short-cut for the batch file, you need to:
1) Open Windows Explorer and browse to where you have the batch file located.
2) Right Click -> KILLIST.BAT -> Create shortcut
3) Right Click -> KILLIST.BAT - Shortcut -> Rename
4) Delete - Shortcut -> Press [ENTER]
5) Right Click -> the new KILLIST.BAT -> Properties
6) Select -> the Shortcut tab
7) Click -> the box next to Shortcut Key:
8) Press -> the keys you want to make the shortcut from. (It will display them)
9) Click -> OK
You can do this with any shorcut, not just ones for a batch file.
For this method to work, you must keep the shortcut on the Desktop or in your Start Menu somewhere.
A better choice would be a Macro Generator like AutoHotkey.


text:
Q: Server 2003 DHCP Server with Low-Access user account I'm trying to run the DHCP Server service under a low-permissions account (partly to reduce attack-vectors, and partly just for kicks), as it runs under LOCAL SYSTEM by default.
I've successfully gotten the DNS Server service running with a low access account (.\dns), but the DHCP one just isn't working.
I've been using ProcessMonitor to track any ACCESS DENIED events on the system and/or tcpsvcs.exe, but there are none when I'm starting the service; yet the SCM reports back that 'Access is denied'.
There is nothing in the Event Log (Application,Security,System) regarding the cause of failure, and I've already granted the .\dhcp user account the following permissions:

*

*C:\WINDOWS\system32\dhcp [Full Control + Subfolders]

*HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DHCPServer [Full Control + Child Keys]

*HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{AC8033FD-2B2A-4076-8E04-B7BB090D61CE} [nic, ditto]

*HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{AC8033FD-2B2A-4076-8E04-B7BB090D61CE} [nic, ditto]

The final operation when the SCM reports back the error is an attempted WriteFile to \\MACHINENAME*\MAILSLOT\NET\NETLOGON - but running this under the default system account results in the identical error (bad network path), so am not sure if this is entirely related.
Does anyone have any tips or suggestions?
OS: Windows Server 2003 R2 Enterprise x86 SP2
EDIT:
With the .\dhcp user in the Administrators group, the service starts. When in the Network Configuration Operators, DHCP Administrators, and Power Users groups the service fails to start.
To check if the adapter is running in promiscuous mode, I tested with nmap when the service is running:
nmap -sU -vv --script=sniffer-detect 192.168.134.202
...
PORT      STATE         SERVICE
53/udp    open          domain
67/udp    open|filtered dhcps
68/udp    open|filtered dhcpc
123/udp   open          ntp
...
MAC Address: 90:B1:1C:87:8A:3B (Unknown)

Host script results:
|_sniffer-detect: Unknown (tests: "11____1_")

Doing a netstat -anb on the server returned:
...
UDP    192.168.134.202:68     *:*                                    3432
[tcpsvcs.exe]

UDP    192.168.134.202:67     *:*                                    3432
[tcpsvcs.exe]

No sign of it listening on 0.0.0.0

A: I don't think you can get this to work because running a DHCP server on Windows requires putting the network card in to promiscuous mode, which is a privilege that requires administrator rights and can't be delegated.


text:
Q: How do I create a JPanel and put it on a JFrame from another class? I am trying to learn some Java GUI stuff.  I am trying to create a special jPanel, which I have created in another class [it is a Panel with two labels on it] inside one class, and using a passed JFrame add it to that JFrame from the other class.  I have been trying myJFrame.add(thePanel) and such, but it never seems to actually do anything.  I have tried doubly making sure it is sset to visible, is at a reasonable location, ect.
I am trying to create the panel in one class, and .add it to the given jframe.  There is probably something I am not understanding.
I am not the best at the java GUI stuff... so please be kind :)  Any advice you can give would be wonderful.
I am using Netbeans.  If I drag the special Panel I created over to my panel in the Design editor, it adds an instance of that panel, but I can't seem to make my own instance of this and have it appear.


text:
Q: Sonar - Categorization Plugin I'm looking for a Sonar plugin that will let me categorize all the projects I have into groups. So, for example, instead of the classic view, I'd have:
Group A:

*

*Project A

*Project B

Group B:

*

*Project C

*Project D

I made a quick test of the Sonar Views plugin, however, it doesn't really suit my needs, since it aggregates metrics by group and doesn't offer an actual drill-down.
Does anyone have any options?
Thanks a lot in advance!


text:
Q: Exponential Form of Fourier Series Problem Suppose $f$ is a continuous function on interval $[-\pi,\pi]$ such that $\sum_{n\in\mathbb{Z}} |c_n| < \infty$ where $c_n = \dfrac {1}{2\pi} \int_{-\pi}^\pi f(x)\cdot \exp(-inx)~dx$, the Fourier coefficient. Let $g(x):=\sum_{k\in\mathbb{Z}} c_n\cdot\exp(ikx)$.
Show $g(x) = f(x)$ for all $x$.
What I've tried: I know that if I can show that $c_n=d_n$ where $d_n$ is the Fourier coefficient of $g$ that I can then proceed using uniqueness of the Fourier series, I think. However, proving this has stumped me.
By definition, $d_n = \dfrac {1}{2\pi} \int_{-\pi}^\pi g(x)\cdot \exp(-inx)~dx=\dfrac {1}{2\pi} \int_{-\pi}^\pi c_n [\sum_{k\in\mathbb{Z}} \exp(ikx)] \exp(-inx)~dx$. Bringing the other exponential into the sum, $\dfrac {1}{2\pi} \int_{-\pi}^\pi c_n \sum_{k\in\mathbb{Z}} \dfrac{\exp(ikx-inx)}{k}~dx$. Since $\sum_{n\in\mathbb{Z}} |c_n| < \infty$ and $\sum_{k\in\mathbb{Z}} |\dfrac{\exp(ikx-inx)}{k}|<\infty$, by Fubini/Tonelli Theorem, I interchange integration and summation, $\dfrac {c_n}{2\pi} \sum_{k\in\mathbb{Z}} \int_{-\pi}^\pi\dfrac{\exp(ikx-inx)}{k}~dx$. This is where I feel like I'm way off track. I think there is something wrong in my work, but I also feel that I may just be going in the complete wrong direction.
Somehow, I want this to equal $c_n = \dfrac {1}{2\pi} \int_{-\pi}^\pi f(x)\cdot \exp(-inx)~dx$

A: Note that
$$\int_{-\pi}^{\pi}e^{i(k-n)x}\;dx = 2\pi\delta_{k-n}$$
i.e. the integral is only non-zero for $k=n$. Another thing you might want to check is the factor $1/k$ in your integral. Where does it come from?


text:
Q: mysql_init overwriting memory space When I call mysql_init(mysql);, it is overwriting a char array. I do not understand what I am doing wrong. My code:
void prepare_mysql(MYSQL *mysql) {
    mysql_library_init(0, NULL, NULL);
    mysql_init(mysql);
}

void get_uid(char *src, char *dst) {
    int i, len, count = 0;
    len = strlen(src);
    for(i = 0; i != len; i++) {
        if(src[i] == '-') { // iterate until a - sign is found
            break;
        }
        dst[count] = src[i]; // save char into dst
        count++;
    }
    dst[count] = '\0'; // add null char at the end of char array, otherwise everything will explode...
    // dst is now: 389302
}

int main(int argc, char *argv[]) {
    // argv[1] is for example: 389302-8232
    char uid;
    get_uid(argv[1], &uid);
    printf("uid = %s\n", &uid); // prints: 389302 (correct)

    MYSQL conn;
    prepare_mysql(&conn);

    printf("uid = %s\n", &uid); // prints: 3 (the first char only.. why?)

    mysql_close(&conn);
    mysql_library_end();
    return 0;

}

If I call the get_uid function after I call mysql_init, I cannot call mysql_close(&conn) because I get a Segmentation fault. Please help, I cannot understand..
Edit:
I have added this in main:
char *uid = malloc(strlen(argv[1]));

And later in main, I call free(uid);. Now it seems to be printing correctly everywhere before I call free.

A: You don't have a char array - uid is only a char.


text:
Q: Customize destination of Redis' RDB file I want to customize the destination of Redis' RDB file to be something other than a file on a mounted file system.
For example:

*

*Send the file to a remote host via scp

*Upload the file to Hadoop HDFS (I'm running Redis on a Hadoop cluster, in which we use HDFS for backup all the time)

*gzip the file and then move it to some archive location

The reason for this is I want to archive the RDB files (my data gets flushed out every day). I'm not sure what I'm going to do with these archived RDB files yet, but I think I'll be able to derive some value from them later.
Is there a way to trigger an external process from Redis when a new dump is made so that I can ship the RDB file to its destination? The most sophisticated thing I can come up with right now is a cron job that checks to see if the file needs to be shipped ever minute or so, but I'd rather have it triggered instead of constantly polling.
I'm pretty new to Redis, so feel free to correct me if you think I'm approaching this problem improperly and suggest a new solution.

A: Maybe I'm missing something, if you're doing this to preserve data that is going to be wiped out, why not just schedule it to scp it and gzip it right before the days data is flushed?  What is the reason for wanting it not to live on a normal file system?  To my knowledge there is no way to trigger an external process from within redis when it writes the RDB file.  It's going to potentially happen quite frequently depending on your save settings in the config file.  Take a look at this doc to get more information http://redis.io/topics/persistence.

A: May be I am missing too, but:
You can change where the file is made in redis.conf
You can set up crontab that move/copy the file.
For highest security, do two crontabs - one that move the file (mv data.rdb data1.rdb) and second that upload data1.rdb 5-10 min later. Reason is that it may be possible the crontab to start at the same time as Redis save process.
Because topic is interesting, I may do simple script that do this,
check http://redis4you.com/articles.php tomorrow.


text:
Q: Mechanize not working as expected I am trying to use Mechanize to login to a page and download a file but it doesn't seem to work as expected. This is after I have failed with urllib2 and requests.
import mechanize

username = '***'
password = '***'
url = 'https://emea1.login.cp.thomsonreuters.net/auth/UI/Login'

br = mechanize.Browser()
br.set_handle_robots(False)
request = br.open(url)

br.select_form(name="frmSignIn")

br['IDToken1'] = username     # Set the form values
br['IDToken2'] = password   # Set the form values
resp = br.submit()

print resp.read()

The output is same as the source code of url, same was the case with requests and urllib
PS: I tried using selenium only to find my corporate server won't have firefox etc. installed.


text:
Q: Android Error: android.widget.TextView. i want to run the application in ma Galaxy S2 but i found this error. i post the logcat. please tell me what s the problem? and how to resolve it ? thanks
05-07 11:23:38.820: D/AndroidRuntime(8900): Shutting down VM
05-07 11:23:38.820: W/dalvikvm(8900): threadid=1: thread exiting with uncaught exception (group=0x40c3f1f8)
05-07 11:23:38.820: E/AndroidRuntime(8900): FATAL EXCEPTION: main
05-07 11:23:38.820: E/AndroidRuntime(8900): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.aaaaa/com.example.aaaaa.MainActivity}: java.lang.NullPointerException
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1892)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread.access$600(ActivityThread.java:127)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.os.Looper.loop(Looper.java:137)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread.main(ActivityThread.java:4507)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at java.lang.reflect.Method.invokeNative(Native Method)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at java.lang.reflect.Method.invoke(Method.java:511)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at dalvik.system.NativeStart.main(Native Method)
05-07 11:23:38.820: E/AndroidRuntime(8900): Caused by: java.lang.NullPointerException
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.content.ContextWrapper.getResources(ContextWrapper.java:81)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.view.View.<init>(View.java:2721)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.view.View.<init>(View.java:2769)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.widget.TextView.<init>(TextView.java:573)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.widget.TextView.<init>(TextView.java:566)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.widget.TextView.<init>(TextView.java:561)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at com.example.aaaaa.MainActivity.<init>(MainActivity.java:28)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at java.lang.Class.newInstanceImpl(Native Method)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at java.lang.Class.newInstance(Class.java:1319)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
05-07 11:23:38.820: E/AndroidRuntime(8900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
05-07 11:23:38.820: E/AndroidRuntime(8900):     ... 11 more

this is MainActivity.java  I think that the error is in the TextView view = new TextView(this); because i dont have TextView in MainActivity but i want to extract data from textview in another class (setting.java)
import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class MainActivity extends MapActivity {

       String num;
       TextView view = new TextView(this);

      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);

          Bundle extra = getIntent().getExtras();
          num = extra.getString("label");

          final TextView view = new TextView(this);
          Uri uriSMSURI = Uri.parse("content://sms/inbox");
          Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
          String sms = "";
          while (cur.moveToNext()) {

              String spn ="+21629188153";
              String phNum =cur.getString(2);
              if (spn.equals(phNum)){
              sms +=cur.getString(12);
                              }
              }

             String a =sms.substring(0,10);
             String b =sms.substring(11,21);

              MapView maMap;
            MapController monControler;

               maMap = (MapView)findViewById(R.id.myGmap);
                maMap.setBuiltInZoomControls(true);

                GeoPoint point = new GeoPoint (microdegrees(Double.parseDouble(a)),microdegrees(Double.parseDouble(b)));

                MonOverlay object = new MonOverlay(getResources().getDrawable(R.drawable.marker_voisinage_rouge));
                object.addPoint(point);
                maMap.getOverlays().add(object);
                maMap.setSatellite(true);

                monControler = maMap.getController();
                monControler.setZoom(12);
                monControler.setCenter(point);

                Button monBouton = (Button)findViewById(R.id.envoie_sms);

                monBouton.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        View monBoutton = null;
                        // TODO Auto-generated method stub

                            Intent monIntent = new Intent(MainActivity.this,SendSms.class);
                            startActivity(monIntent);

                    }
                } );

                Button mnBouton = (Button)findViewById(R.id.setting);

                mnBouton.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        View monBoutton = null;
                        // TODO Auto-generated method stub

                        setContentView(R.layout.setting);

                    }
                } );

                Button myBouton = (Button)findViewById(R.id.aff);

                myBouton.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        View monBoutton = null;
                        // TODO Auto-generated method stub

                          view.setText(num);
                          setContentView(view);

                    }
                } );
      }

            private int microdegrees (double value){
                return (int)(value*1000000);
            }

            @Override
            public boolean onCreateOptionsMenu(Menu menu) {
                // Inflate the menu; this adds items to the action bar if it is present.
                getMenuInflater().inflate(R.menu.activity_main, menu);
                return true;
            }

            @Override
            protected boolean isRouteDisplayed() {
                // TODO Auto-generated method stub
                return false;
            }
            public class MonOverlay extends ItemizedOverlay<OverlayItem>{

                List<GeoPoint> points = new ArrayList<GeoPoint>();

                public MonOverlay(Drawable arg0) {
                    super(boundCenterBottom(arg0));
                    // TODO Auto-generated constructor stub
                }

                @Override
                protected OverlayItem createItem(int i) {
                    GeoPoint point = points.get(i);
                    return new OverlayItem(point,"titre","description");
                }

                @Override
                public int size() {

                    return points.size();
                }

                public void addPoint (GeoPoint point){
                    this.points.add(point);
                    populate();
                }

            }

}

this is Setting.java and i want to pass s1 = num.getText().toString(); to MainActivity.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class setting extends Activity {
    Button sauvg;
    EditText    num;
    String s1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting);
        sauvg = (Button)findViewById(R.id.ok);
        num = (EditText)findViewById(R.id.editText1);

        sauvg.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v)
            {
                Intent t = new Intent(setting.this, MainActivity.class);
                s1 = num.getText().toString();
                t.putExtra("label",s1);
                startActivity(t);

                // TODO Auto-generated method stub

            }
        });

}
}

A: The error is here:
public class MainActivity extends MapActivity {

   String num;
   TextView view = new TextView(this); // <- HERE

You cannot create a View there, but you should move the creation in the onCreate method, like this:
public class MainActivity extends MapActivity {
   String num;
   TextView view;

  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      this.view = new TextView(this);
      Bundle extra = getIntent().getExtras();

Be careful with variable names: i see you have 2 called "view", which is not an error (one is a local variable in onCreate, the other is an instance variable) but it's easy to make errors.
By the way you can't access directly the TextView in other Activity. If you want to share data between activities you should use Intents or Message&Handler
EDIT
If MainActivity is the first activity to be launched when your app starts I suppose that you get your app crashing. This happens because you should check if the calling intent has extras before you use it, like this:
Bundle extra = getIntent().getExtras();
if (extra != null) {
   num = extra.getString("label");
}


text:
Q: Draw QML overlay in a GStreamer plug-in? After some searching, I see there is machinery in place in Qt to play video from GStreamer backend in a QML application. But I am interested in quite the opposite: do you know if it is possible to render QML graphics, probably with animations, in a GStreamer plug-in (filter)? Ideally, I would like to be able to feed my QML to a GStreamer plug-in and have it rendered over the video. The rendered output would be piped for further processing down the GStreamer pipeline. What do you think?
Thanks a lot in advance!
--
Vlad


text:
Q: How to identify elements that are in shadow Dom using protractor I used following code:
var listItems = element.all(by.deepCss('span'));

and it brings up all span elements but I want to get info of a particular span, any help is appreciated.

A: element.all(); will return an ElementArrayFinder, see the docs. Can you narrow down the selector?
Or you can use the filter(), see the docs to filter the specific element you are searching for.
Hope it helps.


text:
Q: jQuery Appending script to div I know that jQuery automatically parses script elements and append them to the head, however I dont have much of a choice. I need to insert an html string exactly into a specified div. so for example  into

.
The problem is that the scripts get loaded from a server which I have no control over and is using a document.write() script. So if that gets appended to the header, there will be severe issues. How can I do this with or without jQuery?

A: If you don't want your script to alter the content of you page you could insert it in an iframe instead of a div ? document should refer to the iframe then. I don't exactly get what you want though.

A: Ok. So to rephrase your question:
You want to insert some < script > tags in your page. These tags load javascript files that have document.write() in them.
Now you want the document.write() to happen in some divs, and not in the header.
I think you would then need to render those script tags directly in the source of your page from the very start. Felix noted correctly that when you load thse script tags later, the whole page will be replaced by what is outputted by the document.write() function.
Thus, javascript or JQuery cannot load these script tags. You should render them serverside in the initial version of your page..!

A: Document.write() will put the script at the end of the document (afaik). Then, you would need to look-up these script-tags and put them into the proper DIVs (with a $(elm).append(scriptObj)).
But I might not understand what your problem is...


text:
Q: Process a SSAS via Azure Data factory We have a requirement wherein we need to process SSAS via ADF as the ETL operations is being done via ADF into an Azure SQL database
any help regarding this will be appreciated

A: you can create a linked server across a On Prem database instance and Analysis service instance and then execute TSQL on the database instance via ADF to process the cube.
You can refer the below Doc :
https://github.com/furmangg/automating-azure-analysis-services/blob/master/LinkedServer/SQL%20Linked%20Server%20to%20Azure%20Analysis%20Services.sql


text:
Q: AppDelegate.m Facebook and Twitter handleUrl function I'm trying to add Facebook and Twitter auth to my react-native app at the same time.
According to the official instructions, I need to modify the AppDelegate.m file for handUrl the following way for twitter:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
  return [[Twitter sharedInstance] application:app openURL:url options:options];
}

And the following way for facebook.
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

  BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
    annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
  ];
  // Add any custom logic here.
  return handled;
}

How can I combine the two? I tried to check the variables and decide which one to return however no success so far.

A: You can try with checking url.absoluteString
For Example:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

  //Get absolute string
  NSString *aStrURL = url.absoluteString;

  if ([aStrURL containsString:@"YOUR_FACEBOOK_APP_ID"]){
    // facebook related code here
    return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                          openURL:url
                                                sourceApplication:sourceApplication
                                                       annotation:annotation];

  }
  else{
    // twitter or other code here
    return [[Twitter sharedInstance] application:app openURL:url options:options];
  }
}

A: You can check for url.scheme like this :-
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

  //App opened with Facebook scheme
  if([url.scheme isEqualToString:@"YOUR_FACEBOOK_ID"]){
       return [[FBSDKApplicationDelegate sharedInstance] application:app
                                                           openURL:url
                                                    sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
                                                           annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
  }
  //App opened with Twitter scheme
  else if ([url.scheme isEqualToString:@"YOUR_TWITTER_ID"]){
       return [[Twitter sharedInstance] application:app openURL:url options:options];
  }
  //App opened with different scheme
  else{
      return YES;
  }
}

A: I ended up solving it the following way:
My AppDelegate.m
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <TwitterKit/TwitterKit.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"mirrorapp"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                  didFinishLaunchingWithOptions:launchOptions];
//  return YES;
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
  return [[Twitter sharedInstance] application:app openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                        openURL:url
                                              sourceApplication:sourceApplication
                                                     annotation:annotation];
}

@end


text:
Q: Capture IPython output in a Python Kernel I want to capture the output produced by IPython terminal in a Python terminal.
As all the testing takes place using a Python Kernel.
I know about the IPython magic function.
%%capture
Is there a way to use these magic functions as context manager and capture the output, or maybe some other way?
Thanks.


text:
Q: Insert vector on N position into vector> So my problem is I have this file which I have to read and search info on it to then return it/print it, so I did and got all my file's info into a vector<string>.
So now I am looking to extract certain data from the vector<string> into my vector<vector<double>> from stringVector[N], to do this I am trying the following:
vector<vector<double>>twoDdoublevector;
vector<string>stringvector;

//cycle that goes on for a few iterations
{
    std::vector<double>temp;
    temp.push_back(stod(stringvector[newcount++]));
    temp.push_back(stod(stringvector[newcount++]));
    temp.push_back(stod(stringvector[newcount++]));
    twoDdoublevector.push_back(temp);
}

I don't know what exactly is going wrong, since it will just continue running, without finishing or showing anything.


text:
Q: Hosting the Page in IFRAME inside chrome extension whose X-FRAME is set to DENY or SAME ORIGIN I was trying to host a web page in the chrome extension popup and was hitting error X-FRAME options set to deny or SAME ORIGIN. As an alternative approach I opened up the page in new chrome browser instance and injected the script into it so that i can send the message from the page to content script and then back to my popup page once the work is done in the new window . UI experience of this approach does not look good and hence wanted to go via Iframe route. My extension has all url permissions in manifest.xml
Can someone suggest the right approach by which we can host a web page in IFRAME in chrome extension popup and get around the deny and SAME ORIGIN. Also will this be correct with respect to security .
I came across this unanswerd blog but seems to me a hack. Hence wanted to get clarity on chromium - extension forum.
Getting around X-Frame-Options DENY in a Chrome extension?


text:
Q: Android Make a copy of a TableRow (widget) into a new TableRow (widget) I have seen similar questions posted for sqlite and C#.
But not for java. How do I go about copying an existing TableRow into a new TableRow?
I don't want to share any reference, I want the two widgets to be identical.
Could it be that java lacks this basic object copying functionality?
I think TableRows are not clonable, since Eclipse did not autocomplete when I tried to write row.clone()
Copying manually is not an option since there are a lot of fields to TableRow.
Note: the "widget" in the title is to make it more generic for future searches

A: tableRow inherits from java.object however clone is not visible.  This should be posible using brute force.  A couple of options come to mind here.  One and probably the hardest but best method would be to implement the clonable interface in a sub class.
The other way would be to iterate through the children and deep copy them to a new table row.
Either way I dont envey what you have ahead of you.


text:
Q: Ember errors.add inside catch after save causes form button to not respond My server responds with a 400 status if a book title already exists. The ember app catches the error and does a errors.add with the attribute name and error detail. For some reason when a receive the 400 when I change the title the form submit button is dead. I found that when I eliminate the errors.add line the problem goes away.
Here is my action:
import Ember from 'ember';
import DS from 'ember-data';

export default Ember.Route.extend({

  model() {
    return this.store.createRecord('book');
  },

  setupController: function(controller, model) {
    controller.set('book', model);
    controller.set('errors', DS.Errors.create());
  },

  actions: {

    createBook: function(book) {

      var _this = this;
      var errors = _this.controllerFor('books.new').get('errors');
      book.save().then(function(book) {

        _this.transitionTo('books.book', book);

      }).catch(function(response) {

        response.errors.forEach(function(error) {
          var attribute = error.source.pointer.split('/')[3];
  //This line causes the problem---> errors.add(attribute, error.detail);

        });
      });

    }

  }
});

This is the response:
  res.status(400).send({
    errors: [
      {
        status: "400",
        source: { pointer: '/data/attributes/title' },
        title: "Invalid Attribute",
        detail: 'must be unique'
      }
    ]
  });


text: Q: how we manually convert xml object coordinates(x-min,x-max,y-max,y-min) into txt file coordinates x,y,w,h I want to run yolov5 model on custom dataset, but when I convert the XML into text file its not draw a box in the correct place (on objects). So check my conversion point, so kindly tell me How we manually converts xml object coordinates(x-min, x-max, y-max, y-min) into a text file coordinates  x,y,w,h??


text:
Q: Tomcat can't recognize changes in Servlets The problem is I started working on a project in Java EE Eclipse and its been a while I didn't open that project.
Now, when I try to add new Servlets or modify the old ones, it seems like I don't do any changes.
For example when I change the name of a servlet the browser still display the old one also when I change the text on a servelt it still display the old text.


text:
Q: Django 3 error - NoReverseMatch at /; Reverse for 'car_detail' with no arguments not found. 1 pattern(s) tried: ['cars/(?P[0-9]+)$'] I'm currently taking a tutorial on Django from an ebook. I keep getting this error despite doing what is written in the book. Maybe, I'm having an oversight and must have missed something. Can a kind person kindly help go through my code and tell me what I must have been doing wrong?
I've attached my code snippets below. Any help will be greatly appreciated. Thanks
NoReverseMatch at /
Reverse for 'car_detail' with no arguments not found. 1 pattern(s) tried: ['cars/(?P<id>[0-9]+)$']
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 3.0.7
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'car_detail' with no arguments not found. 1 pattern(s) tried: ['cars/(?P<id>[0-9]+)$']
Exception Location: C:\Python37\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 677
Python Executable:  C:\Python37\python.exe
Python Version: 3.7.7
Python Path:
['D:\\Django_Tests\\CarZone_Project',
 'C:\\Python37\\python37.zip',
 'C:\\Python37\\DLLs',
 'C:\\Python37\\lib',
 'C:\\Python37',
 'C:\\Python37\\lib\\site-packages']
Server time:    Wed, 16 Dec 2020 14:46:01 +0000
Error during template rendering
In template D:\Django_Tests\CarZone_Project\templates\base.html, error at line 0

Reverse for 'car_detail' with no arguments not found. 1 pattern(s) tried: ['cars/(?P<id>[0-9]+)$']
1   {% load static %}
2
3   <!DOCTYPE html>
4
5
6
7       <title></title>
8       <meta name="viewport" content="width=device-width, initial-scale=1.0">
9       <meta charset="utf-8">
10

Traceback Switch to copy-and-paste view
C:\Python37\lib\site-packages\django\core\handlers\exception.py in inner
            response = get_response(request) …
▶ Local vars
C:\Python37\lib\site-packages\django\core\handlers\base.py in _get_response
                response = self.process_exception_by_middleware(e, request) …
▶ Local vars
C:\Python37\lib\site-packages\django\core\handlers\base.py in _get_response
                response = wrapped_callback(request, *callback_args, **callback_kwargs) …
▶ Local vars
D:\Django_Tests\CarZone_Project\pages\views.py in home
    return render(request, 'pages/home.html', all_data) …
▶ Local vars
C:\Python37\lib\site-packages\django\shortcuts.py in render
    content = loader.render_to_string(template_name, context, request, using=using) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\loader.py in render_to_string
    return template.render(context, request) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\backends\django.py in render
            return self.template.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render
                    return self._render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in _render
        return self.nodelist.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render
                bit = node.render_annotated(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render_annotated
            return self.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\loader_tags.py in render
            return compiled_parent._render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in _render
        return self.nodelist.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render
                bit = node.render_annotated(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render_annotated
            return self.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\loader_tags.py in render
                result = block.nodelist.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render
                bit = node.render_annotated(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render_annotated
            return self.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\defaulttags.py in render
                    nodelist.append(node.render_annotated(context)) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\base.py in render_annotated
            return self.render(context) …
▶ Local vars
C:\Python37\lib\site-packages\django\template\defaulttags.py in render
            url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app) …
▶ Local vars
C:\Python37\lib\site-packages\django\urls\base.py in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)) …
▶ Local vars
C:\Python37\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix
        raise NoReverseMatch(msg) …
▶ Local vars

URLS.PY:

from . import views

urlpatterns = [
    path('', views.cars, name='cars'),
    path('<int:id>', views.car_detail, name='car_detail'),
]

HOME TEMPLATE:

                                        {% if each_car.car_image_1 %}

                                        {% endif%}
                                        {% if each_car.car_image_2 %}

                                        {% endif%}
                                        {% if each_car.car_image_3 %}

                                        {% endif%}
                                        {% if each_car.car_image_4 %}

                                        {% endif%}

                            {{each_car.car_title}}

                                {{each_car.state}}, {{each_car.city}}

VIEWS.PY:
def car_detail(request, id):
    single_car = get_object_or_404(Car, pk=id)
    data = {
        'single_car': single_car,
    }
    return render(request, 'cars/car_detail.html', data)

A: try this...

    {{each_car.car_title}}

      {{each_car.state}}, {{each_car.city}}


text:
Q: Install a fallback version of gcc g++ alongside the latest version? I am trying to build a SFML project with g++ 5. Unfortunately there is a bug in g++ 5 which prevents the link stage of a build using some SFML libraries from passing successfully.
This link has more details on the bug.
http://en.sfml-dev.org/forums/index.php?topic=20394.0
I couldn't figure out how to use the workaround. Appending -lgcc_s -lgcc to the my build command line didn't work.
I would like to know how to install a fallback version of gcc/g++. Let's specifically take version 4.9 as an example, as I am fairly confident this version will work.
Can this be done in a way in which I can still retain gcc/g++ 5 as my "default" or "main" c/c++ compiler? I am assuming I then call g++-4.9 rather than just g++ to compile a program using version 4.9?
Can this be done, and if so how? Are there any potential problems (breaking my system) with this?

A: You could always download and build the version of GCC you want, then add a script in /usr/bin/ to run it.  There's other ways of doing this which involves editing the PATH but I am not 100% sure on the details so... script it is I guess. (note: gcc-x.y.z is the version you want to use, IE: gcc-4.9.0.  Don't type gcc-x.y.z it will not work)
This article from the OSDev wiki goes over installing a version of GCC (it says newest but you can do any version you want when you download from the ftp mirror).
Start by downloading the version of GCC you want from here.
Extract it into $HOME/src.  You should have a gcc folder or something like that in $HOME/src.
Go to gcc-x.y.z/ and execute contrib/download_prerequisites
This should get the correct versions of the dependencies you need.
Now decide if you want this for just you or globally.  If you're just using this you can install it in $HOME/opt/ or globally /usr/local/gcc-x.y.z (I don't think it really matters since we will be placing a script in /usr/bin but don't quote me on that one)
Now, execute export PREFIX="$HOME/opt/gcc-x.y.z (or the /usr/local/gcc-x.y.z if you're using that as your prefix)
Now, according to the OSDev wiki you want to do
cd $HOME/src
If you wish to build these packages as part of gcc:

mv gmp-x.y.z gcc-x.y.z/gmp
mv mpfr-x.y.z gcc-x.y.z/mpfr
mv mpc-x.y.z gcc-x.y.z/mpc
Then:
mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --prefix="$PREFIX" --disable-nls --enable-languages=c,c++
make
make install
Now you can find it in $PREFIX/gcc-x.y.z (should be the $HOME/opt/cross or /usr/local/gcc-x.y.z)
now make a file in /usr/bin called gcc-4.9 (and g++-4.9).
In the script, add
#!/bin/sh
and
$HOME/opt/gcc-x.y.z/gcc "$@"
This will pass all the arguments from the command to this version of gcc.
(psst, do the same for the g++ script as well)
Test it out to see if it works.  Also if anyone has suggestions in the comments please tell me because I probably made a mistake somewhere.


text:
Q: AccessibilityService - Perform ACTION_CLICK on unclickable item I have tried to perform ACTION_CLICK on clickable item successfully. But, It's not working with unclickable item. Here my code:
List<AccessibilityNodeInfo> nodeInfoList = rootNode.findAccessibilityNodeInfosByViewId("com.VCB:id/tvLanguage");
            if (nodeInfoList == null || nodeInfoList.isEmpty())
                return;

            for (AccessibilityNodeInfo nodeInfo : nodeInfoList) {
                nodeInfo.setVisibleToUser(false);
                nodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK);
                Toast.makeText(getApplicationContext(), "Text:" + nodeInfo.getText(), Toast.LENGTH_SHORT).show();

Android widget TextView of "com.VCB:id/tvLanguage":
<android.widget.TextView index="1" package="com.VCB" class="android.widget.TextView" text="English" resource-id="com.VCB:id/tvLanguage" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[894,206][1019,252]" displayed="true" />

As you can see, the clickable="false", which not allow me to click it by AccessibilityService. Is there any approach to bypass this?
Thank you,

A: I don't know if you have found the answer but maybe you could try this:
nodeInfo.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);

If you have your button inside a list or some place, maybe this could help you.
If that, does not work, check the documentation because it says that you can't call the setVisibleToUser() method from an AccessibilityService.


text:
Q: C# NDDE issue with returning data immediately I am following the code example here for ndde to communicate with MS Excel (2010).
https://gist.github.com/atifaziz/9252590
I have fired up the program but can only get it to read the contents of R1C1 when I press enter (perfom the update/poke process).
How can I get the program to immediately return the value of the contents of cell R1C1 upon startup. I have tried client.Request method but this does not seem to work.


text:
Q: Work around not being able to use non-reifiable parameters with varargs There are many questions about the issue of combining generics with varargs. This would require generic arrays which don't exist when actual code tries to instantiate them. Moreover, there's a good amount of documentation on the compiler-vagueness of warnings from varargs methods with non-reifiable parameters. Because of type erasure this creates potential heap pollution, hence the warning (in Java 6 at the caller). However, my question is not about these problems themselves. I think I understand that some things aren't possible. What I'd like to know is the way to elegantly workaround these problems in my complex case.
Links for related topics:

*

*Is it possible to solve the "A generic array of T is created for a varargs parameter" compiler warning? where some call this situation a "bad feature" bug.

*http://docs.oracle.com/javase/tutorial/java/generics/non-reifiable-varargs-type.html
My case
I have a BookItemSearchAddTask that extends from the Android AsyncTask but somewhere along its inheritance hierarchy has been made generic, more abstract at higher levels:
At a higher level it's SearchAddTask, which contains the method start() to execute the task, called from a client that knows that it passes a BookItem product in.
public abstract class SearchAddTask<ProductToAdd extends Product & NamedProduct>
        extends AddTask<ProductToAdd, ProductToAdd> {

    public void start(ViewActivity context, ProductToAdd product) throws SpecificAddTaskDomainException, TaskExistsException, TaskUnavailableException {
        super.start(context, product);
            //more stuff ...
            execute(product);
    }
}

A level lower it's an ItemSearchAddTask. Here the method doInBackground is implemented, as required by the AsyncTask API. It can still use generics.
public abstract class ItemSearchAddTask extends SearchAddTask<I> {

    public I doInBackground(I... params) {
            I product = params[0];
            //do stuff ...
            return product;
    }
}

Finally BookItemSearchAddTask is ItemSearchAddTask<BookItem>. A BookItem therefore is an Item, is a Product. The "I" is linked to the class in which this nested task class, ItemSearchAddTask, finds itself:
public abstract class ItemSearchAddWindow<I extends Item & ImageRepresentedProduct & NamedProduct> extends ViewActivity implements View.OnClickListener,
        AdapterView.OnItemClickListener {}

The problem
Now, when I run this code I get the following error:
Caused by: java.lang.ClassCastException: [Lnet.lp.collectionista.domain.Product;
    at net.lp.collectionista.ui.activities.items.book.ItemSearchAddWindow$ItemSearchAddTask.doInBackground(ItemSearchAddWindow.java:1)

Note the "[L".
I also get compile time warnings at "execute(product);": "Type safety: A generic array of ProductToAdd is created for a varargs parameter"
The cause
To my understanding, the JVM finds that in the doInBackground vararg it gets a Product[] passed in, rather than the Item[] (I[]) it expects. Apart from the generic arrays, which are hard to think about, I think what's going on is the case of the lion cage at http://docs.oracle.com/javase/tutorial/java/generics/subtyping.html. Not by my code, but because the generated generic array of ProductToAdd (which basically extends Product) was created for the varargs param.
I checked that if I pass no argument to execute, that it works. Also using "execute((ProductToAdd[])new MusicCDItem[]{new MusicCDItem()});" worked mostly (don't ask, a MusicCDItem is an Item, just like a BookItem is).
A solution?
However in start() I can't know that I need to pass in a BookItem. I only know about "I". Since that is a generic, I can't create the generic array that is required to pass as the varargs param. I think what is complex about my case is the different levels of using generics, as well as the parallel hierarchies.
How do I work around this feature gap? I considered:

*

*Removing generics. A bit drastic.

*Holding on the varargs param everywhere in all the generics bits of code (i.e. change the method signature of start()), until we reach the client code, and only there do I pass one product element only, and that element is of a real type, BookItem. I will get the same warning there but the compiler will be able to generate the correct generic array.

*Duplicating the AsyncTask code and changing doInBackground to not use a varargs param because I currently may not need one. I prefer not to do this so I get the benefits when AsyncTask is updated in the future.

*Perhaps some reflection code in start(). Ugly.

Is there anything shorter and more local?
Either this, or there is some really stupid typo in my code.

A: You noted that you get an "Unchecked generic array" warning in SearchAddTask.start() when it calls execute(). However, the actual warning is slightly misleading. What it says is A generic array of ProductToAdd is created for a varargs parameter, but what it really means is, ProductToAdd is a type variable and at run-time I can't create an array of those, so I'll just have to use my best guess.
If you step through into execute() in the debugger, you'll see that the array that was created for the P... declaration is a Product[1] -- exactly what you'd expect from the class cast exception you got. At run time, this is the best the JVM can do, because it's the closest un-erased ancestor of ProductToAdd.
Unfortunately, in ItemSearchAddTask, the JVM's also done the best it can, which is convert the I... declaration into an Item[] (the closest un-erased ancestor of I); thus the ClassCastException when execute() tries to call doInBackground().
The least awful way I can think of offhand to get around this is to sidestep Java's type erasure by keeping ProductToAdd's concrete class around at run time and creating the args array (of the correct type) yourself:
abstract class SearchAddTask<ProductToAdd extends Product & NamedProduct>
  extends AddTask<ProductToAdd, ProductToAdd> {

    private final Class<ProductToAdd> productClass;

    SearchAddTask(Class<ProductToAdd> productClass) {
        this.productClass = productClass;
    }

    public void start(ViewActivity context, ProductToAdd product) {
        super.start(context, product);
        ProductToAdd[] argsArray = (ProductToAdd[]) Array.newInstance( productClass, 1 );
        argsArray[0] = product;
        execute( argsArray );
    }
}

It does mean you have to ensure that BookItem.class gets passed in, probably when you create the AddWindow<BookItem>, but it keeps the ugliness contained.


text:
Q: Moving all particles from an emitter My tilemap has a "torch" tile. I am using a CCParticleSystemQuad emitter to make the fire effect.
The emitter is children of the tilemap (directly above the torch tile).
However, the player can move and the tilemap will move as well (to center the "camera" on the player). When that happens, naturally the emitter will move as well. But here's the problem: such movement gives an effect like.... like if the torch was moving, and not the player (which is actually the case, but this effect isn't good).
Hard to explain. Just make a fire emitter, put as children of tilemap, and move the tilemap to the right. The effect is cool but doesn't make sense.
Any ideas? I though of moving every single existing particle in the emitter, but that doesn't sound good for performance (I got lots of emitters with hundreds/thousands of particles, and the map scrolls almost every single frame)

A: The CCParticleSystem has a positionType property with which you can change the position behavior of the emitted particles.
The enum is defined as follows:
typedef enum {
    /** Living particles are attached to the world and are unaffected by emitter repositioning. */
    kCCPositionTypeFree,

    /** Living particles are attached to the world but will follow the emitter repositioning.
     Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
     */
    kCCPositionTypeRelative,

    /** Living particles are attached to the emitter and are translated along with it. */
    kCCPositionTypeGrouped,
}tCCPositionType;

You will want your particles to be positioned either relative or grouped. There's a subtle difference between the two, just try one and then the other to see which fits your use case better.
particleSystem.positionType = kCCPositionTypeRelative;
particleSystem.positionType = kCCPositionTypeGrouped;

Btw, this is one of the few settings that can't be changed in the ParticleDesigner tool.


text:
Q: How to install ipkg in CentOS 6.5 I have started using CentOS recently. I have some packages which end with .ipk. I need to install a cross compiler and the steps in the compiler's manual says I should do the following:
ipkg install libstdc++6_4.1.2-r10_armv5te.ipk

I have tried to  install ipkg or opkg, but it didn't work. Can anyone tell how to install any of them or if there is an alternative to install .ipk file?

A: CentOS is a Redhat-Base distro and uses YUM(Yellowdow Updater Modified) engine, Debian-base distros such as mint, *untu and so on use APT enegine.
For more information about YUM engine you can read : YUM guides

A: ipkg has been replaced by opkg.
Download source:
wget http://downloads.yoctoproject.org/releases/opkg/opkg-0.2.1.tar.gz

Compile:
./configure
make

You really don't have to use apt!


text:
Q: Python - Why do extend() and append() return None (void)? I think list1.extend(list2) and list1.append(num) should return the mutated list as well as mutating id, rather than returning None.

A: I believe the intent was to promote readable code and reduce bugs. This decision was made a very long time ago, but you can probably find more by looking at the archives of the python/python-dev mailing lists.
Python3 would have been the opportunity to change this behaviour, but as you see it remains, so is not considered a design mistake by the development team


text:
Q: Vectors, finding acute angle between VB and plane OVA on a square base pyramid A pyramid has a square base OABC and Vertex V . The position vector of A,B,C and V with reference to O are given by OA = $2i$, OB= $2i + 2j$ , OC= $2j$ and OV= $ i + j + 3k$ ,
state the acute angle between VB and the plane OVA .

I actually have trouble visualising this. Is there any diagrams that I can visualise actually what angle I am trying to find ?
I attempted some steps to help me attempt it the question
I find the vector that is perpendicular to the plane OVA using $OV \times AV$ and I got $-6j + 2k$, let's call this vector $x$.
I find the angle between $x$ and $VB$ which is $124.9$ .
Since I cant visualise what angle I'm finding, I cannot carry on the question from here.

A: HINT

*

*Find a vector orthogonal to plane OVA by $\vec n= \vec {VO}\times \vec {VA}$ (directed towards the side of B)

*Find the angle $\alpha$ between $\vec n$ and $\vec {VB}$ by $\cos \alpha=\frac{\vec n \cdot \vec {VB}}{|\vec n|\,|\vec {VB}|}$

*The desidered angle between $\vec {VB}$ and the plane is $\theta=\frac{\pi}2-\alpha$


text:
Q: kde with no root window I wish to disable the kde root window, so I can see the X11 root window. I have seen, in lots of places how to do this for older/newer versions of kde, but I can not get it to work on mine.
I am running Debian Gnu/Linux in virtual box, I wish to use seemless mode. However because kde has its own root window over the X11 root window, the transparency is not working. It is covering the host windows.
I have discovered that plasma-destop does the background and panels. Don't know how to get it to do just panels.

#>uname -a
Linux richard-laptop 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux
#>kwin --version
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Qt: 4.8.2
KDE Development Platform: 4.8.4 (4.8.4)
KWin: 4.8.4 (4.8.4)


text:
Q: Want to copy selected items (by checkbox) in a jquery popup to the parent page I have a page that has a button, that when clicked opens up a jqueryui popup window.
the window has a list of items, each with a checkbox beside it.
i want the selected items to be passed to the parent page when they hit the 'add' button on the popup.
The items should send back the values selected, and inject that into a textbox.

A: As @Adam mentioned, the form exists on the page already so you can easily read the values of the checkboxes.
Here's some example code:
HTML
<div id="some-form">
    <input type="checkbox" value="Option 1" />
    <input type="checkbox" value="Option 2" />
    <input type="checkbox" value="Option 3" />
</div>

jQuery
$("#some-form").dialog({
    height:300,
    modal: true,
    buttons: {
        'Insert Checkbox Values': function() {
            // The following loops through the checked checkboxes
            $("input[type=checkbox]:checked", this).each(function() {
               alert($(this).val());
               // write AJAX insert method here using $.ajax or $.post
            });
            $(this).dialog('close');
        },
        Cancel: function() {
            $(this).dialog('close');
        }
    }
});

Please note that if you're using asp.net, the modal will be placed OUTSIDE of the <form> element which means you won't be able to access the controls.
There's an easy fix for that, simply append the modal to the form element like this:
$("#some-form").parent().appendTo("form:first");

Hope this helps.
Marko