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
M

Manish K Agarwal

@Manish K Agarwal
About
Posts
58
Topics
18
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Jackson ObjectMapper valueToTree method also write valueType and integral but no actual value
    M Manish K Agarwal

    I am trying to convert a JAVA POJO object with a JsonObject to a String as following:

    class MyPojo {
    public MyPojo(String sName, JsonObject obj)
    {
    this.sName = sName;
    this.tJsonObj = obj;
    }
    public String sName;
    public javax.json.JsonObject tJsonObj;
    };

    javax.json.JsonObject jsonObj = JsonUtils.toJsonObject("{\\"key\\": 123}");
    ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper.ObjectMapper();
    JsonNode node = mapper.valueToTree(new MyPojo("myname", jsonObj));
    String jsonStr = node.toString();
    

    I am getting jsonStr value as:

    {"sName":"myname","tJsonObj":{"key":{"integral":true,"valueType":"NUMBER"}}}

    How can I get jsonStr value as:

    {"sName":"myname","tJsonObj":{"key":123}}

    JsonUtils.toJsonObject is my own utility method to get JsonObject from String.

    Java java com tools json question

  • Yay! CP's back!
    M Manish K Agarwal

    But still see the response is very slow

    The Lounge com

  • C++ and Artificial Intelligence
    M Manish K Agarwal

    As far as I know most of the ML libraries are available in R, Python, Spark etc. not sure if C++ is the correct route for ML.

    C / C++ / MFC question c++ game-dev learning

  • Deep copy of List<> without knowing specific list type
    M Manish K Agarwal

    As long as ListType is clonable, you can do it as following

    bar.add(listEntry.clone());

    Java functional question

  • Code consuming lot of RAM (Memory)
    M Manish K Agarwal

    single run takes more than 1 MB

    C / C++ / MFC c++ performance tutorial announcement code-review

  • Code consuming lot of RAM (Memory)
    M Manish K Agarwal

    seems mostly with vector resize which you are using extensively.

    C / C++ / MFC c++ performance tutorial announcement code-review

  • Table Design Suggestion
    M Manish K Agarwal

    It is a complex system where I don't know upfront what all possible reference list may exist in the runtime environment. Also, these value will never be referenced from any other table or column. A kind of auto-suggest list and user is always free to choose new value if not like any of the suggestions.

    Database css database design performance announcement

  • Table Design Suggestion
    M Manish K Agarwal

    As described above as well: There is no DELETE operation, only SELECT and INSERT/UPDATE. Also every time I want to select all possible values for given NAME. This is a kind of reference list to fill the autocomplete suggestions on UI. Hence fetch will be always all values and INSERT new only one value at a time.

    Database css database design performance announcement

  • Table Design Suggestion
    M Manish K Agarwal

    I have to maintain some metadata lists in DB, I have 2 options to design underlying simple table, 1st:

    NAME VALUE

    dept HR
    dept fin
    role engineer
    role designer

    UNIQUE CONSTRAINT (NAME, VALUE) and some other columns like auto generated ID, etc. 2nd:

    NAME VALUE_JSON_CLOB

    dept {["HR", "fin"]}
    role {["engineer", "designer"}]

    UNIQUE CONSTRAINT (NAME) and some other columns like auto generated ID, etc. There is no DELETE operation, only SELECT and INSERT/UPDATE. In first advantage is only INSERT is required but SELECT (fetch all values for a given NAME) will be slow. In second SELECT will be fast but UPDATE will be slow. By considering there could be 1000s of such lists with 1000s for possible values in the system with frequent SELECTs and less INSERTs, which TABLE design will be good in terms of performance. Thanks in advance.

    Database css database design performance announcement

  • java jee
    M Manish K Agarwal

    Java Connectivity with MySQL[^] Connect Java to a MySQL database[^]

    Java java learning mysql security tutorial

  • Java compile time Errors
    M Manish K Agarwal

    :)

    import java.util.*;
    class One
    {
    public static String city;
    public static void main(String args[])
    {
    city=args[0];
    Two t= new Two();
    }
    }

    class Two extends One
    {
    public Two()
    {
    if(city=="Banglore")
    System.out.println("Hello BANGLORE");
    }
    }

    Java java

  • While loop not working on C.
    M Manish K Agarwal

    here you go

    #include
    #include

    int main(){

    int num\[50\], i = -1, j;
    int count = 0;
    
    printf("Enter your integer: \\n");
    
    do{
    	scanf(" %d", &num\[i+1\]);
    	i++;
    	count++;
    	
    }while(num\[i\]!=0);
    
    for(j=1; j<= count; j++){
    	
    	if(num\[1\] > num\[j\]){
    		num\[1\] = num\[j\];
    	}
    }
    
    printf("%d is the greatest of them all !", num\[0\]);
    
    return 0;
    

    }

    C / C++ / MFC data-structures

  • while error ?
    M Manish K Agarwal

    To make it working, change as following:

    #include
    #include
    using namespace std ;
    int main()
    {
    string in = " ";
    while ( in != "" )
    {
    cout << "What is your name ? \n" ;
    cout << "[ Pres enter to end this .]\n" ;
    getline(cin, in );
    cout << "Hello " << in << " .\n" ;
    }
    cout << "n\n\n\[ GAME OVER ]\n" ;
    cin.get() ;
    return 0;
    }

    C / C++ / MFC question c++ game-dev help

  • while error ?
    M Manish K Agarwal

    std::string have != operator. The problem is with cin, it does not takes new line char or leading space chars by default.

    C / C++ / MFC question c++ game-dev help

  • Modeless Dialog with Message Loop
    M Manish K Agarwal

    Thanks again for your detailed reply. I will take care of this.

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC com help

  • Modeless Dialog with Message Loop
    M Manish K Agarwal

    My final code looks like as below and it does not require handling of WM_SYSCOMMAND/SC_CLOSE or any other message as my test shows that we always get WM_CLOSE irrespective of how we are closing it.

    for (;;)
    {
    WaitMessage();
    PeekMessage(&Msg, NULL, 0, 0, PM_NOREMOVE);

    if (Msg.message == WM_CLOSE)
    {
    // Do not remove the WM_CLOSE from message Queue and leave it for IE.
    break;
    }

    BOOL bRet = GetMessage(&Msg, NULL, 0, 0);
    if (!bRet)
    break;

    // original code from your while loop
    if (PreTranslateMessage( &Msg ) == 0 )
    {
    if (m_MainDialog.m_hWnd == (HWND) NULL || !::IsDialogMessage(m_MainDialog.m_hWnd, &Msg))
    {
    TranslateMessage( &Msg );
    DispatchMessage(&Msg);
    }
    }

    if (m_MainDialog.bClosed == true)
    {
    break;
    }
    }

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC com help

  • Modeless Dialog with Message Loop
    M Manish K Agarwal

    Thanks a lot. PeekMessage approach is working with a small correction if (!bRet) to if (**bRet**) i.e. removed NOT operator.

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC com help

  • Modeless Dialog with Message Loop
    M Manish K Agarwal

    I am creating a modeless dialog from an ActiveX which loads in the Internet Explorer 9/Windows 7 using following code: Where CMyActiveXCtrl class is of COleControl type.

    void CMyActiveXCtrl::OnBnClickedTest()
    {
    m_MainDialog.bClosed = false;
    m_MainDialog.ShowWindow( SW_SHOW );

    MSG Msg;

    BOOL bRet;

    while (bRet = GetMessage(&Msg, NULL, 0, 0))
    {
    if (bRet == -1)
    {
    MessageBoxA(this->m_hWnd, "Message loop error", "My ActiveX", MB_OK);
    break;
    }

         if (PreTranslateMessage( &Msg ) == 0 )
         {
              if (!::IsDialogMessage(m\_MainDialog.m\_hWnd, &Msg)) 
              { 
                  TranslateMessage( &Msg );
                  DispatchMessage(&Msg);
              }
         }
    
         if (m\_MainDialog.bClosed == true)
         {
             break;
         }
    

    }// while
    }

    m_MainDialog.bClosed set true on modeless dialog close/destroy. Now when my modeless dialog is opened in ActiveX and the user closes the browser window using IE > File > Exit or clicks on top right "X" button, IE main windows closes (no longer visible) but it leaves an orphan IE process in the task manager. The same code working fine on Windows XP/ IE 8. Can anyone suggest me what could be the problem with above message loop in OnBnClickedTest() else without that message loop, it works fine.

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC com help

  • ActiveX Memory leaks
    M Manish K Agarwal

    I am not looking simply memory leak finding tools but I am trying to deal with a special case when there is a memory leak inside an ActiveX. I know this is simply as a Leak inside a DLL but ActiveX case is some different as it is loaded by IE using JavaScript object tag and it is also unloaded by IE. I want to track leaks at unloading time.

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC c++ com performance

  • ActiveX Memory leaks
    M Manish K Agarwal

    Is there any tool to findout memory leaks in an ActiveX (build using C++/MFC). This ActiveX is loaded through a webpage in IE. I want to find out leaks at run time on certain operation in the ActiveX specially during unload. I tried bound checker but there is no such option to attach IE with it.

    Manish Agarwal manish.k.agarwal @ gmail DOT com

    C / C++ / MFC c++ com performance
  • Login

  • Don't have an account? Register

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