EzDevInfo.com

reset

An opinionated CSS reset for web *apps*.

Command/Powershell script to reset a network adapter

OS: Vista enterprise

When i switch between my home and office network, i always face issues with getting connected to the network. Almost always I have to use the diagnostic service in 'Network and sharing center' and the problem gets solved when i use the reset network adapter option.

This takes a lot of time (3-4 min) and so i was trying to find either a command or a powershell script/cmdlet which i can use directly to reset the network adapter and save myself these 5 mins every time i have to switch between the networks. Any pointers?


Source: (StackOverflow)

Reset Embedded H2 database periodically

I'm setting up a new version of my application in a demo server and would love to find a way of resetting the database daily. I guess I can always have a cron job executing drop and create queries but I'm looking for a cleaner approach. I tried using a special persistence unit with drop-create approach but it doesn't work as the system connects and disconnects from the server frequently (on demand).

Is there a better approach?


Source: (StackOverflow)

Advertisements

Reset PostgreSQL primary key to 1

Is there a way to reset the primary key of a PostgreSQL table to start at 1 again on a populated table?

Right now it's generating numbers from 1000000 and up. I want it all to reset and start to 1, keeping all my existing data intact.


Source: (StackOverflow)

How to Re-Execute Log4j "Default Initialization Procedure"?

At runtime I often create/modify log4j Loggers, Appenders, Levels, Layouts, and time to time need to reset everything back to defaults.

Log4j system has well defined Default Initialization Procedure that is executed when log4j classes are loaded into memory. Is there any way to re-execute the entire Procedure programmatically later at runtime?

I found several resetConfiguration() methods in log4j documentation, but not sure if any of them will do what the Default Initialization Procedure does:

  • BasicConfigurator.resetConfiguration();
  • Hierarchy.resetConfiguration();
  • LogManager.resetConfiguration();

Any other suggestions on resetting log4j configurations are more then welcome! Thank you.


Source: (StackOverflow)

Generate temporary URL to reset password

I am looking to implement a Forgot Password feature on my website. I like the option where an email containing a temporary one-time use URL that expires after some time is sent to the user.

I have looked at the following pages to get these ideas but I am not sure how to implement this using ASP.NET and C#. As one of the users indicated, if I can implement this without storing this information inside the database, that will be ideal. Please advise.

http://stackoverflow.com/questions/1306942/password-reset-by-emailing-temporary-passwords

Thanks.


Source: (StackOverflow)

Reset MVC form with jquery

How do I reset a form?

i.e. Clear values of all fields and remove ValidationSummary error messages validation-summary-errors with jquery.

I use the below code but it does not work:

    var validator = $("#myform").validate();
    validator.resetForm();

I'm using asp.net MVC3 and the jquery scripts are include in my page.

<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

Source: (StackOverflow)

Reset an asp.net validation control via javascript?

How do I reset an asp.net validation control via JavaScript? The current code sample clears the error message text but does not reset the validation control for the next form submission.

var cv= document.getElementById("<%= MyValidationContorl.ClientID %>");
cv.innerHTML = '';

Update:

Here is the full code sample of the form. I can not seem to get the validation controls fire off on another form submission:

function ClearData() {
    var cv = document.getElementById("<%= MyValidationContorl.ClientID %>");
    cv.innerHTML = '';
}

<html>
   <form>
       <asp:TextBox id="MyTextControl" runat="server" />
       <asp:CustomValidator ID="MyValidationContorl" runat="server" />
       <input type="button" onclick="javascript:ClearCCData(); return false;" runat="server" />
   </form>
</html>

Source: (StackOverflow)

SQL Server Reset Identity Increment for all tables

Basically I need to reset Identity Increment for all tables to its original. Here I tried some code, but it fails.

http://pastebin.com/KSyvtK5b

actual code from link:

USE World00_Character
GO

-- Create a cursor to loop through the System Ojects and get each table name
DECLARE TBL_CURSOR CURSOR
-- Declare the SQL Statement to cursor through
FOR ( SELECT Name FROM Sysobjects WHERE Type='U' )

-- Declare the @SQL Variable which will hold our dynamic sql
DECLARE @SQL NVARCHAR(MAX);
SET @SQL = '';
-- Declare the @TblName Variable which will hold the name of the current table
DECLARE @TblName NVARCHAR(MAX);

-- Open the Cursor
OPEN TBL_CURSOR

