My friends and I went on a trip and we have over 8 GB of photos we want to share. We live in different geographic locations and all of us (14 people) have a part of the 8 GB.
I was wondering if there's a way to leverage my php skills to share all these photos. My current plan is to make a simple site that you can upload a bunch of files and also list those files for people to download (probably a compressed folder of a bunch of selected ones) but was wondering if there's a better way or if I'm grossly underestimating scalability issues.
All of us have high speed internet (essentially T1) and I was planning on using Amazon EC2 since this is a heavy task but for a short time period. That's also the reason I can't use dropbox or similar services since they have a 2GB cap (and I don't want to have everyone sign up and install something). I also don't want to set up anything too tricky since not all of them are tech savvy.
I just looked into wikipedia's entry on out-of-band data and as far as I understand, OOB data is somehow flagged more important and treated as ordinary data, but transmitted in a seperate stream, which profoundly confuses me.
The actual question would be (besides "Could someone explain what OOB data is?"):
I'm writing a unix application that uses sockets and need to make use of select() and was wondering what to do with the exceptfds parameter? Do I need to put all my sockets into this parameter and react to such events? Or do I just ignore them?
Write a program to read in a file containing the names of the employ of a company and store them in an array of Strings named Employ []. Read another file containing the Salaries of each employ written in the same order and store them in another array of integers named salary[] (contents of both files are shown below). Finally create a file stating for example. Mr. XYZ receive $75,500.00 per year
(Note that salary is stored as integer but displayed here as double with a comma separating thousands. This formatting needs to be done using DecimalFormat Class)
Take the following code in C/C++, for example:
int foo[] = {0, 0, 0, 0};
No magic numbers, right?
Now, the Python "equivalent" of that would be:
foo = [0, 0, 0, 0]
Still no magic numbers.
However, in Python, that same thing can be written like this:
foo = [0] * 4
And now we DO have a magic number. Or do we?
I'm guessing this and other similar things are present on these and other languages.
Hi all,
This a follow up on my previous question. link here.
My question is: Let's say I have the following code..
char* buf = (char*) malloc(1024);
...
for(; i<20; i++) {
if(read(fd, buf, 1024) == -1) { // read off a file and store in buffer
perror("read failed");
return 1;
}
...
}
free(buf);
what i'm trying to get at is that - what if an error occurs at read()? does that mean my allocated memory never gets freed? If that's the case, how do I handle this? Should I be calling free() as part of error handling?
Once again, I apologize for the bad English. ^^;
Many thanks, K.
When it comes to coding style I'm a pretty relaxed programmer. I'm not firmly dug into a particular coding style. I'd prefer a consistent overall style in a large code base but I'm not going to sweat every little detail of how the code is formatted.
Still there are some coding styles that drive me crazy. No matter what I can't look at examples of these styles without reaching for a VIM buffer to "fix" the "problem". I can't help it. It's not even wrong, I just can't look at it for some reason.
For instance the following comment style almost completely prevents me from actually being able to read the code.
if (someConditional)
// Comment goes here
{
other code
}
What's the most frustrating style you've encountered?
int KMP( const char *original, int o_len, const char *substring, int s_len ){
if( o_len < s_len )
return -1;
int k = 0;
int cur = 1;
int fail[ s_len ];
fail[ k ] = -1;
while( cur < s_len ){
k = cur - 1;
do{
if( substring[ cur ] == substring[ k ] ){
fail[ cur ] = k;
break;
}else{
k = fail[ k ] + 1;
}
}while( k );
if( !k && ( substring[ cur ] != substring[ 0 ] ) ){
fail[ cur ] = -1;
}else if( !k ){
fail[ cur ] = 0;
}
cur++;
}
k = 0;
cur = 0;
while( ( k < s_len ) && ( cur < o_len ) ){
if( original[ cur ] == substring[ k ] ){
cur++;
k++;
}else{
if( k == 0 ){
cur++;
}else{
k = fail[ k - 1 ] + 1;
}
}
}
if( k == s_len )
return cur - k;
else
return -1;
}
This is a KMP algorithm I once coded. When I reviewed it this morning, I find it strange that an integer array is defined as int fail[ s_len ]. Does the specification requires dimesion of arrays compile-time constant? How can this code pass the compilation?
By the way, my gcc version is 4.4.1.
Thanks in advance!
I really want to learn how to program. A friend suggested I buy vs 2005 or a newer version if I'm serious about it. Is there a cheaper route? I would like to start with c#.
Hello! I am an engineering student unsure of which 6-month computer-related course to take. I'm trying to decide between a .NET course or an Ethical Hacking course. Would someone care to share some insight with me?
Cheerio!
I am looking at several projects, all with roughly the same fucntionality.
Some instruments collect some data (or control some functionality). They commmunicate by Internet (Etehrnet/wifi/GPRS/sasatellite) with a databse server which stores the measurements and provides a browser based means of qeurying the data, prodcuing reports, etc (and possibly also allows control of the remote equipment).
Can anyone recommend a good book describing an approach to developing such a software architecture, keeping it generic, which tools, languages. test methods, etc to use?
(note to self: ask a similar question about possible existing frameworks)
In which languages other than C are virus programs created? Is it true that most of the antivirus software companies themselves program new viruses for sustaining their market value?
I'm new to AOP so bear with me. Consider the following scenario:
A state machine is used in a workflow engine, and after the state of the application is changed, a series of commands are executed. Depending on the state, different types of commands should be executed.
As I see it, one implementation is to create List<IAction> and have each individual action determine whether it should execute.
Would a Aspect Oriented process work as well? That is, could you create an aspect that notifies a class when a property changes, and execute the appropriate processes from that class? Would this help centralize the state specific rules?
Dear all,
I'm trying to create my own DLL... I used wizzard in VS2008 to create template for DLL. This works fine and the dll builds successfully (Test.dll is created).
BUT, when I rename the file from Test.cpp to Test.c (which I guess causes compilation in C-mode), solution rebuilds also successfully, but no .dll is created. The list of all created files follows:
mt.dep
BuildLog.htm
vc90.idb
Test.dll.embed.manifest
Test.dll.intermediate.manifest
Test.obj
MySecondCFile.obj
vc90.pdb
Test.dll.embed.manifest.res
For my purposes it's essential that the dll be in C not C++, while I already have a lot of code written in C, which does not compile as C++.
Do you know, why .dll is not created? What should I do?
I have data in the form of four columns. The first three columns represent time, value1, value 2. The fourth column is binary, all 0's or 1's. Is there a way to tell excel to delete time, value1 and value 2, when the corresponding binary value in column four is 0? I know this is a lot easier in C++ or matlab, but for reasons beyond my control, I must do it in excel.
I am trying to execute the SQL statement from my java application
Due website restriction on url I have replaced http=htp for this post.
SELECT DISTINCT(DID)
FROM (SELECT e_id DID,
xml_doc xml,
rownum rn from employee_master_indexes)," +
" table(XMLSequence(extract(xml,'//cf:SalesReport/ext:Sales/*//j:PersonAssignedIDDetails/j:PersonID/j:ID',"+
"'xmlns:j=\" htp://www.it.jvp.com/xmm/3.0.3\"
xmlns:xsi=\" htp://www.w3.org/2001/XMLSchema\" " +
"xmlns:ext=\" htp://xml.crossflo.com/xdm/3.0.3/extension\"
xmlns:cf=\" htp://xml.crossflo.com/xdm/3.0.3\" ')))EMPID" +
"WHERE extractValue(value(EMPID),'/j:ID', 'xmlns:j=\" htp://www.it.jvp.com/xmm/3.0.3\"') LIKE '%-%-%' AND rn BETWEEN 999 AND 2001";
but end up with
10/05/24 11:11:51 java.sql.SQLException: ORA-00933: SQL command not properly ended
10/05/24 11:11:51 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
10/05/24 11:11:51 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
10/05/24 11:11:51 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
10/05/24 11:11:51 at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
10/05/24 11:11:51 at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:113)
10/05/24 11:11:51 at oracle.jdbc.driver.T4CStatement.execute_for_describe(T4CStatement.java:431)
10/05/24 11:11:51 at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:1029)
10/05/24 11:11:51 at oracle.jdbc.driver.T4CStatement.execute_maybe_describe(T4CStatement.java:463)
10/05/24 11:11:51 at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1126)
10/05/24 11:11:51 at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1274)
10/05/24 11:11:51 at oracle_jdbc_driver_T4CStatement_Proxy.executeQuery()
I am able to run this query properly on my sql prompt.Any guidance on what makes oracle give me this exception would be appreciated.
Hi,
I have read this but still not fully aware of the advantage of slice against array.So I am expecting somebody in SO explain better than it and I am sure you can :)
I have a website with Dutch text which I want to translate to English. Is there a fast way of doing this with keeping the HTML tags(<strong>,<span>) in tact. I know I can just copy the parsed TEXT into a translator but this will remove the formatting.
I also know that at the end I have to go trough the text manually to fix some minor spelling and grammar.
I need to write a Windows XP/Vista application, main requirements:
Just one .exe file, without extra runtime, like Air, .Net; posstibly a couple of dlls.
Very small file size.
The application is for network centric usage, similar to ICQ or Gtalk clients.
Thanks in advance.