What is the difference in writing to files atomically on the iPhone in objective-c and not, is there any performance difference between the two?
Thanks in advance!
I'm doing a set difference operation in Python:
from sets import Set
from mongokit import ObjectId
x = [ObjectId("4f7aba8a43f1e51544000006"), ObjectId("4f7abaa043f1e51544000007"), ObjectId("4f7ac02543f1e51a44000001")]
y = [ObjectId("4f7acde943f1e51fb6000003")]
print list(Set(x).difference(Set(y)))
I'm getting:
[ObjectId('4f7abaa043f1e51544000007'), ObjectId('4f7ac02543f1e51a44000001'), ObjectId('4f7aba8a43f1e51544000006')]
I need to get the first element for next operation which is important. How can I retain the list x in original format?
Hi,
I have 2 machines running linux.
In one machine, the reboot command is an executable normally found in all linux distributions.
In the second machine the reboot command is a shell script customized using some other hardware tool commands to reboot the system.
One behavior difference between the 2 machines is that when i execute reboot command on the first machine, it shows another shell prompt and then only reboots.
But in the case of second machine, it reboots without showing a shell prompt. I expect the second machine to behave the same way as first machine when reboot command is given.
Currently i am analyzing the source code of shutdown.c and halt.c normally found in linux distributions, so that i can find out the implementation which produces the shell propmt on reboot and use that in the shell script in second machine.
Kindly give me some pointers on where i should start looking to find the implementation.
Thanks
What is the difference when encrypting GET and POST data? Thx for answer
Edit: i need to write it more specific.
When https-SSL encrypts both of this methods, what is the difference in way browser does this.
Which parts are encrypted and which are not?
I somewhere read, that the destination url is not encrypted in POST, is that true?
If it is true and same in GET, where are all the parameters?
I want to calculate the time difference.I have three EditTexts , I want to input the times in the first two edittexts in HH:MM format. And then calculate the time difference and the result will show on third edittext field in same format.
If the date changes, the time difference will calculate according that, i.e
If first time = 23:00 and second time = 01:00
then, the time difference = 02:00 hours
public class TimeCalculate extends Activity {
private String mBlock;
private String mBlockoff;
private String mBlockon ;
// String mHours, mMinutes;
Date date1, date2;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
EditText blockoff = (EditText) findViewById(R.id.blockoff);
mBlockoff = blockoff.getText().toString();
EditText blockon = (EditText) findViewById(R.id.blockon);
mBlockon = blockon.getText().toString();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("hh:mm");
try {
date1 = simpleDateFormat.parse(mBlockoff);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
date2 = simpleDateFormat.parse(mBlockon);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mBlock = getDifference(date1, date2);
EditText block = (EditText) findViewById(R.id.block);
block.setText(mBlock.toString());
}
public static String getDifference(Date startTime, Date endTime) {
if (startTime == null)
return "corrupted";
Calendar startDateTime = Calendar.getInstance();
startDateTime.setTime(startTime);
Calendar endDateTime = Calendar.getInstance();
endDateTime.setTime(endTime);
long milliseconds1 = startDateTime.getTimeInMillis();
long milliseconds2 = endDateTime.getTimeInMillis();
long diff = milliseconds2 - milliseconds1;
/*int hours = (int)diff / (60 * 60 * 1000);
int minutes = (int) (diff / (60 * 1000)); minutes = minutes - 60 * hours;
long seconds = diff / (1000); */
//timeDiff = DateUtils.formatElapsedTime(seconds);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:MM");
Date date = new Date(diff);
return simpleDateFormat.format(date);
}
}
I executed this code ,but gives error as Source not found.I think error at getDifference method.Please give any other logic
Hi,
What is the difference between PrintStream and PrintWriter? They have much methods in common. I always mix up this classes because of that reason. And I think we can use them for exactly the same. But there has to be a difference. Otherwise there was only one class.
I first searched on StackOverflow, but not yet this question.
Thanks
I'm looking to add a bit of memory to MySQL on a Linode VPS server on which I've got a small facebook (canvas app) PHP app using MySQL running. I'm not super familiar with MySQL optimization so I'm hoping to find a simple answer. I think I want to increase the key_buffer size (the default is 16M) to something like 32M to start, but I'm not sure if I need to tweak anything else as well. All I've done so far is increase the query_cache_size to 32M from 16M.
There's also key_buffer under [mysqld] and key_buffer under [isamchk]. What are the difference between those two?
If I have Linode 2048MB (http://www.linode.com) VPS, what would recommend I set the buffers to? I don't expect this site to have tons of visitors, but I'd like it to be as optimized as possible. Definitely way more heavy on the database access than PHP and very few HTTP requests.
Hello Everyone,
What is the difference between "+" and "-" before the function name interface declaration in an iPhone program. Example:
- (void)continueSpeaking;
+ (NSArray *)availableVoices;
What's the difference?
What is the difference between VFS i-node and FS (e.g. EXT) i-node?
Is it possible that EXT i-node is persistent (contains/points to data blocks), but VFS i-node is created just in i-node cache after read/use of EXT i-node?
Or the VFS i-node is just an image of FS i-node (it's the same) and i-nodes in those systems, which are not working with i-nodes (e.g. FAT, NTFS) has to be emulated (HOW?) to allow VFS work with those FS like they would support i-nodes?
Normally with a virtual host an ssl is setup with the following directives:
Listen 443
SSLCertificateFile /home/web/certs/domain1.public.crt
SSLCertificateKeyFile /home/web/certs/domain1.private.key
SSLCertificateChainFile /home/web/certs/domain1.intermediate.crt
From: For enabling SSL for a single domain on a server with muliple vhosts, will this configuration work?
What is the difference between SSLCertificateFile and SSLCertificateChainFile ? The client has purchased a CA key from GoDaddy. It looks like GoDaddy only provides a SSLCertificateFile (.crt file), and a SSLCertificateKeyFile (.key file) and not at SSLCertificateChainFile.
Will my ssl still work without a SSLCertificateChainFile path specified ?
Also, is there a canonical path where these files should be placed?
I have a Red Hat Enterprise Linux 6 (with SELinux) which shows significant differences of speed between download and upload (the latter significantly slower) of files shared over the LAN.
The bottleneck seems to be the output of the linux machine since I have a rate around 1Mb/s
when WinXP machines download files shared (using samba) by the RHEL machine
uploading files from the RHEL to a WinXP's shared folder
while
uploading from the XP machines to linux's shares
downloading XPs' shares on the RHEL
any share between Windows machines only
run smooth (around 50Mb/s).
Since the upload from RHEL to WinXP's share is slowed too I would exclude an issue in the configuration of samba.
What could possibly determine this limit in the upload speed?
update: iptables doesn't show any output rule and disabling it doesn't show any noticeable difference, so I would rule out it too.
Hi,
How can I find difference between two time intervals.
Like 13:45:26.836 - 14:24:18.473 which is of the format "Hour:Min:Sec:Millisecs". Now i need to find the time difference between these two times.
Thanks in advance.
During compilation and linking.....what is use of .exp and what is the difference between .lib and .dll . I know that .lib will be used while linking and .dll will be used when running the program... but what exactly is the difference between .lib and .dll does .lib contain the code for the functions comming from .dll? please clarify me... thanks inadvance
Just curious,
Is there any difference between calling len([1,2,3]) or [1,2,3].__len__() ? If there is no apparent difference, what is done differently behind the scenes?
Thanks
What is the difference between git and cvs version control systems?
I have been happily using CVS for over 10 years and have been told that GIT is much better. Could someone please explain what the difference between the two is and why one is better than the other?
Hello,
I have recently jumped into the world of JQuery. I saw the methods find() and filter() but can not figure out the difference between the two.
What exactly is the difference between the two?
I am installing tomcat on a linux server, and would want it to be available as a service. I have found two different ways to achieve this.
The first one is to copy the daemon.sh from $CATALINA_HOME/bin to /etc/init.d, and the other one I have seen is to create a simple init script that class $CATALINA_HOME/bin/startup.sh, etc. Startup.sh calls catalina.sh.
The contents of the daemon.sh and startup.sh look very similar (at least for the env variables, and stuff like that). Daemon.sh calls jsvc in the end. Catalina.sh calls java.
What is the (practical) difference between using the two of these when setting up tomcat as a service?
Hello,
I am looking for any kind information that shows the difference between Facebook and Twitter APIs. (IE what you can retrieve via API, privacy difference etc) for my graduation thesis as a starting point.
I will be grateful if you point out any source of information.
What is the difference (if any) between the javascript strings defined below?
var str1 = "Somestring";
var str2 = 'Somestring';
"" and '' mean two very different things to me predominantly writing code in C++ :-)
EDIT: If there is no difference why are there two ways of achieving the same thing and which is considered better practice to use and why. Thanks!
I'm trying make a lists difference. Found directly prelude operator \\\\ that makes lists difference. But errors Not in scope: '\\\\' occurs. Here is my simple from command line interpreter:
Prelude> ([1,2,3] ++ [5,6]) -- works like expected
[1,2,3,4,5,6]
prelude> ([1,2,3] \\\\ [1,2]) -- erros occurs
<interactive>:1:11: Not in scope: "\\\\"
Thanks for explanation where I make a mistake.
Hi,
I am executing the following javascript on my browser(firefox)
1.console.debug("Screen height = "+ screen.availHeight); //output 770
2.console.debug("Window Height ="+ $(window).height()); //output 210 (i am using jQuery as well)
What is the difference between the two? Are units of 770 is pixels and 210 is mm ?
Similarly, when I write $(document).height() and $(window).height() , there is a difference . What is the reason ?
I got into an argument on the net.core.somaxconn parameter: I was told that it will not make any difference if we change the default 128.
I believed this might be enough proof:
"If the backlog argument is greater than the value in /proc/sys/net/core/somaxconn, then it is silently truncated to that value" http://linux.die.net/man/2/listen
but it's not.
So does anyone know a method to testify this with two machines, one running, for example MySQL or LVS and the other is hammering it in a GBit network?
I'm opened to any solution, scripts are slightly more welcome.
Possible Duplicate:
Is there a performance difference between i++ and ++i in C++?
What is the pratical difference between these 2 statements on, for example, a while loop?