blessdiff for the "full featured hexadecimal editor"?
Solution 1
If you just want to view changes, not edit them, you can convert the files to hex with one program and then diff the output with any graphical diff program you want. It is probably only practical if there are only changed (not inserted) bytes between the files.
As a one-liner:
meld <(hexdump -C file1.bin) <(hexdump -C file2.bin)
And here's a screenshot of 2 different copies of libssl.so on my system:
Solution 2
If your files could have inserts/deletions, you can use this command to diff:
meld <(xxd -c 1 -ps file1.bin) <(xxd -c 1 -ps file2.bin)
Related videos on Youtube
Léo Léopold Hertz 준영
Updated on September 18, 2022Comments
-
Léo Léopold Hertz 준영 over 1 year
I have a web form for admin purposes where the user can change the order that a group of records is shown on a webpage.
For example: A table (tblStuff) in a database has three fields:
ContentID, Content, RecordPosition
The table has, say, four records:
1, Guess what, 1 2, More stuff, 2 3, Some stuff, 3 4, That's right, 4
The SQL code is:
SELECT * FROM tblStuff ORDER BY RecordPosition ASC
The user can use the form to change the RecordPosition number so that the order can read:
3, Some stuff, 1 2, More stuff, 2 1, Guess what, 3 4, That's right, 4
So... How can I validate the form so that the same number isn't entered twice into the RecordPosition field?
Hope this makes sense.
Here's the whole page
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include virtual="/Connections/ENG.asp" --> <% ' *** Restrict Access To Page: Grant or deny access to this page MM_authorizedUsers="" MM_authFailedURL="../default.asp" MM_grantAccess=false If Session("MM_Username") <> "" Then If (true Or CStr(Session("MM_UserAuthorization"))="") Or _ (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then MM_grantAccess = true End If End If If Not MM_grantAccess Then MM_qsChar = "?" If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&" MM_referrer = Request.ServerVariables("URL") if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString() MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer) Response.Redirect(MM_authFailedURL) End If %> <% If Request.Form("action")="update" Then 'Set variables for update Dim updateSQL, i Dim cContentID, cPositionNumber 'Loop through records on screen and update For i = 1 To fFormat(Request.Form("counter")) 'Create the proper field names to reference on the form cContentID = "ContentID" & CStr(i) cPositionNumber = "PositionNumber" & CStr(i) 'Create the update sql statement updateSQL = "UPDATE tblContent SET PositionNumber=" & fFormat(Request.Form(cPositionNumber)) & " WHERE ContentID=" & fFormat(Request.Form(cContentID)) 'Run the sql statement Call sRunSQL(updateSQL) Next 'Refresh page Response.Redirect("record-order-modify-updated.asp") End If Function fFormat(vText) fFormat = Replace(vText, "'", "''") End Function Sub sRunSQL(vSQL) set cExecute = Server.CreateObject("ADODB.Command") With cExecute .ActiveConnection = MM_ENG_STRING .CommandText = vSQL .CommandType = 1 .CommandTimeout = 0 .Prepared = true .Execute() End With End Sub %> <% Dim rsCharityDetails Dim rsCharityDetails_cmd Dim rsCharityDetails_numRows Set rsCharityDetails_cmd = Server.CreateObject ("ADODB.Command") rsCharityDetails_cmd.ActiveConnection = MM_ENG_STRING rsCharityDetails_cmd.CommandText = "SELECT * FROM tblCharityDetails" rsCharityDetails_cmd.Prepared = true Set rsCharityDetails = rsCharityDetails_cmd.Execute rsCharityDetails_numRows = 0 %> <% Dim rsNavBar Dim rsNavBar_cmd Dim rsNavBar_numRows Set rsNavBar_cmd = Server.CreateObject ("ADODB.Command") rsNavBar_cmd.ActiveConnection = MM_ENG_STRING rsNavBar_cmd.CommandText = "SELECT * FROM tblMainMenu WHERE MainMenuID <6 OR MainMenuID >7" rsNavBar_cmd.Prepared = true Set rsNavBar = rsNavBar_cmd.Execute rsNavBar_numRows = 0 %> <% Dim rsContent__smID rsContent__smID = "1" If (Request.QueryString("smID") <> "") Then rsContent__smID = Request.QueryString("smID") End If %> <% Dim rsContent Dim rsContent_cmd Dim rsContent_numRows Set rsContent_cmd = Server.CreateObject ("ADODB.Command") rsContent_cmd.ActiveConnection = MM_ENG_STRING rsContent_cmd.CommandText = "SELECT tblContent.*, tblMainMenu.MainMenuName, tblSubMenu.SubMenuName, tblSubMenu.SubMenuID FROM (tblContent LEFT JOIN tblMainMenu ON tblContent.MainMenuID = tblMainMenu.MainMenuID) LEFT JOIN tblSubMenu ON tblContent.SubMenuID = tblSubMenu.SubMenuID WHERE tblContent.SubMenuID = ? AND tblContent.DisplayRecord =1 ORDER BY tblContent.PositionNumber" rsContent_cmd.Prepared = true rsContent_cmd.Parameters.Append rsContent_cmd.CreateParameter("param1", 5, 1, -1, rsContent__smID) ' adDouble Set rsContent = rsContent_cmd.Execute rsContent_numRows = 0 %> <% Dim rsMenuList Dim rsMenuList_cmd Dim rsMenuList_numRows Set rsMenuList_cmd = Server.CreateObject ("ADODB.Command") rsMenuList_cmd.ActiveConnection = MM_ENG_STRING rsMenuList_cmd.CommandText = "SELECT tblMainMenu.MainMenuID, tblMainMenu.MainMenuName, tblSubMenu.SubMenuID, tblSubMenu.SubMenuName FROM tblMainMenu INNER JOIN tblSubMenu ON tblMainMenu.MainMenuID = tblSubMenu.MainMenuID WHERE tblSubMenu.SubMenuID <> 6 AND tblSubMenu.SubMenuID <16 OR tblSubMenu.SubMenuID >19" rsMenuList_cmd.Prepared = true Set rsMenuList = rsMenuList_cmd.Execute rsMenuList_numRows = 0 %> <% Dim rsHeaderImage Dim rsHeaderImage_cmd Dim rsHeaderImage_numRows Set rsHeaderImage_cmd = Server.CreateObject ("ADODB.Command") rsHeaderImage_cmd.ActiveConnection = MM_ENG_STRING rsHeaderImage_cmd.CommandText = "SELECT MainMenuImage, MainMenuID FROM tblMainMenu" rsHeaderImage_cmd.Prepared = true Set rsHeaderImage = rsHeaderImage_cmd.Execute rsHeaderImage_numRows = 0 %> <% Dim navBar__numRows Dim navBar__index navBar__numRows = -1 navBar__index = 0 rsNavBar_numRows = rsNavBar_numRows + navBar__numRows %> <% Dim rptContent__numRows Dim rptContent__index rptContent__numRows = -1 rptContent__index = 0 rsContent_numRows = rsContent_numRows + rptContent__numRows %> <% Dim Repeat_MenuList__numRows Dim Repeat_MenuList__index Repeat_MenuList__numRows = -1 Repeat_MenuList__index = 0 rsMenuList_numRows = rsMenuList_numRows + Repeat_MenuList__numRows %> <!DOCTYPE HTML> <html> <head> <meta charset="iso-8859-1"> <!-- disable iPhone inital scale --> <meta name="viewport" content="width=device-width; initial-scale=1.0"> <title><%=(rsCharityDetails.Fields.Item("CharityName").Value)%> | English Website Administration</title> <!-- main css --> <link href="../../scripts/mfm-standard-stylesheet.css" rel="stylesheet" type="text/css"> <!--[if lt IE 9]> <link href="../scripts/mfm-standard-stylesheet_ie.css" rel="stylesheet" type="text/css"> <![endif]--> <!-- Admin css --> <link href="../scripts/mfm-admin-stylesheet.css" rel="stylesheet" type="text/css"> <script src="../../scripts/jquery-1.7.2.min.js"></script> <!-- jQuery NailThumb Plugin - any image to any thumbnail Examples and documentation at: http://www.garralab.com/nailthumb.php --> <script src="../../scripts/jquery.nailthumb.1.1.js"></script> <!-- Lightbox2 v2.51 by Lokesh Dhakar For more information, visit: http://lokeshdhakar.com/projects/lightbox2/ --> <script src="../../scripts/lightbox.js"></script> <!-- Lightbox css --> <link href="../../scripts/lightbox.css" rel="stylesheet" type="text/css" media="screen" /> <script src="../tiny_mce/tiny_mce.js"></script> <script src="../tiny_mce/tiny-mce-mfm.js"></script> <!-- html5.js for IE less than 9 --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- css3-mediaqueries.js for IE less than 9 --> <!--[if lt IE 9]> <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> <![endif]--> </head> <body id="other"> <div id="wrapper"> <header class="innerWidth"> <!--#include file="includes/header-modify-record.asp" --> </header> <nav class="innerWidth"> <!--#include file="includes/navbar-modify-record.asp" --> </nav> <!-- pageContent --> <div id="content" class="innerWidth"> <!-- Aside --> <aside> <h3>Record Order</h3> <ul> <% Dim txtOldHeading txtOldHeading = "" While ((Repeat_MenuList__numRows <> 0) AND (NOT rsMenuList.EOF)) If txtOldHeading = rsMenuList.Fields.Item("MainMenuName").Value Then Else txtOldHeading = rsMenuList.Fields.Item("MainMenuName").Value %> <li class="menuHeading"><%=(rsMenuList.Fields.Item("MainMenuName").Value)%></li> <% END IF %> <li class="menuList"> <% If (rsMenuList.Fields.Item("SubMenuID").Value) = "3" Then %> <a href="our-development-partners-record-order-modify.asp"><%=(rsMenuList.Fields.Item("SubMenuName").Value)%></a> <% ElseIf (rsMenuList.Fields.Item("SubMenuID").Value) = "15" Then %> <a href="shop-record-order-modify.asp"><%=(rsMenuList.Fields.Item("SubMenuName").Value)%></a> <% ElseIf (rsMenuList.Fields.Item("SubMenuID").Value) = "20" Then %> <a href="friends-of-mfm-record-order-modify.asp"><%=(rsMenuList.Fields.Item("SubMenuName").Value)%></a> <% Else %> <a href="record-order-modify.asp?smID=<%=(rsMenuList.Fields.Item("SubMenuID").Value)%>"><%=(rsMenuList.Fields.Item("SubMenuName").Value)%></a> <% End If %> </li> <% Repeat_MenuList__index=Repeat_MenuList__index+1 Repeat_MenuList__numRows=Repeat_MenuList__numRows-1 rsMenuList.MoveNext() Wend %> </ul> </aside> <!-- /Aside --> <!-- Article --> <article> <% IF Request.ServerVariables("QUERY_STRING") <> "" THEN %> <h3><span style="font-size:small">Order/Re-order records for: </span><%=(rsContent.Fields.Item("SubMenuName").Value)%></h3> <% Dim counter While ((rptContent__numRows <> 0) AND (NOT rsContent.EOF)) counter = counter + 1 %> <form action="record-order-modify.asp" method="post" class="recordPosition"> <table width="100%"> <tr> <td align="left" valign="top" name="ContentTitle" colspan="2"><h2><%=(rsContent.Fields.Item("ContentTitle").Value)%></h2><input type="hidden" value="<%=(rsContent.Fields.Item("ContentID").Value)%>" name="ContentID<%=counter%>"></td> </tr> <tr> <td align="left" valign="top" name="ContentData"><% Dim tmp tmp = rsContent.Fields.Item("ContentData").Value %> <% =LEFT(tmp, INSTR((tmp & "."), ".")) %>.. </td> <% IF (IsNull(rsContent.Fields.Item("ContentImage").Value)) THEN %> <td width="140" align="center" valign="top" name="ContentImage"><img src="../images/system_images/red-x.png"></td> <% ELSE %> <td width="140" align="center" valign="top" name="ContentImage"><div class="nailthumb-container"> <!-- Thumbnail Container --> <img src="<%=(rsContent.Fields.Item("ContentImage").Value)%>"> </div></td> <% END IF %> </tr> <tr> <td align="left"><label>Current Record Position: <small class="brown" style="text-transform:none">(You may change it here)</small></label> <input type="text" name="PositionNumber<%=counter%>" tabindex="<%=counter%>" value="<%=(rsContent.Fields.Item("PositionNumber").Value)%>"></td> </tr> </table> <hr> <% rptContent__index=rptContent__index+1 rptContent__numRows=rptContent__numRows-1 rsContent.MoveNext() Wend %> <table align="center" class="positionButtons"> <tr> <td width="50%" align="right"><input name="Submit" type="submit" value="Update Positions" tabindex="<%=counter%>"></td> <td width="50%" align="left"><input name="Reset" type="reset" value="Reset All Changes" tabindex="<%=counter%>"></td> </tr> </table> <input type="hidden" name="action" value="update"> <input type="hidden" name="counter" value="<%=counter%>"> </form> <% ELSE %> <h3>Select a listing to order/re-order using the list on the left.</h3> <% END IF %> </article> <!-- /Article --> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.nailthumb-container').nailthumb({width:125,height:125,fitDirection:'top center'}); }); </script> </div> <!-- /pageContent --> <div class="push"></div> </div> <!-- #wrapper --> <footer class="innerWidth"> <!--#include file="includes/footer.asp" --> </footer> </body> </html> <% rsCharityDetails.Close() Set rsCharityDetails = Nothing %> <% rsNavBar.Close() Set rsNavBar = Nothing %> <% rsContent.Close() Set rsContent = Nothing %> <% rsMenuList.Close() Set rsMenuList = Nothing %> <% rsHeaderImage.Close() Set rsHeaderImage = Nothing %>
As requested by Allende, here's the generated form code.
<form action="record-order-modify.asp" method="post" class="recordPosition"> <table width="100%"> <tr> <td align="left" valign="top" name="ContentTitle" colspan="2"><h2>Investing in people and the environment</h2><input type="hidden" value="15" name="ContentID1"></td> </tr> <tr> <td align="left" valign="top" name="ContentData"><p>Madagascar is an environmental hotspot... </td> <td width="140" align="center" valign="top" name="ContentImage"><div class="nailthumb-container"> <!-- Thumbnail Container --> <img src="/images/framed-images/mfm-website-(26).jpg"> </div></td> </tr> <tr> <td align="left"><label>Current Record Position: <small class="brown" style="text-transform:none">(You may change it here)</small></label> <input type="text" name="PositionNumber1" tabindex="1" value="1"></td> </tr> </table> <hr> <table width="100%"> <tr> <td align="left" valign="top" name="ContentTitle" colspan="2"><h2>The next generation</h2><input type="hidden" value="16" name="ContentID2"></td> </tr> <tr> <td align="left" valign="top" name="ContentData"><p>Teaching Malagasy children to respect and nurture their environment is critical to the survival of Madagascar's biodiversity... </td> <td width="140" align="center" valign="top" name="ContentImage"><div class="nailthumb-container"> <!-- Thumbnail Container --> <img src="/images/framed-images/mfm-website-(292).jpg"> </div></td> </tr> <tr> <td align="left"><label>Current Record Position: <small class="brown" style="text-transform:none">(You may change it here)</small></label> <input type="text" name="PositionNumber2" tabindex="2" value="2"></td> </tr> </table> <hr> <table width="100%"> <tr> <td align="left" valign="top" name="ContentTitle" colspan="2"><h2>Recognition for our work</h2><input type="hidden" value="17" name="ContentID3"></td> </tr> <tr> <td align="left" valign="top" name="ContentData"><p>Our work over 2 decades with 73 villages surrounding the Reserve of Betampona recently gained recognition at an international conference held at the University of East Anglia... </td> <td width="140" align="center" valign="top" name="ContentImage"><div class="nailthumb-container"> <!-- Thumbnail Container --> <img src="/images/framed-images/mfm-website-(56).jpg"> </div></td> </tr> <tr> <td align="left"><label>Current Record Position: <small class="brown" style="text-transform:none">(You may change it here)</small></label> <input type="text" name="PositionNumber3" tabindex="3" value="3"></td> </tr> </table> <hr> <table width="100%"> <tr> <td align="left" valign="top" name="ContentTitle" colspan="2"><h2>Adding value by adding forests</h2><input type="hidden" value="18" name="ContentID4"></td> </tr> <tr> <td align="left" valign="top" name="ContentData"><p>Often the best way to protect an old forest is to plant a new one... </td> <td width="140" align="center" valign="top" name="ContentImage"><div class="nailthumb-container"> <!-- Thumbnail Container --> <img src="/images/framed-images/mfm-website-(217).jpg"> </div></td> </tr> <tr> <td align="left"><label>Current Record Position: <small class="brown" style="text-transform:none">(You may change it here)</small></label> <input type="text" name="PositionNumber4" tabindex="4" value="4"></td> </tr> </table> <hr> <table align="center" class="positionButtons"> <tr> <td width="50%" align="right"><input name="Submit" type="submit" value="Update Positions" tabindex="4"></td> <td width="50%" align="left"><input name="Reset" type="reset" value="Reset All Changes" tabindex="4"></td> </tr> </table> <input type="hidden" name="action" value="update"> <input type="hidden" name="counter" value="4"> </form>
-
peterm about 10 yearsIs your question about how to do validation is ASP or how to prevent duplicate value on MySQL side?
-
Adam Merrifield about 10 yearsYou need to look into MySQL's primary key & auto increment
-
Admin about 10 yearsThis isn't really about not allowing duplicates in the table. The tables already use auto increment for the primary keys.
-
Allende about 10 yearsCan you post the generated HTML, (just the form code with the records) ?
-
ott-- almost 9 yearsCheckout vi.stackexchange.com/questions/2232/… - and with vim's split view you're done.
-
Léo Léopold Hertz 준영 almost 9 years@ott-- I opened a new thread about starting
vimdiff
in such a condition: vi.stackexchange.com/q/4022/2923
-
-
Admin about 10 yearsI've added the whole page so you can see what I'm dealing with. Thanks for the link.
-
Admin about 10 yearsDuplicates will be allowed. I just used the example to try to keep it all simple. Sorry. I've since added the whole code for the page.
-
Allende about 10 yearsyw ! the code above can be improved (I;m pretty sure even if I don't know how), I have an idea for a shortest way to check for a duplicate value, can since I'm at work have no time to test it until later, see ya !
-
Admin about 10 yearsCheers A. I'm having a play to see if I can add which number has been duplicated.
-
Allende about 10 yearsIn the alert do
alert("A duplicated value: " + $(allFieldsForOrder[i-1]).val());
-
Admin about 10 yearsThanks for the changes to your script. The changes to using the input tag from within the form instead of the class event is really good. I'll look forward to seeing the other ideas. Also, thanks for alter script. I got it partly right. I didn't use the $ and enclose the i-1 in square brackets (I used round brackets).
-
Admin about 10 yearsJust a quick aside, is there a way to check for the duplicates when the submit button is clicked?
-
Allende about 10 yearsYes it is, but will change the "logic" for the loop. Check this question/answer: stackoverflow.com/questions/18545941/jquery-on-submit-event
-
Allende about 10 yearsThis answer could help you, but you will have to change the html you're generating: stackoverflow.com/questions/14614958/… in order to use unique id's and a "group" name attribute "PositionNumber[]" or you could try with a couple of nested loops just o see if there's a value duplicated
-
Allende about 10 years@MartySmartyPants I just added another piece of code, it could help you.
-
Allende about 10 yearsHope some one else can provide a better code I think the last one is my current-best
-
Admin about 10 yearsThis just keeps getting better A. Thanks mate. You're a star.
-
Admin about 10 yearsAaaarrrgggghhh! I spoke to soon. I'm getting the same alert popup (for duplicates and non-duplicates) and it states 'duplicated value:undefined'. I've tried changing the 'name' attribute to 'id' (as in the form the 'name' attribute is 'name="PositionNumber<%=counter %>"') but no change. Damn.
-
Allende about 10 years@MartySmartyPants mmm weird I just tested and it worked, notice I changed the variable name to "exists" (from duplicated) and I used to get the duplicated value in tempArray: jsbin.com/rudagulo/1/edit?html,js,output
-
Kevin Huntly about 10 yearsUsing your link to jsbin, when I run the code I get this in the console:
"Error: Syntax error, unrecognized expression: input[type='text'][name^='PositionNumber' (line 2)"
-
Admin about 10 yearsThink I might have found the problem. The line
$("input[type='text'][name^='PositionNumber'").each(function(){
is missing a closing square bracket after 'PositionNumber'. -
Prashant Adlinge almost 3 yearsToo heavy operation for meld
-
NZD over 2 yearsCommand works fine; there's however a stray
-C
in it. -
VasyaNovikov over 2 years@NZD Thanks! Fixed