w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Differences in numerical behaviour between Scala versions
Sorry, can't post just a comment yet. What is the magnitude of the differences you're seeing, and what kind of calculation are you doing in your code? It may not be meaningful to ask which is correct, it's FP, after all. Could you try compiling your code with strictfp? Slight differences in code gen and optimization can result in differences in when/how often 80-bit intermediates are truncated to 64 -- assuming you're running on an x86 architecture. If you have access to hardware that doesn't have 80-bit fp registers you might try running both versions on that. Even then, simple expressions like LL + S1 + S2, where LL is much greater than S1 or S2, can give different results depending on the order of the adds.

Categories : Scala

Bizzare PHP behaviour calculating time differences, only on 6th and 7th September, 2013
haha OK, it turns out 6th/7th October 2013 is when daylight savings starts in Sydney, Australia. So, the number of hours between those dates is calculated (correctly) as 23. But, 23 hrs is not quite a day. If you're using PHP 5.3+, then this is how you should calculate the difference between dates in days, to save yourself any daylight savings headaches: $startDate = new DateTime('2013-10-07'); $endDate = new DateTime('2013-10-06'); $interval = $startDate->diff($endDate); $days = $interval->days;

Categories : PHP

cygwin rsync all log locations
You asked if "building file list..." happens in memory, or is stored somewhere. Let's take a look at rsync's sources, namely, flist.c: 2089 rprintf(FLOG, "building file list "); 2090 if (show_filelist_p()) 2091 start_filelist_progress("building file list"); 2092 else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server) 2093 rprintf(FCLIENT, "sending incremental file list "); 2094 2095 start_write = stats.total_written; 2096 gettimeofday(&start_tv, NULL); 2097 2098 if (relative_paths && protocol_version >= 30) 2099 implied_dirs = 1; /* We send flagged implied dirs */ 2100 2101 #ifdef SUPPORT_HARD_LINKS 2102 if (preserve_hard_links && protocol_ver

Categories : Windows

Vagrant Rsync Error before provisioning
Most likely you are running into the known vagrant-aws issue #72: Failing with EC2 Amazon Linux Images. Edit 3 (Feb 2014): Vagrant 1.4.0 (released Dec 2013) and later versions now support the boolean configuration parameter config.ssh.pty. Set the parameter to true to force Vagrant to use a PTY for provisioning. Vagrant creator Mitchell Hashimoto points out that you must not set config.ssh.pty on the global config, you must set it on the node config directly. This new setting should fix the problem, and you shouldn't need the workarounds listed below anymore. (But note that I haven't tested it myself yet.) See Vagrant's CHANGELOG for details -- unfortunately the config.ssh.pty option is not yet documented under SSH Settings in the Vagrant docs. Edit 2: Bad news. It looks as if even

Categories : Amazon

Rsync and ssh on android: No such file or directory
I'm not sure but maybe problem is that the destination path (rajeesh@10.0.2.2:backup/) is not absolute? Also if you what to sync your files in the same device, maybe you should try to not use ssh? And do something like that: rsync -rvz /mnt/sdcard/some_directory /backup

Categories : Android

How to execute bash script after rsync
You can add a command after the ssh command to execute it instead of starting a shell. Add the following after the rsync command : sshpass -p "$password" ssh $host "cd $dir && ./after_deploy.sh"

Categories : Bash

boto-rsync multiple credentials
I don't know a lot about boto-rsync but I know it uses boto under the hood and boto supports a BOTO_CONFIG environment variable that can be used to point to your boto configuration file. So, you could have two config files, one with your AWS credentials and one with your Dreamhost credentials and then set the BOTO_CONFIG environment variable to point to the appropriate config file when starting up.

Categories : Amazon

Enabling rsync with ssh keygen and no password
The link that you gave us is right, but there is something that they miss. In the backup-server you must change the file /etc/ssh/sshd_config, uncomment this line AuthorizedKeysFile .ssh/authorized_keys and your no password access should be working. In resume: Client (where you have yours original files) In a terminal write: $ ssh-keygen -t rsa this create the id_rsa.pub file in /home/USER/.ssh/ Server (where you will backup yours files) modify the ssh_config file: #nano /etc/ssh/sshd_config and uncomment the line AuthorizedKeysFile %h/.ssh/authorized_keys and now just copy the content of .ssh/id_rsa.pub(Client) at the end of .ssh/authorized_keys(Server) and the no-password will be working(to connect from Client to Server). Maybe you need to restart your ssh server with /etc/