-- Setup the Fetch While that will loop through our cursor and set @TblName
FETCH NEXT FROM TBL_CURSOR INTO @TblName
-- Do this while we are not at the end of the record set
WHILE (@@FETCH_STATUS <> -1)
BEGIN
-- Appeand this table's select count statement to our sql variable
SET @SQL = @SQL + ' ( SELECT '''+@TblName+''' AS Table_Name,COUNT(*) AS Count FROM '+@TblName+' ) UNION';

-- Delete info
EXEC('DBCC CHECKIDENT ('+@TblName+',RESEED,(SELECT IDENT_SEED('+@TblName+')))');

-- Pull the next record
FETCH NEXT FROM TBL_CURSOR INTO @TblName
-- End the Cursor Loop
END

-- Close and Clean Up the Cursor
CLOSE TBL_CURSOR
DEALLOCATE TBL_CURSOR

-- Since we were adding the UNION at the end of each part, the last query will have
-- an extra UNION. Lets  trim it off.
SET @SQL = LEFT(@SQL,LEN(@SQL)-6);

-- Lets do an Order By. You can pick between Count and Table Name by picking which
-- line to execute below.
SET @SQL = @SQL + ' ORDER BY Count';
--SET @SQL = @SQL + ' ORDER BY Table_Name';

-- Now that our Dynamic SQL statement is ready, lets execute it.
EXEC (@SQL);
GO

error message:

Error: Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '('.

How can I either fix that SQL or reset identity for all tables to its original?

Thank you


Source: (StackOverflow)

What's the difference between git reset --hard and git reset --merge

In my experiments I haven't been able to find any functional difference between

git reset --hard

and

git reset --merge

The usage instructions don't give any hint either

--hard                reset HEAD, index and working tree
--merge               reset HEAD, index and working tree

I regularly use the --hard option so understand how that works. What's the difference between the --merge and the --hard options?

Cheers, Olly

Perhaps an example would help here, let's use the following sequence:

cd git_repo
touch file_one
git add file_one
git commit -m "commit one" # sha1 of 123abc
echo "one" >> ./file_one
git commit -a -m "commit two" # sha1 of 234bcd
echo "two" >> ./file_one
git add . # populate index with a change
echo "three" >> ./file_one # populate working area with a change

Now if I try

git reset --merge 123abc

I get

error: Entry 'file_one' not uptodate. Cannot merge.
fatal: Could not reset index file to revision '123abc'

the reason being that file_one has changes in both the working area and the index

To remedy this I do

git add .
git reset --merge 123abc

This time it works, however, I get the same result as git reset --hard. The index is empty, working area is empty, file_one is empty, as it was after first commit.

Can someone come up with the steps that illustrate the difference?


Source: (StackOverflow)

Wipe data/Factory reset through ADB [closed]

Basically this is my problem/

I have 200+ phones running stock Android that need to be wiped (in the Wipe Data/Factory Reset way) and then a new ROM installed with some additional apks.

Currently I've got everything automated except the Wipe Data part. Everything else can be done through a .bat with a set of commands quite happily but I cannot for the life of me work out how to either imitate or force the recovery mode to wipe the data.

Things I've currently tried:

  • Wiping the data myself using rm -r * on the folders it's supposed to do (data,cache,sd-ext etc.). This does wipe but then the ROM doesn't work properly and gets stuck in a bootloop.
  • Trying to use "adb input keyevent" to mimic the key presses. I have no idea what they are mapped to because they are in a UNIX shell basically and even then there is no "input" because the OS hasn't been loaded anyway.
  • Trying to find the file/script on the system that actually runs the wipe/reset and then running that manually. This might be the simplest way as it's already been written for me somewhere but I just cannot see where it is hidden, even in something like CWM.

If anyone has got any method whereby I could do this factory reset through a .bat or through the adb shell I would greatly appreciate it. Been trying to solve this for about 2 days now with little progress.


Source: (StackOverflow)

How to reset db in Django? I get a command 'reset' not found error

Following this Django by Example tutotrial here: http://lightbird.net/dbe/todo_list.html

The tutorial says:

"This changes our table layout and we’ll have to ask Django to reset and recreate tables:

manage.py reset todo; manage.py syncdb"

though, when I run manage.py reset todo, I get the error:

$ python manage.py reset todo                                       
- Unknown command: 'reset'

Is this because I am using sqlite3 and not postgresql?

Can somebody tell me what the command is to reset the database?

The command: python manage.py sqlclear todo returns the error:

$ python manage.py sqlclear todo    
CommandError: App with label todo could not be found.    
Are you sure your INSTALLED_APPS setting is correct?

So I added 'todo' to my INSTALLED_APPS in settings.py, and ran python manage.py sqlclear todo again, resulting in this error:

$ python manage.py sqlclear todo                                      
- NameError: name 'admin' is not defined

Source: (StackOverflow)

Git: How to move back and forth between commits

I have a newbie question about Git:

I need to move back and forth in a history of a branch. That means, I need to get all the files to the state they were in in some old revision, and then I need to get back to the latest state in the repository. I don't need to commit.

With SVN, it would be

svn up -r800

to get to revision 800, and

svn up

to get in sync with the repository.

I know the hash of the commit I want to get back to, so I tried

git reset <hash>

which seems to get me there. But then I tried

git pull

but that complains about conflicts.

So what's the proper way to move through the history of the branch?

I'm thinking in terms of SVN, so don't hezitate to point me to some nice tutorial. Note that I've already checked http://git.or.cz/course/svn.html and http://www.youtube.com/watch?v=8dhZ9BXQgc4 .

Thanks, Ondra.


Source: (StackOverflow)

git update-index --assume-unchanged and git reset

Here is the scenario:

In my working directory, I have a number of files (let's call them A,B,C) that I've edited. I then ran git update-index --assume-unchanged on those files. Now git status returns blank. Good.

Now, if I do a git reset --hard, the contents of the files A,B, and C, revert back to the contents before I've edited them and "assume-unchanged" them.

Is there a way to stop git from actually reverting files A,B, and C, and simply ignore them?

Thanks,

Ken


Source: (StackOverflow)

Why git can't do hard/soft resets by path?

$ git reset -- <file_path> can reset by path.

However, $ git reset (--hard|--soft) <file_path> will report an error like below:

Cannot do hard|soft reset with paths.

Source: (StackOverflow)

Fastest way to reset every value of std::vector to 0

What's the fastest way to reset every value of a std::vector<int> to 0 and keeping the vectors initial size ?

A for loop with the [] operator ?


Source: (StackOverflow)