Things are going well on your version of production/master and you'd like to pull the latest iteration. Oh, sure, you could tar your setup before doing that in case it breaks, but maybe you're stuck for time and too lazy. That's okay. Really it is. just
git branch before-pull-todaysdate
git pull
PANIC! bad stuff, things crashing, etc... maybe that pull isn't nice.
git checkout before-pull-todaysdate
whew... sanity restored. ... OK, it's off hours and you really want to get back to the latest iteration. Managers aren't on your back and you can fix this.
git checkout master
errors, etc. but at least you're at the latest iteration.
BETTER: don't pull. Just git fetch, then git merge when you're ready.
Friday, January 18, 2013
Monday, January 14, 2013
git branch change oops wrong branch
Specific case:
You're working on a feature but forgot to change branches. This feature is going to corrupt master, it seems, but you haven't committed yet.
alternative to stash,
git branch newbranchname
git checkout newbranchname
git add .
git commit -m "I needed a branch for this before killing master"
if you git checkout master, all these new previously uncommitted changes aren't there (whew) but git checkout newbranchname has the stuff you've been working on.
when you're ready to put them back, just merge back to master.
You're working on a feature but forgot to change branches. This feature is going to corrupt master, it seems, but you haven't committed yet.
alternative to stash,
git branch newbranchname
git checkout newbranchname
git add .
git commit -m "I needed a branch for this before killing master"
if you git checkout master, all these new previously uncommitted changes aren't there (whew) but git checkout newbranchname has the stuff you've been working on.
when you're ready to put them back, just merge back to master.
Thursday, December 20, 2012
Vim search/replace
sure, you know about s/foo/bar/ which replaces bar where foo exists.
Let's say you want to find foo but only when it comes before bar, and you want to replace some but not all of it.
s/\(foo\)bar/\1goo/
Will replace foobar with foogoo
will keep foodoo as is.
You can use this to, for instance, insert something before a comma:
s/\([a-z]\),/\1 = 0,/
foo, is now foo = 0,
or insert something between foo and bar
s/\(foo\)\(bar\)/\1 nutty \2/
changes foobar to foo nutty bar
Let's say you want to find foo but only when it comes before bar, and you want to replace some but not all of it.
s/\(foo\)bar/\1goo/
Will replace foobar with foogoo
will keep foodoo as is.
You can use this to, for instance, insert something before a comma:
s/\([a-z]\),/\1 = 0,/
foo, is now foo = 0,
or insert something between foo and bar
s/\(foo\)\(bar\)/\1 nutty \2/
changes foobar to foo nutty bar
Saturday, December 1, 2012
Windows update error 80070005 quick resolution
If you've been infected by malware that "hides everything", don't forget to unhide the folders under c:\windows\SoftwareDistribution\
open an administrative level command prompt and type this:
cd \windows\SoftwareDistribution
attrib -r -s -h /s /d *.*
if you want to open the firehose (somewhat) safely, you might try this from c:\windows:
attrib -r -h /s /d *.*
You won't be able to unhide system files, but you will unhide everything that you otherwise have access to.
(Be very certain you're in the SoftwareDistribution folder prior to runnning the attrib command line, otherwise you just unhid/unreadonly/unsystem the entire folder you're in.)
This should quickly fix the WindowsUpdate_80070005 error and allow you to download Windows Updates as well as Microsoft Security Essentials updates if you're encountering 0x80070005 error.
There's no warranty about whether you try this stuff. It may make things work, but you should at least consider whether you're comfortable with this.
open an administrative level command prompt and type this:
cd \windows\SoftwareDistribution
attrib -r -s -h /s /d *.*
if you want to open the firehose (somewhat) safely, you might try this from c:\windows:
attrib -r -h /s /d *.*
You won't be able to unhide system files, but you will unhide everything that you otherwise have access to.
(Be very certain you're in the SoftwareDistribution folder prior to runnning the attrib command line, otherwise you just unhid/unreadonly/unsystem the entire folder you're in.)
This should quickly fix the WindowsUpdate_80070005 error and allow you to download Windows Updates as well as Microsoft Security Essentials updates if you're encountering 0x80070005 error.
There's no warranty about whether you try this stuff. It may make things work, but you should at least consider whether you're comfortable with this.
Thursday, November 15, 2012
Windows 7 NAS Shares can't connect
Thanks to this post, I implemented a GPO that disabled the requirements of Microsoft signatures for network shares and the NAS (LaCIE, et al) I couldn't see from Windows 7 x64bit now could be seen (after reboot of workstation).
Monday, November 5, 2012
mysql cheat to check is number
Is that value a number or a string?
select cast("2apple" AS UNSIGNED), cast("3 bananas" AS UNSIGNED), cast(0+ "4 cars" AS UNSIGNED), cast("100" AS UNSIGNED), cast("BAR" AS UNSIGNED), "5 bears" regexp "[A-Za-z]", "6" regexp "[A-Za-z]"
Returns:
2, 3, 4, 100, 0, 1, 0
Summary: Best way to check if the value is (only) a number is to check if it doesn't contain letters (assuming that letters are adequate for this detection. If you're expecting symbols but no letters, you'll need to test for the symbols).But, if you want to get the "Value" of the string (numbers before letters), CAST it as unsigned.If you know there will *never* be numbers before characters, you can use the CAST and test if greater than zero.
select cast("2apple" AS UNSIGNED), cast("3 bananas" AS UNSIGNED), cast(0+ "4 cars" AS UNSIGNED), cast("100" AS UNSIGNED), cast("BAR" AS UNSIGNED), "5 bears" regexp "[A-Za-z]", "6" regexp "[A-Za-z]"
Returns:
2, 3, 4, 100, 0, 1, 0
Summary: Best way to check if the value is (only) a number is to check if it doesn't contain letters (assuming that letters are adequate for this detection. If you're expecting symbols but no letters, you'll need to test for the symbols).But, if you want to get the "Value" of the string (numbers before letters), CAST it as unsigned.If you know there will *never* be numbers before characters, you can use the CAST and test if greater than zero.
Thursday, November 1, 2012
Linux log files various ways to log
let's say the application has a log output:
Overwrite:
wget -o logfilename.ext ...
Append:
wget -a logfilename.ext ...
Overwrite with a date log:
wget -o logfilename_`date +%Y-%m-%d`.ext ...
This gives you a daily log output.
Output goes to stdout:
Overwrite:
echo "something" > logfile
Append: (creates if not exist)
echo "something" >> logfile
Daily log:
echo "something" >> logfile_`date +%Y-%m-%d`
Output (errors) goes to stderr
include with your standard log:
echo "something" > logfile 2>&1
Overwrite:
wget -o logfilename.ext ...
Append:
wget -a logfilename.ext ...
Overwrite with a date log:
wget -o logfilename_`date +%Y-%m-%d`.ext ...
This gives you a daily log output.
Output goes to stdout:
Overwrite:
echo "something" > logfile
Append: (creates if not exist)
echo "something" >> logfile
Daily log:
echo "something" >> logfile_`date +%Y-%m-%d`
Output (errors) goes to stderr
include with your standard log:
echo "something" > logfile 2>&1
Subscribe to:
Posts (Atom)