Categories : Misc

Adding arguments to options in Rsync
Are you sure you're exercising the modified rsync? The man page for popt suggests POPT_ARG_INT: Value Description arg Type POPT_ARG_NONE No argument expected int POPT_ARG_STRING No type checking to be performed char * POPT_ARG_INT An integer argument is expected int POPT_ARG_LONG A long integer is expected long POPT_ARG_VAL Integer value taken from CWval int POPT_ARG_FLOAT An float argument is expected float POPT_ARG_DOUBLE A double argument is expected double The man page linked to has only one reference to CWval with no explanation of what it actually means.

Categories : C

rsync -z with remote share mounted locally
It won't save you anything. To compress the file, rsync needs to read it's contents (in blocks) and then compress them. Since reading the blocks is going to happen over the wire, pre-compression, you save no bandwidth and gain a bit of overhead from the compression itself.

Categories : Linux

Cross-compiling rsync on OS X 10.8 (64bit) to 10.7 (32bit)
Just found this question: What is the "Illegal Instruction: 4" error and why does "-mmacosx-version-min=10.x" fix it? and the export CFLAGS="-arch i386 -mmacosx-version-min=10.7" ./configure make works. :)

Categories : Xcode

How to use the following piece of rsync command in subprocess call?
You need to invoke the shell with shell=True. However, the documentation discourages using shell=True. In order to avoid using shell=True, you can first create rsync process and pipe it's output to grep: rsync_out = subprocess.Popen(['sshpass', '-p', password, 'rsync', '--recursive', source], stdout=subprocess.PIPE) output = subprocess.check_output(('grep', '.'), stdin=rsync_out.stdout)

Categories : Python

Rsync with delete option doesn't seem to work
Assuming you have a recent version of rsync that works the same as on my machine, your command should work. Here's a test example: > mkdir -p site/a > touch site/a/b.txt > rsync -Cr --delete site/ site2 > find site2 site2 site2/a site2/a/b.txt > rm site/a/b.txt > rsync -Cr --delete site/ site2 > find site2 site2 site2/a I suggest you verify a bit more your setup. You might want to test with the above scenario.

Categories : Jenkins

