Search Results

Search found 4214 results on 169 pages for 'binary serializer'.

Page 25/169 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • Best way to bundles photos with app: files or in sqlite database?

    - by Bryan Denny
    Lets say that I have an app that lets you browse through a listing of cars found in a Sqlite database. When you click on a car in the listing, it'll open up a view with the description of the car and a photo of the car. My question is: should I keep the photo in the database as a binary data column in the row for this specific car, or should I have the photo somewhere in the resources directory? Which is better to do? Are there any limitations of Sqlite in terms of how big a binary data column can be? The database will be pretty much be read only and bundled with the app (so the user wouldn't be inserting any cars and their photos).

    Read the article

  • I need an efficient protocol between webservices that are more or less supported by all major langua

    - by corgrath
    Hey all. I am looking for a fast and efficient protocol that can be used between different web services to send text-data (not binary data). Doesn't matter if the protocol is binary or text base. Some conditions: I has to be more "efficient" than normal XML which adds a lot of extra data and the tools to read/write is too heavy It has to be "supported" by most major languages, meaning it cannot only be available for one specific language. At the moment, both Java and PHP have to be able to talk to each other using this protocol. I have already looked at: XML - which I am currently using. Hessian 2 -which works perfectly in Java, but the PHP-support is out of date JSON -the different between JSON and XML is only minor Any suggestions are welcome!

    Read the article

  • How can I make my binary file is served as binary, not text when user choose "Save Linked File As..." in Safari?

    - by Eonil
    I'm serving a binary file (.IPA) with Ubuntu/Apache 2.2. When I have chosen Save Linked File As... in Safari, it says it's text file. And it guides me to add .txt extension. However it does not add any extra extension when I download it just clicking link. I added line AddType application/octet-stream .ipa in apache configuration file. I don't know what's wrong with this. Is this a bug of Safari or my misconfiguration? (1) If it caused by bug, how can I avoid this? (2) Or if it caused by misconfiguration, what should I do?

    Read the article

  • How can I make my binary file is served as binary and not text when user choose "Save Linked File As..." in Safari?

    - by Eonil
    I'm serving a binary file (.IPA) with Ubuntu/Apache 2.2. When I have chosen Save Linked File As... in Safari, it says it's text file. And it guides me to add .txt extension. However it does not add any extra extension when I download it just clicking link. I added line AddType application/octet-stream .ipa in apache configuration file. I don't know what's wrong with this. Is this a bug of Safari or my misconfiguration? (1) If it caused by bug, how can I avoid this? (2) Or if it caused by misconfiguration, what should I do?

    Read the article

  • EL syntax error: Expression cannot start with binary operator

    - by auser
    Anyone have any creative ideas for how I can solve this warning? EL syntax error: Expression cannot start with binary operator caused by the following code: String.format("#{myController.deleteItemById(%d)}", getId()) My code looked like this before: "#{myController.deleteItemById(" + getId() + ")}" but this caused eclipse to generate the following warning: EL syntax error: String is not closed UPDATE: @ManagedBean(name = "myController") @ViewScoped public class MyController implements Serializable { private long id; private HtmlPanelGroup panel; public long getId() {return this.id; } private void getPanel() { /// bunch of code for programatically creating a form HtmlCommandButton deleteButton = new HtmlCommandButton(); deleteButton.setId(id); deleteButton.setValue(value); deleteButton.setActionExpression(/* EL expression used here */); } } <?xml version='1.0' encoding='UTF-8' ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <!-- some other elements removed for the sake of clarity --> <h:body> <h:panelGroup binding="#{myController.panel}" /> </h:body> </html>

    Read the article

  • Reading binary data from serial port using Dejan TComport Delphi component

    - by johnma
    Apologies for this question but I am a bit of a noob with Delphi. I am using Dejan TComport component to get data from a serial port. A box of equipment connected to the port sends about 100 bytes of binary data to the serial port. What I want to do is extract the bytes as numerical values into an array so that I can perform calculations on them. TComport has a method Read(buffer,Count) which reads DATA from input buffer. function Read(var Buffer; Count: Integer): Integer; The help says the Buffer variable must be large enough to hold Count bytes but does not provide any example of how to use this function. I can see that the Count variable holds the number of bytes received but I can't find a way to access the bytes in Buffer. TComport also has a methord Readstr which reads data from input buffer into a STRING variable. function ReadStr(var Str: String; Count: Integer): Integer; Again the Count variable shows the number of bytes received and I can use Memo1.Text:=str to display some information but obviously Memo1 has problems displaying the control characters. I have tried various ways to try and extract the byte data from Str but so far without success. I am sure it must be easy. Here's hoping.

    Read the article

  • iPhone: Fastest way to create a binary Plist with simple key/value strings

    - by randombits
    What's the best way to create a binary plist on the iPhone with simple string based key/value pairs? I need to create a plist with a list of recipe and ingredients. I then want to be able to read this into an NSDictionary so I can do something like NSString *ingredients = [recipes objectForKey:@"apple pie"]; I'm reading in an XML data file through an HTTP request and want to parse all of the key value pairs into the plist. The XML might look something like: <recipes> <recipe> <name>apple pie</name> <ingredients>apples and pie</ingredients> </recipe> <recipe> <name>cereal</name> <ingredients>milk and some other ingredients</ingredients> </recipe> </recipes> Ideally, I'll be able to write this to a plist at runtime, and then be able to read it and turn it into an NSDictionary later at runtime as well.

    Read the article

  • Binary XML file <line 20>: Error inflating class <Unknown>

    - by user2750644
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="top|left|right" android:background="@drawable/bg" tools:context=".MainActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:src="@drawable/top_red_bar" android:layout_alignParentLeft="true" android:paddingLeft="0dp" android:scaleType="centerCrop" /> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="45dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_alignTop="@+id/imageView1" android:layout_centerHorizontal="true" android:src="@drawable/job_bar" /> <ImageView android:id="@+id/imageView3" android:layout_width="238dp" android:layout_height="50dp" android:layout_below="@+id/imageView1" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_marginTop="123dp" android:src="@drawable/button" android:alpha="0.85" android:onClick="myhandler"/> <ImageView android:id="@+id/imageView4" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_alignParentLeft="true" android:layout_below="@+id/imageView3" android:layout_marginTop="24dp" android:src="@drawable/button" android:alpha="0.85"/> <ImageView android:id="@+id/imageView5" android:layout_width="35dp" android:layout_height="45dp" android:layout_above="@+id/imageView4" android:layout_alignLeft="@+id/imageView3" android:layout_marginLeft="21dp" android:src="@drawable/employer" /> <ImageView android:id="@+id/imageView6" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignLeft="@+id/imageView5" android:layout_alignTop="@+id/imageView4" android:src="@drawable/jobseekers" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/imageView5" android:layout_centerHorizontal="true" android:layout_marginLeft="18dp" android:layout_toRightOf="@+id/imageView6" android:text="Employer" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ffffff" android:textStyle="bold" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignTop="@+id/imageView4" android:text="Job Seekers" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ffffff" android:textStyle="bold" /> </RelativeLayout> My app gets crashed with error statement Binary XML file <line 20>: Error inflating class <Unknown>. Why does this happen?? Could anyone fix this? And interestingly, when I remove all code except background, it works!!!

    Read the article

  • Invalid iPhone Application Binary

    - by Kristopher Johnson
    I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect: The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate. My guess is that it is not properly signed. I have downloaded my App Store distribution certficate, but I can't figure out how to "sign" my application with it. The SDK's documentation about code signing is not very helpful. (FWIW, I can install the app on my iPhone just fine using the development provisioning profile.) However, it is possible that I screwed things up on a more basic level. Here's what I did to try to prepare it for upload: In Xcode, select the Device|Release target Select the target and click the Info button. Change "Code Signing Identity" to "iPhone Distribution", and change "Code Signing Provisioning Profile" to my App Store distribution profile. Build Go to the directory where the built MyApp.app bundle is, control-click and choose "Compress" to create MyApp.zip Upload MyApp.zip to the App Store via iTunes Connect (which resulted in the above error message). Can anybody give me any hints? Edit: Found someone with the same problem. Unfortunately, he won't tell us how he fixed it. http://www.rhonabwy.com/wp/2008/07/18/seattlebus-diary-ongoing-update-saga/#comments http://www.rhonabwy.com/wp/2008/07/22/seattlebus-diary-update-is-pending-review/ (Note: For general information on submitting iPhone applications to the App Store, see Steps to upload an iPhone application to the AppStore.)

    Read the article

  • Write binary data as a response in an ASP.NET MVC web control

    - by Lou Franco
    I am trying to get a control that I wrote for ASP.NET to work in an ASP.NET MVC environment. Normally, the control does the normal thing, and that works fine Sometimes it needs to respond by clearing the response, writing an image to the response stream and changing the content type. When you do this, you get an exception "OutputStream is not available when a custom TextWriter is used". If I were a page or controller, I see how I can create custom responses with binary data, but I can't see how to do this from inside a control's render functions. To simplify it -- imagine I want to make a web control that renders to: <img src="pageThatControlIsOn?controlImage"> And I know how to look at incoming requests and recognize query strings that should be routed to the control. Now the control is supposed to respond with a generated image (content-type: image/png -- and the encoded image). In ASP.NET, we: Response.Clear(); Response.OutputStream.Write(thePngData); // this throws in MVC // set the content type, etc Response.End(); How am I supposed to do that in an ASP.NET MVC control?

    Read the article

  • C# Error reading two dates from a binary file

    - by Jamie
    Hi all, When reading two dates from a binary file I'm seeing the error below: "The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'. Parameter name: chars" My code is below: static DateTime[] ReadDates() { System.IO.FileStream appData = new System.IO.FileStream( appDataFile, System.IO.FileMode.Open, System.IO.FileAccess.Read); List<DateTime> result = new List<DateTime>(); using (System.IO.BinaryReader br = new System.IO.BinaryReader(appData)) { while (br.PeekChar() > 0) { result.Add(new DateTime(br.ReadInt64())); } br.Close(); } return result.ToArray(); } static void WriteDates(IEnumerable<DateTime> dates) { System.IO.FileStream appData = new System.IO.FileStream( appDataFile, System.IO.FileMode.Create, System.IO.FileAccess.Write); List<DateTime> result = new List<DateTime>(); using (System.IO.BinaryWriter bw = new System.IO.BinaryWriter(appData)) { foreach (DateTime date in dates) bw.Write(date.Ticks); bw.Close(); } } What could be the cause? Thanks

    Read the article

  • Average performance of binary search algorithm?

    - by Passionate Learner
    http://en.wikipedia.org/wiki/Binary_search_algorithm#Average_performance BinarySearch(int A[], int value, int low, int high) { int mid; if (high < low) return -1; mid = (low + high) / 2; if (A[mid] > value) return BinarySearch(A, value, low, mid-1); else if (A[mid] < value) return BinarySearch(A, value, mid+1, high); else return mid; } If the integer I'm trying to find is always in the array, can anyone help me write a program that can calculate the average performance of binary search algorithm? I know I can do this by actually running the program and counting the number of calls, but what I'm trying to do here is to do it without calling the function. I'm not asking for a time complexity, I'm trying to calculate the average number of calls. For example, the average number of calls to find a integer in A[2], it would be 1.67 (5/3).

    Read the article

  • Formatted text encoding in binary plist

    - by Sean
    I'm trying to do some scripting that edits a binary plist file. The plist describes the objects contained in a DVD studio pro file. It appears that a text box in DVD studio pro is encoded in the plist as hex data that describes the text string along with its formatting. I can't seem to figure out how to understand this data. Ideally, I'd like to be able to alter the text string but not the formatting. The following seems to describe a text box that says "Menu title here". There are two hex strings, one with the key called "dictionary" and the other called "string"; both are CFData. Any ideas how I can parse this or convert this into a format that I can edit directly? I've been playing around with writing a little converter in cocoa, but no luck yet. <dict> <key>Dictionary</key> <data> BAtzdHJlYW10 eXBlZIHoA4QB QISEhAxOU0Rp Y3Rpb25hcnkA hIQITlNPYmpl Y3QAhYQBaQaS hISECE5TU3Ry aW5nAZSEASsG TlNGb250hpKE hIQGTlNGb250 HpSVJIQFWzM2 Y10GAAAAGgAA AP/+TAB1AGMA aQBkAGEARwBy AGEAbgBkAGUA AACEAWYVhAFj AJsBmwCbAIaS hJaXB05TQ29s b3KGkoSEhAdO U0NvbG9yAJSb AYQEZmZmZoPz 8nI/g/Dvbz+D 7OtrPwGGkoSW lwtOU0V4cGFu c2lvboaShISE CE5TTnVtYmVy AISEB05TVmFs dWUAlIQBKoSa moNHx9c9hpKE lpcNTlNPYmxp cXVlbmVzc4aS hJ6ghIQBZKEA hpKElpcQTlNQ YXJhZ3JhcGhT dHlsZYaShISE EE5TUGFyYWdy YXBoU3R5bGUA lIQEQ0NAUwAA hQCGkoSWlxFO U0JhY2tncm91 bmRDb2xvcoaS hJubA4QCZmYA AIaG </data> <key>String</key> <data> BAtzdHJlYW10 eXBlZIHoA4QB QISEhBJOU0F0 dHJpYnV0ZWRT dHJpbmcAhIQI TlNPYmplY3QA hZKEhIQITlNT dHJpbmcBlIQB Kw9OZW51IFRp dGxlIEhlcmWG hAJpSQEPkoSE hAxOU0RpY3Rp b25hcnkAlIQB aQWShJaWDU5T T2JsaXF1ZW5l c3OGkoSEhAhO U051bWJlcgCE hAdOU1ZhbHVl AJSEASqEhAFk nQCGkoSWlgtO U0V4cGFuc2lv boaShJuchIQB Zp6DR8fXPYaS hJaWEE5TUGFy YWdyYXBoU3R5 bGWGkoSEhBBO U1BhcmFncmFw aFN0eWxlAJSE BENDQFMAAIUA hpKElpYGTlNG b250hpKEhIQG TlNGb250HpSZ JIQFWzM2Y10G AAAAGgAAAP/+ TAB1AGMAaQBk AGEARwByAGEA bgBkAGUAAACe FYQBYwCjAaMA owCGkoSWlgdO U0NvbG9yhpKE hIQHTlNDb2xv cgCUowGEBGZm ZmaD8/JyP4Pw 728/g+zraz8B hoaG </data> </dict>

    Read the article

  • Which Java library for Binary Decision Diagrams?

    - by reprogrammer
    A Binary Decision Diagram (BDD) is a data structure to represent boolean functions. I'd like use this data structure in a Java program. My search for Java based BDD libraries resulted into the following packages. Java Decision Diagram Libraries JavaBDD JDD If you know of any other BDD libraries available for Java programs, please let me know so that I add it to the list above. If you have used any of these libraries, please tell me about your experience with the library. In particular, I'd like you to compare the available libraries along the following dimensions. Quality. Is the library mature and reasonably bug free? Performance. How do you evaluate the performance of the library? Support. Could you easily get support whenever you encountered a problem with the library? Was the library well documented? Ease of use. Was the API well designed? Could you install and use the library quickly and easily? Please mention the version of the library that you are evaluating.

    Read the article

  • JNI Stream binary data from C++ to Java

    - by Cliff
    I need help passing binary data into Java. I'm trying to use jbytearray but when the data gets into Java it appears corrupt. Can somebody give me a hand? Here's a snip of some example code. First the native C++ side: printf("Building audio array copy\n"); jbyteArray rawAudioCopy = env-NewByteArray(10); jbyte toCopy[10]; printf("Filling audio array copy\n"); char theBytes[10] = {0,1,2,3,4,5,6,7,8,9}; for (int i = 0; i < sizeof(theBytes); i++) { toCopy[i] = theBytes[i]; } env->SetByteArrayRegion(rawAudioCopy,0,10,toCopy); printf("Finding object callback\n"); jmethodID aMethodId = env->GetMethodID(env->GetObjectClass(obj),"handleAudio","([B)V"); if(0==aMethodId) throw MyRuntimeException("Method not found error",99); printf("Invoking the callback\n"); env->CallVoidMethod(obj,aMethodId, &rawAudioCopy); and then the Java callback method: public void handleAudio(byte[] audio){ System.out.println("Audio supplied to Java [" + audio.length + "] bytes"); byte[] expectedAudio = {0,1,2,3,4,5,6,7,8,9}; for (int i = 0; i < audio.length; i++) { if(audio[i]!= expectedAudio[i]) System.err.println("Expected byte " + expectedAudio[i] + " at byte " + i + " but got byte " + audio[i]); else System.out.print('.'); } System.out.println("Audio passed back accordingly!"); } I get the following output when the callback is invoked: library loaded! Audio supplied to Java [-2019659176] bytes Audio passed back accordingly!

    Read the article

  • Reading a binary file in perl: Bad File Descriptor

    - by Magicked
    I'm trying to read a binary file 40 bytes at a time, then check to see if all those bytes are 0x00, and if so ignore them. If not, it will write them back out to another file (basically just cutting out large blocks of null bytes). This may not be the most efficient way to do this, but I'm not worried about that. However, right now I'm getting a "Bad File Descriptor" error and I cannot figure out why. my $comp = "\x00" * 40; my $byte_count = 0; my $infile = "/home/magicked/image1"; my $outfile = "/home/magicked/image1_short"; open IN, "<$infile"; open OUT, ">$outfile"; binmode IN; binmode OUT; my ($buf, $data, $n); while (read (IN, $buf, 40)) { ### Problem is here ### $boo = 1; for ($i = 0; $i < 40; $i++) { if ($comp[$i] != $buf[$i]) { $i = 40; print OUT $buf; $byte_count += 40; } } } die "Problems! $!\n" if $!; close OUT; close IN; I marked with a comment where it is breaking. Thanks for any help!

    Read the article

  • Determine target architecture of binary file in Linux (library or executable)

    - by Fernando Miguélez
    We have an issue related to a Java application running under a (rather old) FC3 on a Advantech POS board with a Via C3 processor. The java application has several compiled shared libs that are accessed via JNI. Via C3 processor is suppossed to be i686 compatible. Some time ago after installing Ubuntu 6.10 on a MiniItx board with the same processor I found out that the previous statement is not 100% true. The Ubuntu kernel hanged on startup due to the lack of some specific and optional instructions of the i686 set in the C3 processor. These instructions missing in C3 implementation of i686 set are used by default by GCC compiler when using i686 optimizations. The solution in this case was to go with a i386 compiled version of Ubuntu distribution. The base problem with the Java application is that the FC3 distribution was installed on the HD by cloning from an image of the HD of another PC, this time an Intel P4. Afterwards the distribution needed some hacking to have it running such as replacing some packages (such as the kernel one) with the i383 compiled version. The problem is that after working for a while the system completely hangs without a trace. I am afraid that some i686 code is left somewhere in the system and could be executed randomly at any time (for example after recovering from suspend mode or something like that). My question is: Is there any tool or way to find out at what specific architecture is an binary file (executable or library) aimed provided that "file" does not give so much information?

    Read the article

  • Copying to binary file row of a matrix

    - by Flethuseo
    Hi everyone I want to write each row of a matrix to a binary file. I try writing it like this: vector< vector<uint32_t> > matrix; ... for(size_t i = 0; i < matrix.size(); ++i) ofile->write( reinterpret_cast<char*>(&matrix[i]), sizeof(uint32_t*sizeof(matrix[i])) ); { for(size_t j = 0; j < numcols; ++j) { std::cout << left << setw(10) << matrix[i][j]; } cout << endl; } but it doesn't work, I get garbage numbers. Any help appreciated, Ted.

    Read the article

  • generic binary Search in c#

    - by Pro_Zeck
    Below is my Generic Binary Search it works ok with the intgers type array it finds all the elements in it . But the Problem Arises when i use a string array to find any string data. It runs ok for the first index and last index elements but i cant find the middle elements. Stringarray = new string[] { "b", "a", "ab", "abc", "c" }; public static void BinarySearch<T>(T[] array, T searchFor, Comparer<T> comparer) { int high, low, mid; high = array.Length - 1; low = 0; if (array[0].Equals(searchFor)) Console.WriteLine("Value {0} Found At Index {1}",array[0],0); else if (array[high].Equals(searchFor)) Console.WriteLine("Value {0} Found At Index {1}", array[high], high); else { while (low <= high) { mid = (high + low) / 2; if (comparer.Compare(array[mid], searchFor) == 0) { Console.WriteLine("Value {0} Found At Index {1}", array[mid], mid); break; } else { if (comparer.Compare(searchFor, array[mid]) > 0) high = mid + 1; else low = mid + 1; } } if (low > high) { Console.WriteLine("Value Not Found In the Collection"); } } }

    Read the article

  • Silverlight - WCF Enable Binary Encoding

    - by Villager
    Hello, I have a WCF service that is returning a lot of data. I want to compress that information so I thought that using BinaryEncoding would be appropriate. Currently, I have a binding setup in my web.config as follows: <binding name="myCustomBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:05:00"> <binaryMessageEncoding /> <httpTransport maxReceivedMessageSize="8388608" maxBufferSize="8388608"> <extendedProtectionPolicy policyEnforcement="Never" /> </httpTransport> </binding> In my ServiceReferences.clientconfig file, I have the following binding settings: <binding name="CustomBinding_MyService"> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"> <extendedProtectionPolicy policyEnforcement="Never" /> </httpTransport> </binding> Oddly, this configuration will not work. As soon as I remove the <binaryMessageEncoding /> line from the web.config, everything works fine. My question is, how do I use binary message encoding? Is there something I need to configure in my ServiceReferences.clientconfig? Thank you

    Read the article

  • Program always returns binary '>>' : no operator found which takes a left-hand operand of type error

    - by Tom Ward
    So I've been set a task to create a temperature converter in C++ using this equation: Celsius = (5/9)*(Fahrenheit – 32) and so far I've come up with this (I've cut out the 10 lines worth of comments from the start so the code posted begins on line 11, if that makes any sense) #include <iostream> #include <string> #include <iomanip> #include <cmath> using namespace std; int main () { float celsius; float farenheit; std::cout << "**************************" << endl; std::cout << "*4001COMP-Lab5-Question 1*" << endl; std::cout << "**************************" << endl << endl; std::cout << "Please enter a temperature in farenheit: "; std::cin >> farenheit >> endl; std::cout << "Temperature (farenheit): " << endl; std::cout << "Temperature (celsius): " << celsius << endl; std::cin.get(); return 0; } Everytime I try to run this program I get a heap of errors with this one appearing every time: 1m:\visual studio 2010\projects\week 5\week 5\main.cpp(26): error C2678: binary '' : no operator found which takes a left-hand operand of type 'std::basic_istream<_Elem,_Traits' (or there is no acceptable conversion) I've tried everything I can think of to get rid of this error but it reappears every time, any idea on how to fix this?

    Read the article

  • binary quicksort

    - by davit-datuashvili
    hi i want implement Binary quicksort algorithm from robert sedgewick book it looks like this public class quickb{ public static final int bitsword=32; public static void quicksortB(int a[],int l,int r,int d){ int i=l; int j=r-1; if (r<=l || d>bitsword) return ; while (j!=i) { while (digit(a[i],d)==0 && (i<j)) i++; while (digit(a[j],d)==1 && (j>i)) j++; int t=a[i]; a[i]=a[j]; a[j]=t; } if (digit(a[r-1],d)== 0) j++; quicksortB(a,l,j-1,d+1); quicksortB(a,j,r,d+1); } public static void main(String[]args){ int a[]=new int[]{4,7,3,9,8,2}; quicksortB(a,0,a.length-1,0); for (int i=0;i<a.length;i++){ System.out.println(a[i]); } } public static int digit(int m,int d){ return (m>>d)&1; } } but it show me error: java.lang.ArrayIndexOutOfBoundsException: 6 at quickb.quicksortB(quickb.java:13) at quickb.main(quickb.java:32) what is wrong?

    Read the article

  • startup Error for Zend Server CE

    - by Jamison
    Hello! I've got a strange startup error for Zend Server CE - it's probably easy to fix, but I don't have much experience with Zend Server! I'm running the latest OSX 10.6.6 and the latest Zend Server CE for Mac. When I run the "start" command from the command line, here is what I get: /usr/local/zend/bin/apachectl start [OK] spawn-fcgi: child spawned successfully: PID: 4206 /usr/local/zend/bin/shell_functions.rc: line 133: 4210 Bus error $WATCHDOG -i $BINARY 1>&3 2>&4 /usr/local/zend/bin/shell_functions.rc: line 133: 4211 Bus error $WATCHDOG -u $WD_UID -g $WD_GID -s $BINARY 1>&3 2>&4 Starting Zend Server GUI [Lighttpd] [FAILED] /usr/local/zend/bin/lighttpdctl.sh: line 46: 4212 Bus error $WATCHDOG -i $BINARY Starting MySQL SUCCESS! /usr/local/zend/bin/shell_functions.rc: line 133: 4304 Bus error $WATCHDOG -i $BINARY 1>&3 2>&4 /usr/local/zend/bin/shell_functions.rc: line 133: 4425 Bus error $WATCHDOG -u $WD_UID -g $WD_GID -s $BINARY 1>&3 2>&4 Starting Java bridge [FAILED] /usr/local/zend/bin/java_bridge.sh: line 39: 4426 Bus error $WATCHDOG -i $BINARY Zend Server started... The challenge is that ZEND SERVER wont open the GUI with this error, and seemingly I can click on Zend Server in the Applications folder and it opens for a second and immediately closes. I've made sure that Web Sharing is turned off to avoid conflicts, and I've run Disk Utility from my recovery disk to make sure there are no file system errors. Here is what the lines that are referenced in the errors have in terms of code: shell_functions.rc: (starting on line 132 - the error message says line 133...): launch() { if [ -z "$DEBUG" ]; then exec 3>/dev/null 4>&3 else exec 3>&1 4>&2 fi $WATCHDOG -i $BINARY 1>&3 2>&4 RET=$? if [ $RET -eq 0 ];then $ECHO_CMD "$BINARY watchdog is up and running.. ${OK_COLOR}[OK]${T_RESET}" return $RET else #$WATCHDOG -u $WD_UID -g $WD_GID -s $BINARY >> "$PREFIX/logs/watchdog_$BINARY.log" 2>&1 $WATCHDOG -u $WD_UID -g $WD_GID -s $BINARY 1>&3 2>&4 report $? "Starting" fi } _kill() { $WATCHDOG -i $BINARY > /dev/null 2>&1 if [ $? -eq 1 ];then $ECHO_CMD "$BINARY is not running" else $WATCHDOG -t $BINARY > /dev/null 2>&1 report $? "Stopping" fi } lighttpdctl.sh: (starting on line 45 - the error message says line 46...): status() { $WATCHDOG -i $BINARY } case "$1" in start) start status ;; stop) stop ;; restart) stop sleep 1 start ;; status) status ;; *) usage exit 1 esac exit $? java_bridge.sh: (starting on line 38 - the error message says line 39...): status() { $WATCHDOG -i $BINARY } Question: "Watchdog" is library in this zend BIN folder - it seems to handle error reporting? all the errors in my start command seem to deal with this Watchdog thing, but I don't know what to do about it... Thanks!

    Read the article

  • Binary Search Tree in C

    - by heapzero
    Hi, I'm a Python guy. Learning C language and I've been trying to implement Binary Search Tree in C. I wrote down the code, and I've been trying from few hours but, not able to get the output as expected. Please help! Please correct me. #include<stdlib.h> #include<stdio.h> typedef int ElementType; typedef struct TreeNode { ElementType element; struct TreeNode *left, *right; } TreeNode; TreeNode *createTree(){ //Create the root of tree TreeNode *tempNode; tempNode = malloc(sizeof(TreeNode)); tempNode->element = 0; tempNode->left = NULL; tempNode->right = NULL; return tempNode; } TreeNode *createNode(ElementType X){ //Create a new leaf node and return the pointer TreeNode *tempNode; tempNode = malloc(sizeof(TreeNode)); tempNode->element = X; tempNode->left = NULL; tempNode->right = NULL; return tempNode; } TreeNode *insertElement(TreeNode *node, ElementType X){ //insert element to Tree if(node==NULL){ return createNode(X); } else{ if(X < node->element){ node->left = insertElement(node->left, X); } else if(X > node->element){ node->right = insertElement(node->right, X); } else if(X == node->element){ printf("Oops! the element is already present in the tree."); } } } TreeNode *displayTree(TreeNode *node){ //display the full tree if(node==NULL){ return; } displayTree(node->left); printf("| %d ", node->element); displayTree(node->right); } main(){ //pointer to root of tree #2 TreeNode *TreePtr; TreeNode *TreeRoot; TreeNode *TreeChild; //Create the root of tree TreePtr = createTree(); TreeRoot = TreePtr; TreeRoot->element = 32; printf("%d\n",TreeRoot->element); insertElement(TreeRoot, 8); TreeChild = TreeRoot->left; printf("%d\n",TreeChild->element); insertElement(TreeRoot, 2); insertElement(TreeRoot, 7); insertElement(TreeRoot, 42); insertElement(TreeRoot, 28); insertElement(TreeRoot, 1); insertElement(TreeRoot, 4); insertElement(TreeRoot, 5); // the output is not as expected :( displayTree(TreeRoot); }

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >