16,018,264 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Afnan_ (Top 42 by date)
Afnan_
25-Mar-14 2:08am
View
Okay, I'll look in to that.
Thank you for all your comments.
Afnan_
24-Mar-14 16:17pm
View
Thank you but I already read the error message and the file does exist and the extension is provided. If you have noticed I'm running the command within the directory itself "main@C4C:~/Junoworkspace/testmillion$ mpirun -np 4 testmillion", so it's pointing to the directory.
Afnan_
24-Mar-14 7:42am
View
I did try it and this is what I get an error:
main@C4C:~/Junoworkspace/testmillion$ mpirun -np 4 testmillion [proxy:0:0@C4C] HYDU_create_process (./utils/launch/launch.c:69): execvp error on file testmillion (No such file or directory) [proxy:0:0@C4C] HYDU_create_process (./utils/launch/launch.c:69): execvp error on file testmillion (No such file or directory) [proxy:0:0@C4C] HYDU_create_process (./utils/launch/launch.c:69): execvp error on file testmillion (No such file or directory) [proxy:0:0@C4C] HYDU_create_process (./utils/launch/launch.c:69): execvp error on file testmillion (No such file or directory)
Afnan_
23-Mar-14 15:24pm
View
It is "mpi.h", i just mistyped it here.
Afnan_
23-Mar-14 12:48pm
View
I did try this command and this is what I get:
main@C:~/Junoworkspace/testmillion$ mpicc test.c -o testmillion
test.c:33:17: warning: extra tokens at end of #include directive [enabled by default]
test.c:33:18: fatal error: mpi.h: No such file or directory
compilation terminated.
Although mpi.h is in the directory
Afnan_
23-Mar-14 12:16pm
View
No, I run my code using the run button on eclipse. Although I have a problem with configuring the run configuration for a MPI project.
Afnan_
23-Mar-14 11:21am
View
I was following this example: http://condor.cc.ku.edu/~grobe/docs/intro-MPI-C.shtml
Afnan_
23-Mar-14 11:09am
View
I am not using threads.
Afnan_
23-Mar-14 11:07am
View
I don't use commands to run the application, I just run it from the run button on Eclipse
Afnan_
16-Feb-14 9:21am
View
Deleted
After debugging, we have reached the following conclusion:
The Method_Encryption is causing all the problems (shared variables are being accessed at the same time causing this issue. So we are going to lock (using mutex)the variables inside the method rather than on the structs.
Afnan_
16-Feb-14 9:14am
View
After debugging, we have reached the following conclusion:
The Method_Encryption is causing all the problems (shared variables are being accessed at the same time causing this issue). So we are going to lock (using mutex)the variables inside the method rather than on the structs.
Afnan_
15-Feb-14 12:50pm
View
I'll look into your solutions,hopefully they'll solve the issue.
Thank you
Afnan_
15-Feb-14 12:47pm
View
We used to think that if we call the first join after the first thread it will solve the problem, fix the racing issue, but it didn't. I don't know what line is causing the issue,it is just one of the guesses, plus if I knew I would have solved the issue :).
What doesn't make sense is that, this problem happens only when the size of the file is BIG. Also, what doesn't make sense is:
- each thread has its own struct passed to the encryption method (ourStruct args[Chunks]--> array of structs).
- each thread result is stored in a different array index (don't share storage)
Afnan_
15-Feb-14 6:05am
View
Yes, at the beginning we consider that and we converted all of them to be thread safe but the issue remained.
Afnan_
15-Feb-14 5:57am
View
Yes, they are racing but how to control it?
I very new to threads, so any help would be appreciated.
Afnan_
14-Feb-14 4:15am
View
I have posted the code.
Afnan_
14-Feb-14 4:14am
View
I have posted the code.
Afnan_
14-Feb-14 4:14am
View
I have posted the code.
Afnan_
13-Feb-14 1:53am
View
Deleted
This is the part of the code that has the problem:
void Encryption()
{
int i = 0, j = 0, rc=0;
ourStruct args[Chunks];
pthread_t thread[Threads];
ReadOurFile();
counter = 0;
for (j = 0; j <= numOfChunks; j++)
{
for (i = 0; i < numOfRows; ++i)
{
args[j].plainText[i] = InPut[j][i];
args[j].FinalKey[i] = FinalKey[j][i];
}
args[j].index = counter;
counter++;
}
for (j = 0; j <= numOfChunks; j=j+2)
{
rc = pthread_create(&thread[0], NULL, Method_Encryption, &args[j]);
rc = pthread_create(&thread[1], NULL, Method_Encryption, &args[j+1]);
rc = pthread_join(thread[0], NULL);
rc = pthread_join(thread[1], NULL);
}
//writing the output to a file
}
The method is:
void * Method_Encryption(void *arguments){
.
.
.
StructInside *args = (StructInside *)arguments;
//setting the received arguments into plaintext and key
for (i = 0; i < numOfRows; ++i)
{
plainText[i] = args->plainText[i];
FinalKey[i] = args->FinalKey[i];
}
.
.
.
//store results
for (i = 0; i < numOfRows; ++i)
OutPut[args->index][i] = plainText[i];
}
The output is filled inside an array of output inside the method. The array is indexed by the order.
numOfChunks ==the number of chunks I'm reading from the file. For example: if the file is of size 100 characters, and each chunk will be of size 5 characters, then:
numOfChunks=100/5
We also tried using mutex inside the struct and initialize the mutex and lock it inside the method and afterwards unlocking and destroying the mutex but it didn’t work, or maybe we didn’t implement it correctly.
Afnan_
11-Feb-14 16:49pm
View
I'll try to post some code.
Afnan_
11-Feb-14 16:48pm
View
yes, I've also posted a comment to it.
Afnan_
11-Feb-14 16:47pm
View
No, data manipulation is correct because:
1. most of the file is decrypted correctly.
2. when I run the code without threads I get the right results (the whole file is decrypted correctly).
3. these incorrect results happen at random places, as in, sometimes at the beginning of the file, some times in the middle or at the end, when I run the threads.
We are using C because it is more secure and faster.
Afnan_
11-Feb-14 16:39pm
View
My question is:
I encrypt a file and then decrypt it using these two threads to speed the process. The decryption runs fine on most of the file, only some chunks of the file are decrypted incorrectly (the actual plain-text isn't returned/decrypted correctly). This problem happens ONLY when the size of the file is big.
So the code runs fine but at some point the threads cause incorrect results, random data is returned as results.
Afnan_
11-Feb-14 16:22pm
View
I encrypt a file and then decrypt it using these two threads to speed the process. The decryption runs fine on most of the file, only some chunks of the file are decrypted incorrectly (the actual plain-text isn't returned/decrypted correctly). This problem happens ONLY when the size of the file is big.
Afnan_
2-Dec-13 0:48am
View
This is a snapshot of the code, that I'm having a problem with:
Note:
pixels16 is of type List<ushort>
private void CreateBitmap()
{
bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format48bppRgb);
BitmapData bmd = bmp.LockBits(new Rectangle(0, 0, width, height),
System.Drawing.Imaging.ImageLockMode.ReadOnly, bmp.PixelFormat);
// This 'unsafe' part of the code populates the bitmap bmp with data stored in pixel16.
// It does so using pointers, and therefore the need for 'unsafe'.
unsafe
{
int pixelSize = 3;
int i, j, j1, i1;
ushort b;
ushort sVal;
double lPixval;
for (i = 0; i < bmd.Height; ++i)
{
ushort* row = (ushort*)bmd.Scan0 + (i * bmd.Stride);
i1 = i * bmd.Height;
for (j = 0; j < bmd.Width; ++j)
{
sVal = (ushort)(pixels16[i1 + j]);
b = (ushort)(sVal);
j1 = j * pixelSize;
row[j1] = b; // Red
row[j1 + 1] = b; // Green
row[j1 + 2] = b; // Blue
}
}
}
bmp.UnlockBits(bmd);
}
Afnan_
2-Dec-13 0:36am
View
First, thank you and BillWoodfuff for your replies.
I totally understand the "grayscale" concept and regarding the first part of your answer, what I meant by "scanned" as in read from the BMP.
I agree that 16 bits is overkill and that's what I'm trying to explain to my client but he is insisting on first displaying it as a 16-bit (48bpp) then convert it to a 8-bit.
I've succeeded in converting it to 8-bit but now I want to draw it as 16-bit (48bpp).
In the last part of your answer, you said that "entries are always 32-bit in the BMP image format" you mean BMP doesn't support 48-bit? How can I know what number of bits supported in each image type( jpg, png ...etc?
Afnan_
3-Jul-13 18:24pm
View
Okay, I've checked that and the user(dbo, which is the sysadmin) has the permissions
dbo user already has the permissions of db_datareader and db_datawriter.
I've tested other databases on web applications and run fine. What I've noticed on windows applications is that as soon as I start running the application, the database connection is disconnected(red x appears on the database).
Afnan_
3-Jul-13 2:50am
View
If you mean permissions on the folder it self, then yes it has full control. i work on the embedded SQL severer 2008 in Visual Studio 2010, so where exactly can I check on the permissions.
Searched the internet and this is what I found(http://msdn.microsoft.com/en-us/library/ms189612(v=sql.105).aspx) do you mean this?
Afnan_
2-Jul-13 15:13pm
View
I really don't know what the issue is.
Afnan_
2-Jul-13 15:06pm
View
No permission was modified or changed I'm working on the default settings, the App.config file has only the connection string.
Afnan_
2-Jul-13 14:58pm
View
The record isn't deleted from the database.
Afnan_
28-May-12 14:31pm
View
A friend has told that the issue was in the saving itself.The data was sent to the database as ???? and the cause of that was because I'm using Ajax in my pages
Bt II really don't know how to solve this issue, because I need the Ajax in my pages.
Afnan_
19-Mar-12 4:34am
View
Thank you for your reply,
But "GeekGirl.doc" does it already exist?Because you used the open method.
If so,then that might help,but what I need is to work on the current document content and not something saved.I don't wnat to save it in the filestream.
Afnan_
9-Jan-12 1:40am
View
Thank you very much I adjusted your code with my asp framwork and now it is working like a charm.
Wish you all the best.
<3 <3
Afnan_
8-Jan-12 8:56am
View
I have sent you the code,thank you in advance.
:)
Afnan_
8-Jan-12 3:56am
View
I have tried to post the code ,but only part of the code appears, because here the text to post is limited.
Afnan_
8-Jan-12 3:49am
View
Deleted
This is the .aspx file
___________________________
<%@ Page Language="C#" MasterPageFile="~/AdminBookStore.master" AutoEventWireup="true"
CodeFile="ManageCategoriesPage.aspx.cs" Inherits="ManageCategoriesPage" Title="Manage Categories Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<ajax:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
<script type="text/javascript">
/*-----------------------------------------------------------*/
var TotalChkBx;
var Counter;
window.onload = function()
{
//Get total no. of CheckBoxes inside the GridView.
TotalChkBx = parseInt('<%= this.gvManageCategories.Rows.Count %>');
//Get total no. of checked CheckBoxes in side the GridView.
Counter = 0;
}
/*-----------------------------------------------------------*/
function HeaderClick(HCheckBox)
{
//Get target base & child control.
var TargetBaseControl = document.getElementById('<%= this.gvManageCategories.ClientID %>');
var TargetChildControl = "chRowSelect";
//Get all the control of the type INPUT in the base control.
var Inputs = TargetBaseControl.getElementsByTagName("input");
//Checked/Unchecked all the checkBoxes inside the GridView.
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
Inputs[n].checked = HCheckBox.checked;
//Reset Counter
Counter = HCheckBox.checked ? TotalChkBx : 0;
}
/*-----------------------------------------------------------*/
function ChildClick(RCheckBox, HCheckBox)
{
//get target base & child control.
var HeaderCheckBox = document.getElementById(HCheckBox);
//Modifiy Counter;
if(RCheckBox.checked && Counter < TotalChkBx)
Counter++;
else if(Counter > 0)
Counter--;
//Change state of the header CheckBox.
if(Counter < TotalChkBx)
HeaderCheckBox.checked = false;
else if(Counter == TotalChkBx)
HeaderCheckBox.checked = true;
}
/*-----------------------------------------------------------*/
function bConfirm()
{
var bValidDelete=false;
var lblValidate = document.getElementById('<%= this.lblValidate.ClientID %>');
var TargetBaseControl = document.getElementById('<%= this.gvManageCategories.ClientID %>');
var TargetChildControl = "chRowSelect";
//Get all the control of the type INPUT in the base control.
var Inputs = TargetBaseControl.getElementsByTagName("input");
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].checked==true)
{
bValidDelete = true;
break;//At least one is checked
}
if(bValidDelete)
if (confirm("Are you sure you want to delete selected categories")==true)
{
return true;
}
else
{
//Get target base & child control.
//Checked/Unchecked all the checkBoxes inside the GridView.
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox')
Inputs[n].checked = false;
lblValidate.Visible = false;
//Form1.submit(); //Force postback
//return false;
}
else
{
lblValidate.style.display = "";//To display the text(un-hide)
return false; //Used to stop the postback
}
}
/*---------------------
Afnan_
8-Jan-12 3:46am
View
Deleted
This is the .aspx file:
<%@ Page Language="C#" MasterPageFile="~/AdminBookStore.master" AutoEventWireup="true"
CodeFile="ManageCategoriesPage.aspx.cs" Inherits="ManageCategoriesPage" Title="Manage Categories Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<ajax:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
<script type="text/javascript">
/*-----------------------------------------------------------*/
var TotalChkBx;
var Counter;
window.onload = function()
{
//Get total no. of CheckBoxes inside the GridView.
TotalChkBx = parseInt('<%= this.gvManageCategories.Rows.Count %>');
//Get total no. of checked CheckBoxes in side the GridView.
Counter = 0;
}
/*-----------------------------------------------------------*/
function HeaderClick(HCheckBox)
{
//Get target base & child control.
var TargetBaseControl = document.getElementById('<%= this.gvManageCategories.ClientID %>');
var TargetChildControl = "chRowSelect";
//Get all the control of the type INPUT in the base control.
var Inputs = TargetBaseControl.getElementsByTagName("input");
//Checked/Unchecked all the checkBoxes inside the GridView.
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
Inputs[n].checked = HCheckBox.checked;
//Reset Counter
Counter = HCheckBox.checked ? TotalChkBx : 0;
}
/*-----------------------------------------------------------*/
function ChildClick(RCheckBox, HCheckBox)
{
//get target base & child control.
var HeaderCheckBox = document.getElementById(HCheckBox);
//Modifiy Counter;
if(RCheckBox.checked && Counter < TotalChkBx)
Counter++;
else if(Counter > 0)
Counter--;
//Change state of the header CheckBox.
if(Counter < TotalChkBx)
HeaderCheckBox.checked = false;
else if(Counter == TotalChkBx)
HeaderCheckBox.checked = true;
}
/*-----------------------------------------------------------*/
function bConfirm()
{
var bValidDelete=false;
var lblValidate = document.getElementById('<%= this.lblValidate.ClientID %>');
var TargetBaseControl = document.getElementById('<%= this.gvManageCategories.ClientID %>');
var TargetChildControl = "chRowSelect";
//Get all the control of the type INPUT in the base control.
var Inputs = TargetBaseControl.getElementsByTagName("input");
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].checked==true)
{
bValidDelete = true;
break;//At least one is checked
}
if(bValidDelete)
if (confirm("Are you sure you want to delete selected categories")==true)
{
return true;
}
else
{
//Get target base & child control.
//Checked/Unchecked all the checkBoxes inside the GridView.
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox')
Inputs[n].checked = false;
lblValidate.Visible = false;
//Form1.submit(); //Force postback
//return false;
}
else
{
lblValidate.style.display = "";//To display the text(un-hide)
return false; //Used to stop the postback
}
}
/*------------------------------------------------
Afnan_
4-Jan-12 8:34am
View
Point#1 didn't work.I get this message " Validation(ASP.Net):Attribute 'ClientIDMode' is not a valid attribute of element 'CheckBox'".I'm working on ASP.NET 2.0
Point#2 and 3 give same error.
Afnan_
4-Jan-12 8:17am
View
Hello,
Thank you ,but I already have checked this site and none of its solutions solved my error.
Setting <%@Page EnabledEventValidation ="true"%> to false,It only makes things worse.
My binding is insida a IF NOT ISPOSTBACK.
I only have one updatepanel.
Afnan_
4-Jan-12 7:38am
View
I will try all your solutions.
:)
Afnan_
4-Jan-12 7:18am
View
Hey incaunu,
Thank you for replying,When I saw your reply I felt like there was still hope.Because I'm really desperate.
Point 2 and 3 I have tried them but didn't solve the issue.I going to give it another try by doing the three points together.
Yes,I do have checkbox.I use them for multidelete.
Thank you again.
Show More