|
hi guy, can u help me convert this code to VB6 or VB .Net??
/* Version 0.1 of F5 Steganography Software by Andreas Westfeld 1999 */
/*********************************************************/
/* JPEG Decoder */
/* Sean Breslin */
/* EE590 Directed Research */
/* Dr. Ortega */
/* Fall 1997 */
/* */
/* HuffTable.class: */
/* Extracts Huffman table from image header */
/* data. Instanciate one class for each table */
/* in the file the header. */
/* */
/* Methods: */
/* getHUFFVAL(), returns HUFFVAL array */
/* getVALPRT(), returns VALPTR array */
/* getMAXCODE(), returns MAXCODE array */
/* getMINCODE(), returns MINCODE array */
/* */
/********************** 11/4/97 **************************/
/* /////////////// DISCLAIMER/////////////////////////////////
This software is provided by the author and
contributors ``as is'' and any express or implied
warranties, including, but not limited to, the
implied warranties of merchantability and
fitness for a particular purpose are dis-
claimed. In no event shall the author or con-
tributors be liable for any direct, indirect,
incidental, special, exemplary, or consequen-
tial damages (including, but not limited to,
procurement of substitute goods or services;
loss of use, data, or profits; or business
interruption) however caused and on any
theory of liability, whether in contract,
strict liability, or tort (including negligence
or otherwise) arising in any way out of the use
of this software, even if advised of the poss-
ibility of such damage.
//////////////////////////////////////////////////////*/
// westfeld
package ortega;
import java.io.*;
public class HuffTable {
// Instance variables
private int[] BITS = new int[17];
private int[] HUFFVAL = new int[256];
private int[] HUFFCODE = new int[257];
private int[] HUFFSIZE = new int[257];
private int[] EHUFCO = new int[257];
private int[] EHUFSI = new int[257];
private int[] MINCODE = new int[17];
private int[] MAXCODE = new int[18];
private int[] VALPTR = new int[17];
private int Ln, SI, I, J, K, LASTK, CODE;
// Constructor Method
public HuffTable(DataInputStream d, int l) {
dis = d;
// System.out.println("L鋘ge="+l);
// Get table data from input stream
Ln=19+getTableData();
// System.out.println(Ln);
Generate_size_table(); // Flow Chart C.1
Generate_code_table(); // Flow Chart C.2
Order_codes(); // Flow Chart C.3
Decoder_tables(); // Generate decoder tables Flow Chart F.15
}
public int getLen() {
return Ln;
}
// IO MethodS
public int[] getHUFFVAL() { return HUFFVAL; }
public int[] getVALPTR() { return VALPTR; }
public int[] getMAXCODE() { return MAXCODE; }
public int[] getMINCODE() { return MINCODE; }
private int getByte() {
try {
return dis.readUnsignedByte();
}
catch (IOException e) { return -1; }
}
private int getTableData(){
// Get BITS list
int count=0;
for(int x=1;x<17;x++) {
BITS[x] = getByte();
count += BITS[x];
}
// Read in HUFFVAL
for(int x=0;x<count;x++){
system.out.println(ln);
="" huffval[x]="getByte();
" }
="" return="" count;
="" }
="" private="" void="" generate_size_table()="" {
="" generate="" huffsize="" table="" flow="" chart="" c.1
="" k="0;" i="1;" j="1;
" while(true)="" if(j="">BITS[I]) {
J=1; I++;
if(I > 16)
break;
}
else {
HUFFSIZE[K++]=I;
J++;
}
}
HUFFSIZE[K] = 0;
LASTK = K;
}
private void Generate_code_table() {
// Generate Code table Flow Chart C.2
K = 0; CODE = 0; SI = HUFFSIZE[0];
while(true) {
HUFFCODE[K++] = CODE++;
if(HUFFSIZE[K] == SI)
continue;
if(HUFFSIZE[K] == 0)
break;
while(true){
CODE<<=1;
SI++;
if(HUFFSIZE[K] == SI)
break;
}
}
}
private void Order_codes() {
// Order Codes Flow Chart C.3
K=0;
while(true) {
I = HUFFVAL[K];
EHUFCO[I] = HUFFCODE[K];
EHUFSI[I] = HUFFSIZE[K++];
if(K >= LASTK) break;
}
}
private void Decoder_tables() {
// Decoder table generation Flow Chart F.15
I = 0; J = 0;
while(true) {
if(++I > 16)
return;
if(BITS[I] == 0)
MAXCODE[I] = -1;
else {
VALPTR[I] = J;
MINCODE[I] = HUFFCODE[J];
J = J + BITS[I] - 1;
MAXCODE[I] = HUFFCODE[J++];
}
}
}
// Declare input steam
DataInputStream dis;
}
|
|
|
|
|
Try somthing like this, you'll have to work out the bugs:
'/----------------------------------------------------
Imports System
Namespace ortega
Public Class HuffTable
Public Overridable ReadOnly Property Len() As Integer
Get
Return Ln
End Get
End Property
Private ReadOnly Property Byte() As Integer
Get
Try
Return dis.ReadByte
Catch e As System.IO.IOException
Return -1
End Try
End Get
End Property
Private ReadOnly Property TableData() As Integer
Get
Dim count As Integer = 0
Dim x As Integer = 1
While x < 17
BITS(x) = Byte
count += BITS(x)
System.Math.Min(System.Threading.Interlocked.Increment(x),x-1)
End While
Dim x As Integer = 0
While x < count
HUFFVAL(x) = Byte
System.Math.Min(System.Threading.Interlocked.Increment(x),x-1)
End While
Return count
End Get
End Property
Private BITS As Integer() = New Integer(17) {}
Private HUFFVAL As Integer() = New Integer(256) {}
Private HUFFCODE As Integer() = New Integer(257) {}
Private HUFFSIZE As Integer() = New Integer(257) {}
Private EHUFCO As Integer() = New Integer(257) {}
Private EHUFSI As Integer() = New Integer(257) {}
Private MINCODE As Integer() = New Integer(17) {}
Private MAXCODE As Integer() = New Integer(18) {}
Private VALPTR As Integer() = New Integer(17) {}
Private Ln As Integer
Private SI As Integer
Private I As Integer
Private J As Integer
Private K As Integer
Private LASTK As Integer
Private CODE As Integer
Public Sub New(ByVal d As System.IO.BinaryReader, ByVal l As Integer)
dis = d
Ln = 19 + TableData
Generate_size_table
Generate_code_table
Order_codes
Decoder_tables
End Sub
Public Overridable Function getHUFFVAL() As Integer()
Return HUFFVAL
End Function
Public Overridable Function getVALPTR() As Integer()
Return VALPTR
End Function
Public Overridable Function getMAXCODE() As Integer()
Return MAXCODE
End Function
Public Overridable Function getMINCODE() As Integer()
Return MINCODE
End Function
Private Sub Generate_size_table()
K = 0
I = 1
J = 1
While True
If J > BITS(I) Then
J = 1
System.Math.Min(System.Threading.Interlocked.Increment(I),I-1)
If I > 16 Then
' break
End If
Else
HUFFSIZE(System.Math.Min(System.Threading.Interlocked.Increment(K),K-1)) = I
System.Math.Min(System.Threading.Interlocked.Increment(J),J-1)
End If
End While
HUFFSIZE(K) = 0
LASTK = K
End Sub
Private Sub Generate_code_table()
K = 0
CODE = 0
SI = HUFFSIZE(0)
While True
HUFFCODE(System.Math.Min(System.Threading.Interlocked.Increment(K),K-1)) = System.Math.Min(System.Threading.Interlocked.Increment(CODE),CODE-1)
If HUFFSIZE(K) = SI Then
' continue
End If
If HUFFSIZE(K) = 0 Then
' break
End If
While True
CODE <<= 1
System.Math.Min(System.Threading.Interlocked.Increment(SI),SI-1)
If HUFFSIZE(K) = SI Then
' break
End If
End While
End While
End Sub
Private Sub Order_codes()
K = 0
While True
I = HUFFVAL(K)
EHUFCO(I) = HUFFCODE(K)
EHUFSI(I) = HUFFSIZE(System.Math.Min(System.Threading.Interlocked.Increment(K),K-1))
If K >= LASTK Then
' break
End If
End While
End Sub
Private Sub Decoder_tables()
I = 0
J = 0
While True
If System.Threading.Interlocked.Increment(I) > 16 Then
Return
End If
If BITS(I) = 0 Then
MAXCODE(I) = -1
Else
VALPTR(I) = J
MINCODE(I) = HUFFCODE(J)
J = J + BITS(I) - 1
MAXCODE(I) = HUFFCODE(System.Math.Min(System.Threading.Interlocked.Increment(J),J-1))
End If
End While
End Sub
Friend dis As System.IO.BinaryReader
End Class
End Namespace
'/------------------------------------------------
progload
|
|
|
|
|
hmm, Thanks..
how about this??
private final static int APP0 = (int)0xE0;
private int[][]Huffval = new int[4][];
|
|
|
|
|
|
Dear friends,
I have one machine who is creating one kind of image which contains some important data. By this data I am making calculation to get the result.
Can some one tell me how can I read that data from the image directly by vb.net and use it in the program without manual calculation. It means can I read the data written on the image.
Your quick response will be hihgly appriciated.
Thankxx
Patel Murtuza
|
|
|
|
|
Your best solution is going to be some kind of Optical Character Recognition, or OCR. You can find a bunch of articles here[^] on CodeProject.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to skin forms of .net
How to give diffrent skins to .net forms
Harshad Pednekar
|
|
|
|
|
if u use .NET xpress edn i.e. 2005 edn, there u can Enable XP visual styles, that means if u install some theams in XP, that u will see in ur form!
if not then create a file say ini file which should contains the color values of buttons..etc..etc
a typical file may look like:
// comments
$ Form.backcolor=<some value="">
$ Form.buttons=<some value="">
// blah blah
save that file according to some skin name, say "Matrix.skin"
and when ur loadin ur app read all da color values from dat file and set up ur GUI.
Remember u shud setup a default skin file.
Hope dat helps.
this is not the end, this is how its goin to begin !
|
|
|
|
|
Sorry but i use Visual Basic 2003
So how can i come up with this problem
plz give me the solution if u can
Regards,
Harshad Pednekar
|
|
|
|
|
hi there,
i want to add a listview like another childnode after all child nodes of a parentnode
iam able to add listview but the problem is iam unable to add like another child node
that listview should be displayed after all child nodes when we expand any parent node
i will be very thankful if anybody can help me out
thanks in advance
nagaraju kondepudi
|
|
|
|
|
Child nodes are displayed in the order that they're added to the Nodes collection of the parent. Sooooo, you'd have to remove the ListView from the parents Nodes collection, add your new child node, then put the ListView back into the collection.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
first of all thanks for your interest
i can add a listview to treeview but the problem is how to increase indent.
that is listview is overriding all child nodes and remaning node of that treeview.so i want to increase enough height so that after listview remaining nodes will be displayed properly.
thanks in advance
nagaraju kondepudi
|
|
|
|
|
kondepudi nagaraju wrote: but the problem is how to increase indent.
Now you've changed the question.
If you want to increase the indent while being a member of the same parent as other nodes, you'll have to owner-draw the listview. There's no other way. Search the articles here for "custom listview" for some examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i am writeing the next code in a click button ,
when i run it and put a value , it dose not display the value it display the hole report ...
Dim MyParameterFields As New CrystalDecisions.Shared.ParameterFields
Dim MyParameterField As New CrystalDecisions.Shared.ParameterField
Dim MyDiscretValue As New CrystalDecisions.Shared.ParameterDiscreteValue
MyParameterField.ParameterFieldName = "ComplaintID"
MyDiscretValue.Value = TextBox1.Text
MyParameterField.CurrentValues.Add(MyDiscretValue)
MyParameterFields.Add(MyParameterField)
crv1.ParameterFieldInfo = MyParameterFields
crv1.ReportSource = "C:\sadranim_new\CrystalReport1.rpt"
any help will be appreciated ..
|
|
|
|
|
Heeeelp! This error occured when I created a new form and tried to build the solution. I did absolutely no changes to the form, just created it and tried to build. Help!
Error 1 <br />
<br />
The "GenerateApplicationManifest" task failed unexpectedly.<br />
System.Xml.XmlException: Root element is missing.<br />
at System.Xml.XmlTextReaderImpl.Throw(Exception e)<br />
at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)<br />
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()<br />
at System.Xml.XmlTextReaderImpl.Read()<br />
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)<br />
at System.Xml.XmlDocument.Load(XmlReader reader)<br />
at System.Xml.XmlDocument.Load(Stream inStream)<br />
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.TrustInfo.Read(Stream s, String xpath)<br />
at Microsoft.Build.Tasks.Deployment.ManifestUtilities.TrustInfo.Read(String path)<br />
at Microsoft.Build.Tasks.GenerateApplicationManifest.AddClickOnceFiles(ApplicationManifest manifest)<br />
at Microsoft.Build.Tasks.GenerateApplicationManifest.BuildApplicationManifest(ApplicationManifest manifest)<br />
at Microsoft.Build.Tasks.GenerateApplicationManifest.OnManifestLoaded(Manifest manifest)<br />
at Microsoft.Build.Tasks.GenerateManifestBase.BuildManifest()<br />
at Microsoft.Build.Tasks.GenerateManifestBase.Execute()<br />
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
----
Dim Sleepy as Boolean = True
If Me.Sleepy = True Then
Goto Sleep
End If
----
|
|
|
|
|
Try killing off the bin folder in your project folder. If that doesn't work, move the project folder to the root of the drive and see what happens.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want some help(in terms of code) on how to read a particular job(in mainframe) that runs daily and to get the time at which it has run.I want the code in VB only.The port is 23 and 3270 emulation mode.I want the code urgently.I use Extra! Personal CLient. In that I check in SAR everyday whether a particular job has run or not anf if so what's the date & time.
-- modified at 6:24 Monday 20th February, 2006
|
|
|
|
|
You'll need a 3270 emulation class library. If you don't have one, I highly suggest picking one up (Google results[^]) instead of trying to write your own.
You'll then have to send the appropriate commands to the mainframe to get what you want. Just like you would if you were sitting at the keyboard yourself. You'll then parse up the returned screen using the 3270 class to get the information.
We really can't be any more specific then that because 1) Each 3270 class library is going to be different, and 2) each mainframe implementation of whatever scheduler is going to be different.
For more information, consult the documentation on the 3270 library your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 10:53 Monday 20th February, 2006
|
|
|
|
|
Hi,
This question is more out of curiosity rather than a neccesity.
VB .Net is Object Oriented. It's my understanding that object can be referenced by other objects, does this mean that if it's value changes, other object needn't ask it what it's new value is?
I'm still trying to grasp the concept though.
If I have a "Public Overridable ReadOnly Property" which is in a class that I did not create, how can I add my code to that property? I can't edit code in a COM control's class, maybe override??
What I want is live tracking of any changes in the value of that property. (Hence the question above)
Is there any object I can put in a form to display the value of that property even when it changes without me having to poll that object to ask it for it's property's value?
Thanx!
|
|
|
|
|
Your questions are confusing, but I will give it a try...
It's my understanding that object can be referenced by other objects, does this mean that if it's value changes, other object needn't ask it what it's new value is?
No, it does not mean that. If you have a class C, which has a property x, from which you make an object O, then you can reference that property as O.x. If the value of x changes, and after it changes you reference O.x again, you will get the new value. Technically, you are asking for it's new value when you do this.
If I have a "Public Overridable ReadOnly Property" which is in a class that I did not create, how can I add my code to that property? I can't edit code in a COM control's class, maybe override??
Yes, if the class is overridable, then you can override it. You can define a class C2 which can inherit class C. In C2 you can define a new x method using your own code. Then when you make an object O2 from C2, you can reference O2.x and it will use your new code. However, if you reference some other property that you did not override is C2, say O2.y, then it will use the code from the original C.y.
I hope this helps.
Roy.
|
|
|
|
|
Hi,
I am creating a web parts control containing a listbox, a button and a context menu using visual basic.net. I have created both controls and would like to add a selectionIndexChanged event handler for the listbox but the intellisense list did not display the listbox control.
Here is a code snippet:
Protected Overrides Sub CreateChildControls()
listbox1 = new listbox //adding a listbox control
listbox1.ID = "List1"
listitem1.Text = "Testing"
listbox1.Items.Add(listitem1)
Me.Controls.Add(listbox1)
//intellisense didnt display the listbox for event handling! [?]
button1 = new button //adding a button control
button1.ID = "Button1"
button1.Text = "Test"
Me.Controls.Add(button1)
AddHandler button1.Click, AddressOf button1_Click //intellisense did include the button control for event handling
End Sub
How do I allow event handling for the listbox? It seems that vb was unable to recognise the listbox for AddHandler
|
|
|
|
|
KaKa` wrote: //intellisense didnt display the listbox for event handling! [?]
Intellisense will only work with controls and classes that are created at design time. It won't show you anything about the controls your added because they only exist, or are created, at run time. You'll have to code the event handlers and wire them up (using AddHandler) by hand.
listbox1 = new listbox
listbox1.ID = "List1"
listitem1.Text = "Testing"
listbox1.Items.Add(listitem1)
AddHandler listbox1.SelectedIndexChanged, AddressOf ListBox1_SelectedIndexChanged
Me.Controls.Add(listbox1)
.
.
.
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
' Your event handler code goes here.
End Sub
If you dynamically create controls at runtime, you have to wire up any event handlers yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You need to define your listbox variable at the class level using the 'withevents' keyword. Here's an example:
<br />
Public Class Form1<br />
Private WithEvents list1 As ListBox<br />
<br />
Private Sub Form1_Load(yada,yada) Handles MyBase.Load<br />
list1 = New ListBox<br />
list1.Text = "Testing"<br />
End Sub<br />
End Class<br />
You should find that intellisense will give you the options you were missing.
|
|
|
|
|
Thank you for the replies
I have followed both advice and there is now an event handler for the listbox
|
|
|
|
|
How to compare two email is the same or not?
In my Case, A email
From : Kay
To : Jay, Amy
CC : Apple
Compare with kay's inbox, Jay's inbox, Amy's inbox, and Apple's inbox.
They have the same email.
Does any ID helps?
PS. Some Email is internal email, SMTP ID cannot use in my case.
Thanks!
|
|
|
|
|