All posts by Social marketing master

How to pass a path as a parameter into a second application in vc++?

Hi!

Could someone answer my question, please?

I have an application, which is being developed in the Visual C++.
This application calls a second executable.
It passes a file path as a parameter.
How to do it correctly?
I mean double quotes, spaces and other special characters or their combinations.
For example, file My Doc.doc should be “My Doc.doc” (with double quotes).
PathQuoteSpaces is not a solution for me.
I need long paths (longer than MAX_PATH) and always well-formed parameter.
I call a MS’s application, and their standard is important.

read more

Knockout nested components: $(document).ready() … runs before nest component is loaded

So I have several nested knockout components:

<component1>
   <component2>
   ....
   </component2>
</component1>

component1 is my own component, written by me, but component2 is a third party code and I am not supposed to change it. Here is the problem:

In $(document).ready(), I use jquery $('button').click(...) to assign click even handler to, say, all buttons, for simplicity. The result it, only buttons inside component1 and outside component2 get the handler, and none of the button inside component2 has the handler (nothing happens when I click on them).

read more

Angular on Meteor with CoffeeScript/Jade

I feel like I’m so close, but I get hung up on why this setup isn’t working for me. https://github.com/jaruesink/first_meteor

Thanks for anyone who can help out with this, I’m just trying to learn and have fun with a new project.

scripts/_main.coffee

@App = angular.module('App', [
'angular-meteor'
'ngMaterial'
'ui.router'
])

@App.config [
    '$interpolateProvider'
    ($interpolateProvider) ->
        $interpolateProvider
            .startSymbol '[['
            .endSymbol   ']]'
]

scripts/router.coffee

@App.config [
    '$stateProvider', '$urlRouterProvider', '$locationProvider'
    ($stateProvider, $urlRouterProvider, $locationProvider) ->
        $locationProvider.html5Mode true
        $urlRouterProvider.otherwise '/home'
        $stateProvider.state('home'
            url: '/home'
            templateUrl: UiRouter.template 'home'
        )
]

read more

Questions related to reading in different format of numbers characters

How I can read in those elements and store them into two different arrays., i.e. : the number in <?> and the word in [?] to be separately read in and stored.

<98>
Avs [adadada]
<45>
[adafaf] BBBHADA
asdadqd aada [Mammoth]
<-1> // ends the read

The rest of the info in the file is useless which do not require to be stored.

Edit:

Following the advice of one of the answers, here is my first attempt:

#include <iostream>
#include <sstream>
#include <fstream>
#include <string.h>


using namespace std;

int main(int argc, char* argv[])
{
    if(argc != 3)
        cout<< "Error! Not enough file!"<<endl;
    int** page = new int*[];
    char** words = new char*[];

}
//--------------------------------------------------------- 
void readInput(int** page1, char** name1){
    istream is;
    char par1, par2;
    int  usefulVal;
    is >> par1 >> usefulVal >> par2;

    // check if any input
    if(!is) return is;

    // check for valid input format
    if (par1 != '<' || par2 != '>'){
    // set failbit to indicate invalid input format
       is.clear(ios_base::failbit);

    // assign input values to second argument
    page1(usefulVal);

    char par_1, par_2;
    string string_value;
    is >> par1 >> string_value >> par2;
    if(!is) return is;
    if (par_1 != '[' || par_2 != ']')
    {
       is.clear(ios_base::failbit);
       return is;
    }
    name1(string_value);
    return is;
}

read more

Questions related to reading in different format of numbers characters

How I can read in those elements and store them into two different arrays., i.e. : the number in <?> and the word in [?] to be separately read in and stored.

<98>
Avs [adadada]
<45>
[adafaf] BBBHADA
asdadqd aada [Mammoth]
<-1> // ends the read

The rest of the info in the file is useless which do not require to be stored.

Edit:

Following the advice of one of the answers, here is my first attempt:

#include <iostream>
#include <sstream>
#include <fstream>
#include <string.h>


using namespace std;

int main(int argc, char* argv[])
{
    if(argc != 3)
        cout<< "Error! Not enough file!"<<endl;
    int** page = new int*[];
    char** words = new char*[];

}
//--------------------------------------------------------- 
void readInput(int** page1, char** name1){
    istream is;
    char par1, par2;
    int  usefulVal;
    is >> par1 >> usefulVal >> par2;

    // check if any input
    if(!is) return is;

    // check for valid input format
    if (par1 != '<' || par2 != '>'){
    // set failbit to indicate invalid input format
       is.clear(ios_base::failbit);

    // assign input values to second argument
    page1(usefulVal);

    char par_1, par_2;
    string string_value;
    is >> par1 >> string_value >> par2;
    if(!is) return is;
    if (par_1 != '[' || par_2 != ']')
    {
       is.clear(ios_base::failbit);
       return is;
    }
    name1(string_value);
    return is;
}

read more