I would like to generate permutations of string words that are inputted from a file. I know the count and was wondering if there is an easy way to do this using an arraylist.
I am currently upgrading our software to support ipv6 and in the meantime I'm expanding hostname/ip fields to the max hostname size. In sun documentation it seems like this can be up to 1025 (netdb.h:#define NI_MAXHOST 1025 - this is the recommended hostname allocation define), but when I pass a hostname of over 255 to getaddrinfo I get "getaddrinfo failed: memory allocation failure". I am testing on a Sol10 box. Ideas?
Hi,
When we start a server application, we always need to speicify the port number it listens to. But how is this "listening mechanism" implemented under the hood?
My current imagination is like this:
The operating system associate the port number with some buffer. The server application's responsibiligy is to monitor this buffer. If there's no data in this buffer, the server application's listen operation will just block the application.
When some data arrives from the wire, the operating system will know that check the data and see if it is targed at this port number. And then it will fill the buffer. And then OS will notify the blocked server application and the server application will get the data and continue to run.
Question is:
If the above scenario is correct, how could the opearting system know there's data arriving from wire? It cannot be a busy pooling. Is it some kind of interrupt-based mechanism?
If there's too much data arriving and the buffer is not big enough, will there be data loss?
Is the "listen to a port" operation really a blocking operation?
Many thanks.
So, C# 4.0 came out yesterday. It introduced the much-debated dynamic keyword, named and optional parameters. Smaller improvements were the implicit ref and recognizing of indexed and default properties on COM methods, contra- and co-variance (really a .NET CLR feature, not C# only) and...
Is that really it? Are dynamic and optional/named params the only real improvements to C#? Or did I miss something? Not that I'm complaining, but it seems a bit meager after C# 2.0 (generics) and C# 3.0 (lambda, LINQ). Maybe the language just reached actual maturity?
Can I use compiler from VS 2010 while using VS2008? The reason for that is that VS 2010 really pisses me of with its sluggines and other not less irritating things.
My sapi grammar file looks like
<RULE NAME="SOUNDLOG" TOPLEVEL="ACTIVE">
<O> Please </O>
<O> Enter</O>
<P>
Name
</P>
<P>
<RULEREF REFID="VID_InputType" />
</P>
</RULE>
<RULE ID="VID_InputType">
<L PROPID="VID_InputType">
<P >John</P>
<P>Jill</P>
<P>Gary</P>
</L>
How do I get the name when it is recognized by sapi recognizer?
I have two separate areas in my form.
Left side for radio buttons, combo boxes, etc.
Right side for tabs and even tabs within tabs.
For each tab selected, I'd like to display different controls on the left side for use in that tab.
I've tried using many things, including focus, click, etc. Nothing seems to work the way I intend it to. Especially on the tabs within the tabs.
Thank you.
I've finished my thesis and now having a free time. I intend to learn another language, and Python seems to be a good choice. I'll probably have to use .NET for every day works, but I heard that Python helps programmer a lot, in mean of automation. That would be great if I can write "small" Python scripts to do something automatically.
From a programmer's perspective, which is your everyday Python's uses? What did it do to have your works done?
Hi everyone,
I'm trying to compile a simple Kernel program that read and write from a proc file.
I'm trying to set permission to that file by overriding the permission fp in inode_operations struct (.permission)
static int module_permission(struct inode *inode, int op, struct nameidata *foo)
{
. . .
}
static struct inode_operations Inode_Ops_4_Our_Proc_File = {
.permission = module_permission, /* check for permissions */
};
Our_Proc_File->proc_iops = &Inode_Ops_4_Our_Proc_File;
For some reason, when I compile this i get - warning: initialization from incompatible pointer type on the following line:
.permission = module_permission, /* check for permissions */
Any idea how to solve this?
Thanks!
I'd like to run a program on a directory of files. I know how to do this with one file, using
cat myFile.xml | myProgram.py.
How can I run myProgram.py over a folder, say myFolder?
Thanks!
Hey,
I'm new in the developer business, and I'm interested in the way, how other programmers start to develop, design an application.
What are the factors, I should keep when I sit down and start thinking about the app? How do you do it?
I'm really interested, because I think the design, and the main thoughts of an application affect the future of it.
I have a problem with this code.
What I am looking for in the code is to get the result of "first" and "second" randomly and put the result in a file.
It works great if I run it without using the file and I get all the correct results, but when I try to save the result in the file, I get only the first node which contains (first, secnd).
Here is the code:
#include<iostream>
#include <fstream>
#include<cmath>
using namespace std;
void main()
{
int first[100],secnd[100];
for (int i=0; i<100 ;i++)
{
first[i]=rand()%500; //random number from to 499
secnd[i]=rand()%500; //random number from to 499
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile <<first[i]<<" "<<secnd[i];
myfile.close();
}
}
I'm trying to modify a stored procedure used in an ASP.NET page.
By default, the stored procedure returns all of the data, which can be overwhelming for employees in the plant.
I want to add a drop down menu item for the column name and a text box for a value to allow our employees to search the data for their specific items.
What I would like to add is the ability to pass in a Column Name and Column Value to search, similar to the following:
DECLARE @colName nVarChar(50), @colValue nVarChar(50)
SET @colName='EmployeeID'
SET @colValue='007135'
SELECT Column1, Column2, Column3, Column4, Column5, Column6, Column7
FROM viewNum1
WHERE ((@colName IS NULL) OR (@colValue IS NULL) OR ('['+@colName+']'=@colValue))
If all values passed in (@colValue and @colName), all records return; however, if I try specifying that @colName=EmployeeID and @colValue='007135' (a value that does exist in the database), no records are returned.
Next is the problem that I am running an old SQL Server 2000 database that does not allow the stored procedure to access the table column names, and the whole technique looks prone to SQL Injection.
Finally, I don't see how to bind my GridView control to this and still have the ability to display all records.
How would I write such a filtering stored procedure?
I have a List and want to reduce it to a single value (functional programing term "fold", Ruby term "inject"), like
Arrays.asList("a", "b", "c") ... fold ... "a,b,c"
As I am infected with functional programing ideas (Scala), I am looking for an easier/shorter way to code it than
sb = new StringBuilder
for ... {
append ...
}
sb.toString
I have written the following code after creating the CRichEditCtrl
// 06112010 : The following code was added to highlight the textselection in black color instead of the default blue color of CRichEditCtrl. - 1311
{
m_EditControl.SetSel(0,100);
CHARFORMAT2 cf1;
cf1.cbSize = sizeof(CHARFORMAT2);
m_EditControl.GetSelectionCharFormat(cf1);
cf1.dwMask = CFM_BACKCOLOR ;
cf1.dwEffects &= ~CFE_AUTOBACKCOLOR;
cf1.crBackColor = RGB(0,0,0);
m_EditControl.SetSelectionCharFormat(cf1);
m_EditControl.Invalidate();
}
After this I am adding text, but the selection still comes in blue color instead of Black. Could someone please tell me what I am doing wrong??
Thanks,
DeV
I am about to give up debugging SMTP servers to send email... My code is the following
private void SendMail()
{
SmtpClient mailClient = new SmtpClient("smtp.mail.yahoo.com", 465);
mailClient.EnableSsl = true;
MailMessage message = new MailMessage();
message.To.Add("[email protected]");
message.Subject = "i wish it would work";
MailAddress fromAddress = new MailAddress(Email.Text, Name.Text);
message.From = fromAddress;
mailClient.Send(message);
}
Hi ,
How to connect the android phone to Windows Laptop. I tried connecting. but it is showing pairing but never pair.
Please let me know the steps to configure the same on windows laptop.
Regards
Gururaja b O
I feel like this should be fairly obvious, or easy, but I just can't get it. What I want to do is apply a function to a list (using map) but only if a condition is held. Imagine you only wanted to divide the numbers which were even:
map (`div` 2) (even) [1,2,3,4]
And that would give out [1,1,3,2] since only the even numbers would have the function applied to them. Obviously this doesn't work, but is there a way to make this work without having to write a seperate function that you can give to map? Filter is almost there, except I also want to keep the elements which the condition doesn't hold for, and just not apply the function to them.
Thanks
im trying to embed flash in my program by placing flash.ocx in my app's folder without having to register it. i found DirectCom.dll and with this code i can show the right version of flash.
but how do i show it on the form and load the movie?
Private Declare Function GetInstanceOld Lib "DirectCom" Alias "GETINSTANCE" (FName As String, ClassName As String) As Object
Dim ShockwaveFlash1 As Object
Set ShockwaveFlash1 = GetInstanceEx(StrPtr(App.Path & "\" & "flash.ocx"), StrPtr("ShockwaveFlash"), True)
MsgBox ShockwaveFlash1.FlashVersion
How do I declare the types of the parameters in order to circumvent type checking?
How do I optimize the speed to tell the compiler to run the function as fast as possible like (optimize speed (safety 0))?
How do I make an inline function in Scheme?
How do I use an unboxed representation of a data object?
And finally are any of these important or necessary? Can I depend on my compiler to make these optimizations?
thanks,
kunjaan.
I converted all my other projects fine from VS 2008 to 2010 and they run great. There is one project however for some reason after converting, when I try to run one of the .aspx pages in it, I get nothing...no error, just that it cannot display the page.
Nothing has changed. The path is still the same, and the IIS website is still the same. I even recreated the site in IIS using the VS option to create it in the web project properties.
This is a testing project..only has like one .aspx in it.
Not sure why I get nothing after converting this. I did not convert it to .NET 4.0, it's still in v3.5 in VS 2010.
Can anyone list the specific and detailed steps to configure mc.exe (the message compiler) to compile a .mc file into a .rc file as a custom compiler step in VC++ 2010?
I am really lost on how to do this.