String representation of a byte value in byte form
Hello,
Suppose I have the following code:
byte bArray[] = new byte[18];
for(int i = 0; i < bArray.length; i++)
{ bArray[i] = (byte)i; }How would I get the value of the byte not in decimal? I want the value of say 10 as "a". How would I get the string "a"?
byte b = 0x3f
char x = (char) b;
Similar Messages
-
Very slow performance when assigning value to a form item
Dear all,
I have an add-on form that contains 30 text edits. I did not creat the from with screen painter but positioned them by marking each item's top and left position in the new sub.
I have named them as 'edBox1', 'edBox2'......, 'edBox30'
At a point I need to assign value to each edit text, I have queried the content from DB into one recordset. However, when I start to assign values to each edit text, the performance became very slow.
my code is as follow
me.form.items.item("edBox1").Specific.String = recordset.field.item(0).value.tostring
me.form.items.item("edBox30").Specific.String = recordset.field.item(29).value.tostring
I found that B1 seem to iterate each item on the form in order to find the item I specified.
so I think I should specificy items earler.
Now for each item I dim an object for it at new sub
Dim oedBox1 As SAPbouiCOM.EditText
Dim oedBox30 As SAPbouiCOM.EditText
and while creating forms, I specificy each item to the matched object
Then I assign values to items by
oedBox1.String = recRetrive.Fields.Item(0).Value.ToString
oedBox30.String = recRetrive.Fields.Item(29).Value.ToString
However, B1 still iterates to find the item and the performance is still slow, does anyone has a better solution to this issue? please kindly advise.
Thank you
Alan
Edited by: Chih-Peng Chen on Dec 17, 2007 8:42 AMHi Chen,
you can find one example under SDK samples which will guide on using datasources
Bind the controls to dbdataource and then query the datasource.
then update form using oForm.Update(),this will automatically fill the values in all edit boxes and it will be very fast as well
Hope it helps you
Regards
Vishnu -
ASCII representations of double-byte characters
My file contains ASCII representations of double-byte CJK characters (output of native2ascii). How do I restore them back to the original native characters?
I mean, when I load the file with FileInputStream, what I get are all strings like \uabcd. How do I get the characters represented by these strings?My file contains ASCII representations of double-byte
CJK characters (output of native2ascii. How do
I restore them back to the original native
characters?
I am no expert in unicode so I don't know if this is correct, but I assume that if a String starts with "\u" then there will be 4 more characters that are a hexadecimal representation of the char value. If that's right, then you should be able to parse out the "\uxxxx" and convert it to a char by parsing the hex. For example//the variable unicode is a String like \uabcd
String hex = unicode.substring(2);
char result = (char) (Integer.parseInt(hex,16)); -
"buffer too small for string or missing null byte" inserting CR in excel
I have created a Crystal Report based on below stored procedure.
DELIMITER $$
DROP PROCEDURE IF EXISTS `ww_test`.`PRD_Data_sp` $$
CREATE PROCEDURE `ww_test`.`PRD_Data_sp` (in cyear int, in cmonth int, in groupby varchar(20), in Inv_type varchar(4))
BEGIN
select
CASE WHEN groupby='Date' THEN (p.FKDAT)
WHEN groupby='SalesOrg' THEN CONCAT(p.VKORG,'_',p.VTWEG)
END ,
sum(p.QTYSAM),
sum(p.CASESSOLD),
sum(p.SOLDDOL)
from ww_test.prd_data p
where (month(p.FKDAT)=cmonth and year(p.FKDAT)=cyear) and
((p.FKART) is null or not(p.FKART in ("FAZ","ZMBB","FAS",Inv_Type))) and
((p.AUART) is null or not(p.AUART in ("ZMBB")))
Group by
CASE WHEN groupby='Date' THEN (p.FKDAT)
WHEN groupby='SalesOrg' THEN CONCAT(p.VKORG,'_',p.VTWEG)
END
Order by
CASE WHEN groupby='Date' THEN (p.FKDAT)
WHEN groupby='SalesOrg' THEN CONCAT(p.VKORG,'_',p.VTWEG)
END;
END $$
DELIMITER ;
I have used Add Command to create report based on this.
call ww_test.prd_data_sp({?Year},{?Month},{?GroupBy},{?InvType});
I am able to refresh the report in crystal and as well in Infoview without any problem.
But when i try to insert this report in Excel using Live Office it gives me error. I able to insert other crystal reports without any problem.
An error occurred while opening the report. The report does not exist; you have insufficient rights to open the report; or you cannot make a connection to the BusinessObjects Web Service. (LO 02010)
Failed to open report (LO 26619)
Cannot open report document
Buffer too small for string or missing null byte.
can anyone suggest where i am going wrong? Any input is appreciated.
Crystal Reports 2008
Live Office XI 3.1
BOEdge XI 3.1
Xcelsius 2008
Thanks ,
MadhaviWith the CurrentValue method
Crpt.ParamFields[3].CurrentValue := memo1.Text;
Is there another solution ? -
Get the timestamp value in the form of array of 8 bytes, whileretrieving da
3) How we can get the timestamp value in the form of array of 8 bytes, while retrieving the data?
4.) How we can pass the 8 byte array to stored procedure? What will the data type of the parameter?duplicate post:
timestamp value in the form of array of 8 bytes -
Timestamp value in the form of array of 8 bytes
1) How we can get the timestamp value in the form of array of 8 bytes, while retrieving the data?
2) How we can pass the 8 byte array to stored procedure? What will the data type of the parameter?1). using to_char
SQL> select to_char(systimestamp, 'ddmmyyyy') from dual ;
TO_CHAR(
10052006
SQL>2). as varchar2, and use to_timestamp to convert to timestamp:
SQL> select to_timestamp('10052006', 'ddmmyyyy') from dual ;
TO_TIMESTAMP('10052006','DDMMYYYY')
10-MAY-06 12.00.00.000000000 AM
SQL> -
Numeric Value to String representation
Hi!
I was wondering if there was an easy way to getting the String representation of a number (specifically an integer). I am trying to format a message that would be like this:
Three (3) records have been updated.
Getting the (3) is easy, but my problem is getting the word Three. There are numerous records, which means an Array would be close to impossible coz it will take time to produce an output.
Is there an easy way? (1 = One, 2 = Two,..., 20 = Twenty)
Thanks!I'd guess that a switch statement will be about as fast as anything else, since it's a static structure and the compiler should be able to optimize it effectively.
int number = setMeToAValue;
switch (number) {
case 0: System.out.println("zero"); break;
case 1: System.out.println("one"); break;
case 2: System.out.println("two"); break;
case 3: System.out.println("three"); break;
case 4: System.out.println("four"); break;
case 5: System.out.println("five"); break;
case 6: System.out.println("six"); break;
case 7: System.out.println("seven"); break;
case 8: System.out.println("eight"); break;
case 9: System.out.println("nine"); break;
case 10: System.out.println("ten"); break;
case 11: System.out.println("eleven"); break;
case 12: System.out.println("twelve"); break;
case 19 System.out.println("nineteen"); break;
case 20 System.out.println("twenty"); break;
case 30 System.out.println("thirty"); break;
case 40 System.out.println("forty"); break;
To get 21 go after the parts and concantenate them. case 20 + case 1 produces 21, etc -
hii guys
i m trying to read an image and convert it to byte array and later to do some change in that byte array and later recreate a new image.
For that i m using FileInputStream and FileOutputStream and its read and write methods
but now i dont know how to append that byte and recreate that image.
actually i want to do that , convert the image in byte array form and replacing some bytes of the image by my text msg bytes and recreate a new image.
how an i do that.
plz help me.
its urgent.import java.io.*;
class image
public static void main(String[] arg) throws IOException
String msg;
int len,i;
FileInputStream fin;
FileOutputStream fout;
try
try
fin=new FileInputStream("01.jpg");
catch( Exception e)
System.out.println("Input image not found");
return;
try
fout=new FileOutputStream("001.jpg");
catch( Exception e)
System.out.println("output image cannt be created");
return;
catch(Exception e)
System.out.println("output image cannt be created");
return;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the secret msg :: ");
msg=br.readLine();
byte[] msg1=msg.getBytes();
len=msg1.length;
System.out.println(len);
for(i=0;i<len;i++)
System.out.println(msg1);
try
do
byte by=(byte)fin.read();
//System.out.print(" "+by);
if(fin.available()>0)
fout.write(by);
}while(fin.available()>0);
catch(Exception e)
System.out.println("File error");
fin.close();
fout.close();
till now i only imputed the sg , change it into byte form .
now i want to replace the msg bytes into the image byte as :- 1 image byte ,1 msg byte, 1 image byte , 1 msg byte........ so on
until the msg bytes are not finished. -
XML Nodeset to String representation
I'm trying to assign/cast an XML nodeset to a string and retain all of the element tags in the string representation. I've tried using the string(), getNodeValue(), and get-content-as-string() expression functions, but all appear to strip the element tags from the string output. Anyone have an idea how to go about this?
Thanks,
PeterOddly enough, this transform did the trick...
<xsl:template match="/">
<ns0:Blahqueue>
<blahInstance>
<xsl:value-of select="orcl:get-content-as-string(/mstns:blahSchema)"/>
</blahInstance>
</ns0:Blahqueue>
</xsl:template> -
Compare a String Array to get Higher value
Hi, I'm trying to figure out how can I create a method in which I can compare my array of String by getting the higher value. For example I have an array called faces[]. What I would like to say is that if 2 is less than 5, and so forth print "blahhhh". I would appreciate some ideas on which is the best way to do this. Thanks a lot. Here is the code so far. I'm working on checkWinner() method
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class WarCard extends JFrame implements ActionListener {
private Card deck[];
private int currentCard, value, winner;
private JPanel buttonPanel, labelPanel, textFieldPanel;
private JButton buttons[];
private JLabel labels[];
private JTextField textFields[];
public WarCard()
super( "War! " );
String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" };
String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" };
deck = new Card[ 52 ];
currentCard = -1;
//populate deck
for ( int count = 0 ; count < deck.length; count++ )
deck[ count ] = new Card( faces[ count % 13], suits[ count / 13 ] );
// get content pane and create layout
Container container = getContentPane();
// create label grid
labels = new JLabel[3];
labels[ 0 ] = new JLabel( "Player 1: ");
labels[ 1 ] = new JLabel( "Player 2: ");
labels[ 2 ] = new JLabel( "Shuffle cards to begin" );
labelPanel = new JPanel();
labelPanel.setLayout( new GridLayout( 3, labels.length ) );
for ( int count = 0; count < labels.length; count++) {
labelPanel.add( labels[ count ] );
}// end for loop
container.add( labelPanel, BorderLayout.WEST );
// create text field grid
textFields = new JTextField[ 3 ];
textFields[ 0 ] = new JTextField( 20 );
textFields[ 1 ] = new JTextField( 20 );
textFields[ 2 ] = new JTextField( 20 );
textFieldPanel = new JPanel();
textFieldPanel.setLayout( new GridLayout( 3, textFields.length ) );
for ( int count = 0; count < textFields.length; count++) {
textFields[ count ].setEditable( false );
textFieldPanel.add( textFields[ count ] );
}// end for loop
container.add( textFieldPanel, BorderLayout.EAST );
// create button grid
buttons = new JButton[ 3 ];
buttons[ 0 ] = new JButton( "Deal" );
buttons[ 1 ] = new JButton( "Shuffle" );
buttons[ 2 ] = new JButton( "Exit" );
buttonPanel = new JPanel();
buttonPanel.setLayout( new GridLayout( 1, buttons.length ) );
for ( int count = 0; count < buttons.length; count++) {
buttons[ count ].addActionListener( this );
buttons[ 0 ].setEnabled( false );
buttonPanel.add( buttons[ count ] );
}// end for loop
container.add( buttonPanel, BorderLayout.SOUTH );
setSize( 425, 150 );
setVisible( true );
private void checkWinner()
int i = 0;
for( i=0; i < 13; i++ ){
if ( s[ 0 ].equals("2 of Spades") & s[ 1 ]!="2 of Spades" ){
txtGame[ 2 ].setText( " You Win " );
else{
txtGame[ 2 ].setText( " Compuer Win" );
public static void main( String agrs[] )
WarCard application = new WarCard();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
public void actionPerformed( ActionEvent event)
String testString = "";
for ( int count = 0; count < buttons.length; count++) {
if ( event.getSource() == buttons[ 0 ] ) {
Card dealt1 = dealPlayer1();
Card dealt2 = dealPlayer1();
if ( dealt1 != null || dealt2 != null ) {
textFields[ 0 ].setText( dealt1.toString() );
textFields[ 1 ].setText( dealt2.toString() );
labels[ 2 ].setText( "# of Cards : " + currentCard);
else {
textFields[ 2 ].setText( "All Cards Dealt" );
labels[ 2 ].setText( "Shuffle Cards to continue" );
else if ( event.getSource() == buttons[ 1 ] ) {
shuffle();
textFields[ 0 ].setText( " " );
textFields[ 1 ].setText( " " );
labels[ 2 ].setText( "Shuffled!");
else if ( event.getSource() == buttons[ 2 ] ) {
System.exit( 0 );
}// end for loop
}// end method actionPerformed
private void shuffle()
currentCard = -1;
for ( int first = 0; first < deck.length; first++ ) {
int second = ( int ) ( Math.random() * 52 );
Card temp = deck[ first ];
deck[ first ] = deck[ second ];
deck[ second ]= temp;
buttons[ 0 ].setEnabled( true );
private Card dealPlayer1()
if ( ++currentCard < deck.length )
return deck[ currentCard ];
else {
buttons[ 0 ].setEnabled( false );
return null;
}// end of WarCard
class Card{
private String face;
private String suit;
public Card( String cardFace, String cardSuit )
face = cardFace;
suit = cardSuit;
public String toString()
return face + " of " + suit;
}// end toString
}// end class WarCardassign an int value to the card and use < == >
-
Calling a method via String representation of instance
Is it possible to call a method of a specific (and already existing) instance of a class using a string representation of the instance?
By "String representation of an instance," I simply mean a string that has the same format as a normal method call would have. So where a method would normally be called like this:
ClassX itsInstance = new ClassX();
itsInstance.methodX();
The string representation would be:
String instanceName = "itsInstance";
And there would be some way of using this string to call the method referred to by instanceName.
The idea here is that I want to use the existing instance, whereas using reflection, as below, would create a new instance:
String className = "X";
String methodName = "print";
Class xClass = Class.forName(className);
Method xMethod = xClass.getMethod(methodName,null);
Object object = xClass.newInstance();
xMethod.invoke(object,null); -
Pass Values to Edit Form thru Query String and Save in List
I have developed a custom Edit form from SharePoint Designer and I am passing values thru Query String as below;
http://<>/cli/acc/Lists/GIInfo/testEdit.aspx?ID=262&com=POD_Send
And, user supposed to save the form directly without changing the values came thru Query String as below.
Now, issue is, when user saves the form, values is not getting saved. It saves when we change the value in text box or when we do a text change event in form. Becasue data binding says Text Change even in data binding property.
__designer:bind="{ddwrt:DataBind('u',concat('ff22',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Actions')}"/>
Kindly guide me what is the issue, or correct approach to do that? I want to pass values to Edit Form thru Query string and save in List without changing those.
-Rajesh A.I know this is late, but i found a very good solution on this post and credit goes to the author.
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/4be1be38-0663-4b80-8f28-45f38f98f9d0/sharepoint-designer-2010-custom-newformaspx-data-in-textbox-fields-dont-save-on-submission?forum=sharepointcustomizationprevious
The issue was resolved by changing the textbox values,
<asp:TextBox runat="server" id="ff1{$Pos}" Name="Title" Text="" Value="{$Destination}" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}">
instead of
<asp:TextBox runat="server" id="ff1{$Pos}" Name="Title" Text="{$Destination}" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"> -
Hi All,
I am working with an integration project where I want to integrate application with Agile PLM ACS. In my project my BPEL is reading data from a JMS queue in which Agile is writing data. That means Agile is writing data to a JMS queue and my BPEL is reading data from that JMS queue. Now the issue which I am facing is when Agile is writing data to the JMS queue it is not in text it in Bytes form. Do we need to do some weblogic JMS configuration for getting data in text instead of bytes?Hello,
I think single custom list is enough. Just design the list as per you requirement then modify the list page in infopath designer to put validation and rules (if require OR want to decorate your page). Then allow user submit data in same list.
Later you can write small powershell script with will read data from list and save into database. You can also schedule this powershell with windows task scheduler so this process can be automated.
I have done same thing for my proj as well.
Here is the ref to export list data to SQL:
http://community.obilogic.co.uk/blogs/teamblog/archive/2012/04/22/sharepoint-2010-export-splist-data-into-sql-using-powershell.aspx
http://www.terrymarshall.com.au/Blog/tabid/162/EntryId/165/SharePoint-2010-Exporting-Lists-To-SQL-Server-Part-2.aspx
Link to schedule powershell:
http://sajiviswam.wordpress.com/2011/07/14/scheduling-sharepoint-powershell-scripts-in-windows-server-2008-r2/
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
Cfchart and JSON string representation
I am trying to pass a JSON string representation for the attribute "plotarea" in this way :
<cfchart
chartWidth="800"
chartHeight="600"
showLegend="yes"
format="png"
title="Commandes"
plotarea='#{"margin-top":"dynamic"}#' >
But I got following error :
Error casting an object of type to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.
Is there any documentation explaining how to use "JSON string representation" in cfchart attributes ?Code_Worm wrote:
Is it possible for me to call my toString method of Manager class within Branch class?Sure as long as it is public. There is no magic or any difference in regards to the toString method to any other method that you create. So somewhere in your Branch class you have:
String blah = manager.toString(); -
System.__ComObject String Representation
I have what is probably a very noob question. I have a variable of type System.__ComObject, and I want to try to get a String representation of this for debugging purposes. When I simply print the variable, "System.__ComObject" is displayed.
For context, I have a basic html page which looks like this:
<html>
<body>
<table>
<tr>
<th>...</th>
</tr>
<tr>
<td><a href...>...</a></td>
</tr>
</table>
</body>
</html>
And I am trying to drill down to the href links in the table. I have this code:
$webclient = new-object System.Net.WebClient
$webclient.UseDefaultCredentials=$true
$geturl = Invoke-WebRequest $url
$webpage = $geturl.parsedhtml.body
$list = $webpage.table#.tr
echo "list: $webpage"
if($list -eq $null) {
echo "list is null"
} else {
echo "list is not null"
Where $list is null for some reason. I am attempting to determine what $webpage contains so I can figure out why it can't find the table tag.
Any help is appreciated.Hi Aussiemcgr,
We can view the available methods via "$webpage|get-member" before you use the method.
If there is tables inside this webpage, please try to use the script below:
@($geturl.ParsedHtml.getElementsByTagName("table"))[0].OuterHTML
For more detailed information about this script, please check this article:
Importing Website Tables into Excel
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang
Maybe you are looking for
-
Maximum boosts to RAM and graphics card for iMac G5 PowerMac 8.1?
Hi. Just bought this still excellent machine secondhand with a 3 month rtb warranty. It currently has these specs, and I'd like to know what level I can take them to at maximum for Graphics Card, RAM and maybe hard drive. Machine Name: iMac G5 Machin
-
How to remove and fill in areas of a picture
I am using the 30 day trial of Photoshop and trying to use online Help to learn the "how to's" BUT I'm finding it dificult to always follow the videos and explanations. I want to remove unwanted areas of a photo and then fill in those areas to match
-
When I try to launch itunes I get an error mesage saying that Apple application support was not found and suggests that I uninstall and re-install it, but that doesn't work
-
No sound on clips when importing video in Final Cut Pro X
I recently got a new Mac Pro tower and installed Final Cut Pro X in it. I have imported 4K media into my library and since the footage was located in the same drive, I left the files in place and created proxy media to make the editing easier and fas
-
Unabel to connect SQLState=IM001
Hi all, I am trying to connect to the server throught the Oracle client 9.2.0.1 I get the following error message Unable to connect SqlState=IM001 *[Microsoft][ODBC Driver Manager] Driver does not support this Function.* I copied the 9.2.0.2 ODBC div