How exactly does rsync work? Is it smart enough not to transfer anything if your files aren't different?
Directly from the man page (http://linux.die.net/man/1/rsync): "Rsync finds files that need to be transferred using a lqquick checkrq algorithm (by default) that looks for files that have changed in size or in last-modified time. Any changes in the other preserved attributes (as requested by options) are made on the destination file directly when the quick check indicates that the file's data does not need to be updated."

Categories : Linux

Sending output of 2 rsync commands in a bash script
You may want to put both commands inside the command expansion: rfiles=$(rsync -rvlpogt /svntags/tags/ /var/www/html/ && rsync -rvlpogt /svnbranch/branches/ /var/www/html/)

Categories : Bash

ANT exec task with rsync does not show update output
This is expected behavior. The output of rsync refreshes the same line. For example, it may output: Precent finsihed: 0% Precent finsihed: 1% Precent finsihed: 2% So that the "Percent finished:" part and the percent ("%") will remain still on the screen, while the number changes. However, there are some problem handling such kind of output in Java, check this question: Reading other process' unbuffered output stream Maybe there are some methods to handle such output, but obviously Ant hasn't implemented it.

Categories : Ant

Sometimes Rsync fails to copy files from the remote machine
For validation: If you want to check if all files were copied, you can do a simple glob or list for list of files in the remote dir. Then compare to the glob list of files in the target dir. set globResult [ exec rsh -l $user $host "cd $dir; ls -l | wc -l" ] Or if you go further, you can always checksum on both the remote and the target directory. As for the reason for failure, it could've been network or server issues. While you are doing rsync, have you check the return exit status to make sure rsync has completed successfully?

Categories : Perl

How do I use rsync to backup the "/root" folder to a network share?
i assume you run the backup as a normal user and try to backup files that belong to the root user. this will not work because of permission problems. run the rsync command as user root, or gain root privileges temporarily by prepending sudo in front of the command, e.g. sudo rsync -ruvz --no-o --no-g --delete "/root" "/mnt/backup-drive"

Categories : Linux

Show only file names using rsync --recursive on Python?
If you want to skip everything which is below a directory, you can do rsync -avz --exclude '*/' source_directory destination_directory If you want skip all the empty directories, you can use rsync -avz --prune-empty-dirs source_directory destination_directory But it is not clear to me what exactly you want to achieve. You want to skip directories, but not the files in them, where do you want to sync them then if you didn't sync the directory? Or is this just about the output on the screen? If you just want to change the output on the screen, you can pipe it through grep, i.e. rsync -avz source_directory destination_directory | grep "." Then you will only see lines with a .. Note that you have to escape ., as it otherwise stands for a wildcard. Of course, this assumes that you don

Categories : Python

How to modify this rsync command to find out the directory with '.' in Python?
Personally I wouldn't bother using grep, I'd simply use Python's own string filtering - however, that wasn't the question you asked. Since the filenames are remote and Python sees them as simply strings then we can't use any of Python's own file manipulation routines (e.g. os.path.isdir()). So, I think you have three basic approaches: Split each string by slashes and use this to build your own representation of the filesystem tree in memory. Then, do a pass through the tree and only display leaf nodes (i.e. files). If you can assume that files within a directory are always listed immediately after that directory, then you can do a quick check against the previous entries to see if this entry is a file within one of those directories. Use meta-information from rsync. I would suggest th

Categories : Python

How to count number of files available in a directory recursively in Python using rsync?
I would use a different approach using fabric, which is a great tool for executing remote commands. from fabric.api import run, env env.host_string = 'example.org' output = run('find /tmp -type f | wc -l') num_files = int(output) Now you have the number of files in your variable num_files. I was just using the find command to search for files recursively beginning at directory /tmp, and counted the returned lines with wc -l.

Categories : Python

RSync works stand alone, not as script in Sublime Text Build System
The Sublime Text console/build system is not interactive, so there is unfortunately no way to enter input during a build. To get around this, you'll either need some other way of authenticating, such as with an SSH key, or you'll need to program a small plugin that uses sublime.Window.show_input_panel() to obtain the password from the user.

Categories : Bash

asp.Net newbie help me
You need to create a new string from the char[]: char[] chars = txtoriginal.Text.ToCharArray(); Array.Reverse(chars); blAnswer.Text = new string(chars); But note that reversing a string isn't the same as reversing a sequence of characters. See: http://msmvps.com/blogs/jon_skeet/archive/2009/11/02/omg-ponies-aka-humanity-epic-fail.aspx

Categories : C#

Newbie needs some assistance
Keep the words in an array, and then use a for loop to prompt the user for each word. var words = new Array(10); alert("Enter " + words.length + " words"); for(var i = 0; i < words.length; i++) { words[i] = prompt("Enter Word " + (i + 1), " "); }

Categories : Javascript

Encapsulation C# newbie
Because it is easier to change the Code if you want to add the checks/tests later on. Especially if you have many inheritance and many classes in your code it is very hard to change the implementation from a public variable to a public Property. Moreover you can add to the get and set within the property different attributes, e.g. if you are using reflection. The get and set of the property are internally different methods. If you have just a public variable /field it is not possible to added different properties to the different access ways.

Categories : C#

newbie ios - where is the model in MVC?
As always the design is upto you. I would suggest creating a core data model with what ever model objects you require (This will generate the class files for you). Becoming familiar with core data early in your iOS learning is a great way to pick up best practices. This should get you started. Doing it this way will also allow you to easily persist the programs state, is easy to maintain and extend. Good luck with your iOS development.

Categories : IOS

OOP PHP - Newbie exercise on classes
A book is essentially a list of chapters. Each chapter has a title and a text. What about letting the book object handling the responsibility of building an index? <?php class Chapter { public $title; public $text; public function __construct($title, $text) { $this->title = $title; $this->text = $text; } } class Book { private $chapters; public function __construct() { $this->chapters = array(); } public function addChapter(Chapter $chapter) { $this->chapters[] = $chapter; } public function getIndex() { $index = array(); foreach($this->chapters as $chapter) { $index[] = $chapter->title; } return $index; } } // Usage $book = new Bo

Categories : PHP

Python Slicing Newbie
print a I'm not sure what your confusion is. Update: "school" is the part you didn't slice. If "school" is the part you're interested in, you want a = word[-6:] If you want both parts, slice them separately: notschool, school = word[:-6], word[-6:]

Categories : Python

Unfortunately Appname has stopped, newbie
Please declare this class com.koutymony.webview.WebViewActivity in AndroidManifest.xml inside of <application><application/>as below: <activity android:name="brewedapps.app55.WebViewActivity"/> Edited Full Manifest File: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" android:installLocation="preferExternal" package="brewedapps.app55"> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE

Categories : Android

SQL Newbie Needs Assistance w/ Query
You can use a window to get a partitioned SUM(): SELECT MasterDept, ABCID, AMT, SUM(AMT) OVER(PARTITION BY MasterDept) FROM #Table1 You can use that to get the percentage for each row to update your second table (this assumes 1 row per MasterDept/ABCID combination): UPDATE A SET A.[AMT%] = B.[AMT%] FROM Table2 A JOIN (SELECT MasterDept , ABCID , AMT , CASE WHEN SUM(AMT) OVER(PARTITION BY MasterDept) = 0 THEN 0 ELSE AMT*1.0/SUM(AMT) OVER(PARTITION BY MasterDept) END 'AMT%' FROM #Table1 ) B ON A.MasterDept = B.MasterDept AND A.ABCID = B.ABCID As you can see in the subquery, a percent of total can be added to your Table1, so perhaps you don't even need Table2 as it's a bit redundant. Update: You can us

Categories : Sql Server

If in_array then include - newbie
in_array needs 2 parameters, needle and haystack. Change your if statement to the following: if(in_array($currentpage, $homepage)) For in_array reference, see http://php.net/manual/en/function.in-array.php

Categories : Arrays

Newbie - relation in database
Use ForeignKeys, see https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey. In your case : class MyBox(models.Model): name = models.CharField(max_length=255) class SecretCode(models.Model): box = models.ForeignKey(MyBox, related_name="secret_codes") code = models.CharField(max_length=64, unique=True) You can reverse the relation by simply using : box = MyBox.objects.get(pk=1) box.secret_codes.all()

Categories : Django

Setting A Cookie - Newbie
If you don't mind to use a jQuery plugin - try this [easy to use & way less to code for you] https://github.com/carhartl/jquery-cookie

Categories : Jquery

Regex assistance to a newbie
You should change the +s with .* Also, no need for the i $newTerm = preg_replace('//(.*)//', '', $searchTerm); Tested here: http://regexpfiddle.com/

Categories : PHP

pagerjs newbie - using without node.js?
you do not need node.js to install pager.js (but you can use npm to install it if you like). Download the pager.js-file (https://raw.github.com/finnsson/pagerjs/master/pager.js) directly and include it just as any other js-file (both AMD and non-AMD is supported).

Categories : Javascript

Python Multiprocessing newbie
from multiprocessing import Process def fun1(): RemesherTweenOnce() def fun2(): RemesherOnce() p1 = Process(target=fun1) p2 = Process(target=fun2) # Starts processes. p1.start() p2.start() # If you would like to wait for the results. p1.join() p2.join()

Categories : Python

Newbie in need of searching, JSON
Here is javascript error myArr.push('<input type="text" name=">'+city+"","+state+"/>") Altho i never tried to search per diem, but your code should be myArr.push('<input type="text" name=">'+city+'","'+state+'"/>')

Categories : Jquery

Newbie : Execution error
Try doing it this way: javac -d . Test.java java pkg.Test The java command takes a fully qualified class name as its main argument. A fully qualified name in Java includes package declarations (the fully qualified name of your class is pkg.Test). Since java also needs a correct directory structure for packages, you must execute the command from the directory you compiled your source to, which in this case is ..

Categories : Java

Python indentation newbie
if count > 10: break else: return(temperature) if-else conditions need to be indented as well. It should be if count > 10: break else : return temperature Some other notes: return temperature does not need parenthesis like you have. Also, to open a file, read it and the close it, you can just do this: with open("/sys/bus/w1/devices/28-000003086819/w1_slave", "r") as tfile : text = tfile.read() This ensures the file handle is closed even in case of exceptions. Further, I passed a second argument r which specifies that the file should only be opened in read-mode.

Categories : Python

Eloquent ORM query -- newbie
A couple of things you should be aware of: If you have a custom primary key, you need to set the $primaryKey property on your eloquent models to the primary keys you have in the DB. You can't mix and match belongsToMany relationships with anything other than belongsToManys. A belongsToMany is exclusively for the case where you have two tables that are connected by a pivot table. In your case, B belongsTo A, and A hasMany B.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.