C++ :: Cannot Control Table Alignment
Nov 29, 2013
I want the function to display all accounts deposit list to work properly, what i mean is that the table coming has its contents here and there . I want to align them properly. program in comment.
View 11 Replies
ADVERTISEMENT
May 7, 2014
Basically, I'm working on a code that has its own allocator class. In the backend, the class uses malloc() to create huge blocks of memory aligned to sizeof(void*).
Apparently, in certain special circumstances, sizeof(void*) will be 4 when the data actually needs to be aligned to 8 bytes. If the memory isn't aligned to 8 bytes, there will be heap corruption and a bus error will occur. One such case is on HP-UX; we forced the alignment to 8 bytes on that platform. According to the commit log, HP-UX has a minimum struct size of 8 bytes and that's why it has to be aligned to 8 bytes (but I can't confirm if this is actually true).
We're running into these same problems when compiling on MIPS, MIPSel, and SPARC (all 32-bit builds).
(Side thought just now as I wrote that: seems like RISC processors don't allow unaligned access while x86 processors do. It looks like these build failures on MIPS and SPARC were while trying to build 32-bit on 64-bit hardware, could this be the problem?)
Anyway, the ultimate question and goal here is to find out how to detect this magical minimum alignment size, if not sizeof(void*).
View 9 Replies
View Related
Oct 5, 2013
I am working on extending an application that features a (rather old) plugin system. The plugin system is designed to work on x86 only, but support any and all compilers on windows, linux and also OSX.
My goals are now to
1) extend the plugin framework in a backwards compatible way
2) port it elegantly to x64
So far so good.
The plugin subsystem essentially exports a bunch of SDK function like this:
Code:
extern "C" CDECL int somefunc(int a, int b);
Which can be used by the plugin, and expect the plugin to export some function in return. When a struct is supposed to be send to the plugin, the syntax of the system goes like this:
Code:
extern "C" CDECL int RequestStructField(int field, int structhandle);
So the struct isnt handed over via a pointer, but every field has to be requested individually! From what I can tell from the comments, the developer was afraid there might be problems exchanging structs between different compilers, alignment and all.
I would like to tear down this limitation, and pass pointers to structs to plugin directly. Or better: allow the plugin to give me a pointer to an empty struct which i subsequently fill.
However, i have no control over the compiler or language used to write the plugins. Quiet some plugins are written in Delphi, some even in MASM ... both would have to support this way of passing structs.
the question is: does that work?
I have looked at other plugin systems, but they either use entirely different ways (XPCOM) or are limited to a single platform or compiler.
Some of them have a note stating that the plugin must be compiled with "byte-aligned" structs.
x86 and x64 plugins are two different stories, x64 version of the app does NOT have load x86 plugins. I dont expect there to be too man problems (right?). But we'll see, i guess.
View 13 Replies
View Related
Jul 19, 2013
I'm trying to find out, how to do printf so that it prints out text in the center of the window. I know how left and right justifyment is... but how to get to the center? C...
View 2 Replies
View Related
May 24, 2014
I have researched quite extensively, experimented, and still cannot seem to change the properties of a control on an active winform from a user control.
So I have a user control which populates each dynamically added tab page in a tab control.
I have a textbox in the user control which I would like to type in, capture the text_change event, and change the text of the label in the winform.
View 14 Replies
View Related
Apr 25, 2014
How do I bind a DATE column in a DataGridView Control to a DatePicker control (using C#)? I already have the DataGridView control bound to a database stored procedure which takes a DATE value as a parameter and selects joining table based on the results.
View 7 Replies
View Related
Nov 19, 2013
I am having an issue with my sort function. This is one part of the Hash table program. The main issue is that I am trying to sort the pointer table after all of the values have been entered. The ptr_sort function is not a class function and so I am therefore unable to use the class variables psize and pTable. Is there another way I should be trying this? it is a Vector should I use the sort() function from the vector class in STL?
#include "/home/onyuksel/courses/340/progs/13f/p9/util9.h"
#include "/home/onyuksel/courses/340/progs/13f/p9/hTable.h"
#ifndef H_TABLE1
#define H_TABLE1
void ptr_sort ( );
[Code] ....
View 1 Replies
View Related
Jan 25, 2013
If a user enters a string of boolean algebra it will ouput the table.
I have input parsing, cycling through the combinations, and outputing working. However once i parse the input I am not sure what to do with it. I have thought of having it write the parsed input to a new file as a function and then use that function, but that seems bad.
How to dynamically create the function, how to implement it.
BTW This is a console function, if that changes anything.
View 2 Replies
View Related
Dec 15, 2014
I have written an SQL statement that would:
1) Count the number of rows in the table booking that are open and where the booking.postcode is "MK",
2) Take a note of the plot (in booking.plot_id), and then update the table plot.jobs with the value count.
For example running the SQL query when booking table has the following rows:
Would see the following highlighted values in plot.jobs being updated to 1:
I managed to resolve it with this code so far (note I am using Connector/Net):
public void RefreshPlot(){
string query =
"SELECT Count(*) AS count, plot_id FROM booking WHERE postcode='MK' AND status='open' GROUP BY plot_id";
var cmd = new MySqlCommand(query, _connection);
var da = new MySqlDataAdapter(cmd);
var dtCounts = new DataTable();
da.Fill(dtCounts);
[code]....
Currently, my code only checks for existing rows in the booking table and updates the plot table. However if the row gets deleted in the booking, then the changes are not reflected in the plot table.
Example: If we delete the row with plot.id=1 and plot.plot_id=4, then booking.plot_id should go back to being 0, if it was initially 1. At the moment, it doesn't. How would I update my SQL statement to better reflect this? In a sense, it should check for "non-existent" rows, i.e. the impact that the row plot.plot_id=4 & plot.id=1 has on booking.plot_id when deleted?
View 6 Replies
View Related
Mar 25, 2013
I have a C# .NET Application which get data from QuickBooks via the ODBC Driver and save the result to C# data table. So, I want to transfer this data table to a mysql table on my own server. That's the code I use:
using System.IO;
using MySql.Data.MySqlClient;
//Add mysql dll on the .NET Tab in Project's references
string connStr = "DSN=QBTest;";
string myServerAddress = "192.168.0.243";
string myDataBase = "CostTest";
[Code] ....
View 2 Replies
View Related
Mar 8, 2015
I am a bit stumped with trying to write some code to get the tableadapter/binding source to "update" a current 'user' to the table.
I have the insert/delete methods working fine, but it's the updating that has got me screwed up.
Example of insert.
try
{
personTableAdapter.Insert(tFirstName.Text, tSurname.Text, Convert.ToDateTime(tDoB.Text), tPhone.Text, tAdd1.Text, tAdd2.Text, tSuburb.Text, tState.Text, tPostcode.Text, TeacherType.Text);
teacherTableAdapter.Insert(Convert.ToInt32(tTID1.Text), tRegNo.Text, tPassword.Text);
[Code]....
I also tried to do the updated string/original string with the tableadapter.update, but that didn't work either.
View 7 Replies
View Related
Aug 4, 2014
i've taken a couple courses in C Programming and all of the assignments were pretty basic. I've been looking into some of the awesome things that people have been doing with the Raspberry Pi and noticed that some of them are using the C language to control robotic arms and LEDs. I skim the code for some of these projects and notice they are using header files and code that i have never seen, nor are they in the books that i have. for example:
#include <fcntl.h>
#include <sys/mman.h>
View 2 Replies
View Related
Mar 5, 2013
how to control usb ports in visual studio C++?
View 1 Replies
View Related
Aug 23, 2013
I am using MFC (and a newbie here) and I want to retrieve values of my control array.
How can I possibly do that? This is my ControlArray
Code:
m_EditArray[0]=GetDlgItem(IDC_EDIT1);
m_EditArray[1]=GetDlgItem(IDC_EDIT2);
m_EditArray[2]=GetDlgItem(IDC_EDIT3);
m_EditArray[3]=GetDlgItem(IDC_EDIT4);
m_EditArray[4]=GetDlgItem(IDC_EDIT5);
m_EditArray[5]=GetDlgItem(IDC_EDIT6);
View 2 Replies
View Related
Jun 11, 2012
is there a way to tell WPF that I'm going to do a lengthy update on a control (TextBlock), and that it shouldn't redraw it until I tell it I'm done? I'm adding a large number of items to the Inlines property, and it has to redraw the entire control every time I add an item, which takes a very long time - about 1 second for every 100 items. I know some other frameworks allow freezing of certain controls, but I haven't been able to find anything in the documentation or on google. I've tried collapsing the TextBlock, and then making it visible again after the update, but it did not improve the performance at all.
View 6 Replies
View Related
Nov 11, 2013
I've to use SIGNALS to control threads. Here's my code without the use of signals as I'm no good at that
Code:
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
}
[code]....
View 4 Replies
View Related
Jan 28, 2013
How do I add files to a tree control. I have all the directory and sub directorys ..need the files to
Heres the code
CFileFind fd ;
if ( path.Right ( 1 ) != "" )
path += "" ;
path += "*.*" ;
BOOL found ;
found = fd.FindFile ( path ) ;
[Code] .....
View 1 Replies
View Related
Feb 22, 2013
I am running some simulation, in which i need to control the iterator of a multimap, like
multimap<double, int> mapp;
......
int n=6;
for(int i=0; i<5; i++) {
for(auto it = mapp.begin()+i*n; it!=mapp.begin()+(i+1)*n; it++) {
......
However this way of controlling is not possible for multimap. Why and how the make it work? Do I need to overload the operator +?
View 14 Replies
View Related
May 6, 2014
is there any way to have the program control go some two paths at once? For example: if my program has two functions, one that does some simple calculation that requires nothing from outside it to set the variables and another that displays text for the user to read then enter something. Is there any way to have both run at the same time?
simpleFnc()
{int a = 1;
int b = 2 ;
int c = a+b ;
[code]....
There is no connection of simplefnc to anywhere else in the program so is there any way to get it to run at the same time the other function is running?
View 4 Replies
View Related
Aug 19, 2014
how I could use a Image control where I can upload an image to a folder(done that) and then take that image right after uploading it (in the same line of code) view it on the image control...
View 5 Replies
View Related
Sep 23, 2014
I have been trying to make a custom control(list box with more features). I know how to setup custom properties, but how do I make it so that the property can be edited in a separate window ?
I think I figured out how to show the form itself, and I don't know how to make the [...] button like :
There's not much Custom Control tutorials out there, and that's really the problem here.
View 1 Replies
View Related
Mar 1, 2014
i used a tab control to open form when user clicks on button of required form.. now the problem is that if form open once it can b again open using its button... how can i stop this re open problem?
View 10 Replies
View Related
May 17, 2013
I have implemented a copy control version of binary tree.. As I am a Beginner. I think i have made my mistake.
Code:
#include <iostream>
#include <string>
class TreeNode{
TreeNode(const std::string &val):value(val),count(new int(1)){}
TreeNode(const TreeNode& rhs):value(rhs.value),count(count),left(rhs.left),right(rhs.right){++*count; }
[Code] ......
View 11 Replies
View Related
Nov 3, 2013
Code:
/*Currency Conv Control Module*/
#include <stdio.h>
#include "currencyconv.h" /* defines constants, declares functions */
int main(void) {
float us_dollars;
float currency;
int user_input;
[Code] ....
This is $$ converter program I created that is split up over 3 files. It takes the users input in US Dollars and converts it to the currency selected. When executing the program I am encountering a small problem. It actually isn't converting anything and returns 0.00 dollars.
I would like for it to convert the amount entered into the currency selected. I would also like to add in the print statement the type of currency the user has selected.
View 3 Replies
View Related
Jan 4, 2014
I would like to make a program for final project, which can let me send any file to my computer at home, and i can access any files in my computer when i am not at home.sending and getting file will be with socket programming.
i would like to reach all folders in computer, not only the folder, where client program exist. how can i access other folders at remote computer by using my program?
View 4 Replies
View Related
Jul 18, 2014
I am having trouble understanding what I need to do to halt the flow of a program until a video file finishes playing. So far I have accomplished getting the video to play, but the program continues while the video is playing rendering the content of the program on top of the video making it not seen.
My goal is to make the video play, then once it has finished the rest of the program should run.
So far I have this in the start up area of my code:
//Initialize components for DirectShow to stream a video at start-up
CoInitialize(NULL);
//creates filter graph manager
[Code].....
After this code runs once, the program proceeds immediately into the loop where my update and render functions for the program runs. Preferably, I want to stop just the render function while allowing the update to continue to check if the user presses a key to skip the video. What do I need to add to the code to do this?
View 1 Replies
View Related