Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

elelont2

@elelont2
About
Posts
39
Topics
22
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Passing double pointer to function
    E elelont2

    Hi I am a bit confused about the double pointer. I would like to pass it to a function and change the pointer value:

    static int GetValue(int** hello)
    {
    *hello = &Something;
    }

    //Why does this work:
    int* pointer = NULL;
    GetValue(&pointer);

    //And this does not work:
    int** pointer = NULL;
    GetValue(pointer);

    To me they seem like the same thing.

    C / C++ / MFC question

  • uint32_t result of uint16_t addition
    E elelont2

    Hi, im having trouble understanding this line of C code (XC32, pic32):

    uint16_t Cur = 65535;
    uint16_t Next = 14000;
    uint32_t ResVal = 0;
    ResVal = ((uint32_t)Cur + (uint32_t)Next);

    I believe the C standard requires that some sort of integral promotion takes place here but the result is not 79535. Instead i get an overflown uint16_t result. How can i add two uint16_t variables and get the correct uint32_t result?

    C / C++ / MFC question

  • Cannot get dynamic javascript content from web page
    E elelont2

    Hi, i am trying to use pyQT and python to get the dynamic content from a web page. The problem is that i still only get the static content. What could be wrong with the code below? Code is based on this link: https://impythonist.wordpress.com/2015/01/06/ultimate-guide-for-scraping-javascript-rendered-web-pages/[^]

    import sys
    import time
    from PyQt4.QtGui import *
    from PyQt4.QtCore import *
    from PyQt4.QtWebKit import *
    from lxml.html import fromstring, tostring, iterlinks

    class Render(QWebPage):
    def __init__(self, url):
    self.app = QApplication(sys.argv)
    QWebPage.__init__(self)
    self.loadFinished.connect(self._loadFinished)
    self.mainFrame().load(QUrl(url))
    self.app.exec_()
    print("inside 1")

    def _loadFinished(self, result):
    self.frame = self.mainFrame()
    self.app.quit()
    print("inside 2")

    #def userAgentForUrl(self, url):

    return 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36 OPR/32.0.1948.25'

    url = 'http://www.somepage.com'

    r = Render(url)
    print("inside 3")

    print("Sleeping..")
    time.sleep(5)
    print("Sleeping done")

    result = r.mainFrame().toHtml()
    print(result.encode('utf-8'))

    I added the sleep(5) to ensure that the dynamic content has time to load but is does not help. Why doesn't the r.mainFrame() contain the valid dynamically created page contents? Is it not updated after the pageloaded event? Regards

    JavaScript help javascript python php html

  • Help with double pointers and const
    E elelont2

    Thanks, worked great, will try to figure out what gets consted...

    C / C++ / MFC help

  • #include directive in switch case if clause
    E elelont2

    Hi, i have a tool which generates some code, so i cannot place the include at the top of the file.

    case ID_ONE:
    if (id == 1)
    {
    #include "Func.h"
    Func();
    }
    if (id == 2)
    {
    Func();
    }
    break;

    I get the following error:

    incompatible implicit declaration of function 'Func'

    If i remove the #include then it compiles with a warning (implicit declaration). Is it not legal to #include in if statements?

    C / C++ / MFC help question

  • Help with double pointers and const
    E elelont2

    Hi, i cannot figure this out:

    typedef struct
    {
    int a;
    int b;
    } CARPIC;

    const CARPIC const* CarPics[] =
    {
    &Audi,
    &BMW,
    &Bugatti,
    }

    // Get function
    void GetCarPicture(CARPIC** carPicture)
    {
    int carId= GetCarId(); // Lets say, returns 2
    *carPicture = CarPics[carId];
    }

    // Using the function
    CARPIC* car;
    GetCarPicture(&car);

    I get the warning:

    warning: assignment discards qualifiers from pointer target type

    I tried to add the const keyword to the GetCarPicture function parameter but could not figure out where to add it. I need to get the pointer to the const car picture. Regards.

    C / C++ / MFC help

  • Variable in flash memory - how to write?
    E elelont2

    Thanks, that clears it up!

    C / C++ / MFC adobe business performance tutorial question

  • Variable in flash memory - how to write?
    E elelont2

    Thanks for the response, but i am still a little confused. Just theoretically, what happens if i were to write:

    uint8 Table[128] __attribute__((space(prog), section(".table_flash_control"))); // Create variable in flash memory
    ...
    Table[0] = 13; // Is it written to flash now?

    Unfortunately i cannot try it, just trying to understand the logic. I am aware that the flash memory has only some certain write lifespan.

    C / C++ / MFC adobe business performance tutorial question

  • Variable in flash memory - how to write?
    E elelont2

    Hi, I read that i can set a variable in flash memory like this (PIC32):

    uint8 Gain_factor_Den_17[128] __attribute__((space(prog), section(".table_flash_control")));

    But what happens when i change that variable, flash has some requirements (e.g. need to erase page before writing etc). Who will handle that?

    C / C++ / MFC adobe business performance tutorial question

  • Is it possible to bind the "this" pointer
    E elelont2

    Hi, Is it possible to bind the "this" pointer to make a callback into a non-static class member function (c++98, no boost). I don't think the "this" pointer is passed directly as a parameter to the function?

    typedef void (*CallBackType)(void);

    ...

    obj->SetCallback(std::bind1st(&MyClass::CallBackFunc, this));

    C / C++ / MFC c++ question

  • Function in namespace - multiple definition
    E elelont2

    I noticed that the issue only occurs when i use "_" as function name. When i set it to something else it will work. My namespace was named the same as my class, is it possible that the compiler did not detect the ambiguity?

    C / C++ / MFC c++ question

  • Function in namespace - multiple definition
    E elelont2

    Hi, i cannot figure this out: hpp:

    namespace ContractStorage
    {
    std::string DoIt(ContractName c); // Declaration
    }

    cpp:

    namespace ContractStorage
    {
    std::string DoIt(ContractName c)
    {
    printf("yes");
    }
    }

    It says: multiple definition of `ContractStorage::DoIt(ContractStorage::ContractName)' How can this be, i only have the decalaration in the hpp file? I have a class declaration in the same file, it does not complain about that...

    C / C++ / MFC c++ question

  • Vector index to iterator
    E elelont2

    Thank you, but can you explain why my version does not work? Are the types not compatible? I can access vector elements by dereferencing iterators, does it not work the other way around?

    C / C++ / MFC database graphics help

  • Converting char* to double
    E elelont2

    How does it explain my situation? I read that atof uses locale information, and my locale is using , as decimal separator - therefore it only gives me integer part of the double. My data however contains a . as decimal separator. http://stackoverflow.com/questions/1333451/c-locale-independent-atof[^]

    C / C++ / MFC data-structures question

  • Vector index to iterator
    E elelont2

    Hi, i am trying to point my vector iterator to some vector index like this: std::vector::iterator* it= myVec[i]; But it fails: no known conversion for argument 1 from ‘Data’ to ‘std::vector::iterator Please help :)

    C / C++ / MFC database graphics help

  • Converting char* to double
    E elelont2

    Hi, I have a char array like that represents a double, e.g "1.0004" If i use atof to get double then i get the value 1, since my locale is using , as decimal separator. But when i use istringstream i get the correct value. How is that possible? Does it convert BOTH the . and , to decimal separators? Regards

    C / C++ / MFC data-structures question

  • Can i trust the result of clock_getres?
    E elelont2

    Hi, i am confused about the return value of the clock_getres functions. I am running on custom hw with armv4 cpu and kernel version 2.6.26. I get values 7812500 (nanoseconds) for CLOCK_REALTIME and CLOCK_MONOTONIC. Can i trust that the resolution of gettimeofday (uses CLOCK_REALTIME?) calls is ~7.8ms? Does the CPU clock speed affect this value? Regards ele lont

    C / C++ / MFC performance question announcement

  • Stroustrup's RAII code
    E elelont2

    I am watching a video where B. Stroustrup talks about c++ - link-> (31:23) ()[^] I have trouble understanding the RAII slide: http://www.upload.ee/image/4090006/raii.png 1) Why doesn't he catch the exception? 2) I keep reading that when constructor throws, the destructor of an object is never called. Regards

    C / C++ / MFC c++ com question

  • how is boost_scoped_ptr RAII ?
    E elelont2

    ny_old_iron class will be uninitialized. How is it initialized? Also, what do you mean by "object class"? RAII says that the object is initialized during acquisition. scoped_ptr is supposed to support RAII but it allows to defer allocation, which means that the object pointed by the scoped_ptr is uninitialized. Therefore i would say that scoped_ptr is not RAII.

    C / C++ / MFC question

  • WPF datagrid text alignment in columns
    E elelont2

    Hi and thanks for the reply. Unfortunately that did not do the trick. The column headers are hidden so i do not need to right-align them. Basically the datagrid has two columns of data. I need the DATA in ONE of the columns to be right aligned. I tried this:

     <Setter Property="CellStyle">
                <Setter.Value>
                    <Style TargetType="DataGridCell">
                        <Setter Property="HorizontalAlignment" Value="Right"/>
    

    but that just plain righ-aligns everything in the datagrid (data in column 1 and in column 2). Is it possible to apply this to column 2 only? Note that i do not have the column definitions in my xaml since the datagrid is populated via a binding. Thanks

    WPF wpf csharp css wcf question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups