Search Results

Search found 3923 results on 157 pages for 'binary x'.

Page 27/157 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Binary data instead of actual image in C#

    - by acadia
    Hello, I am using the below mentioned library to create a barcode which is storing in a specified location as shown below: My question is, is there a way instead of saving it to a png file I get byte data? thanks Code39 code = new Code39("10090"); code.Paint().Save("c:/NewBARCODE.png", ImageFormat.Png); using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Diagnostics; namespace BarCode39 { public class Code39Settings { private int height = 60; public int BarCodeHeight { get { return height; } set { height = value; } } private bool drawText = true; public bool DrawText { get { return drawText; } set { drawText = value; } } private int leftMargin = 10; public int LeftMargin { get { return leftMargin; } set { leftMargin = value; } } private int rightMargin = 10; public int RightMargin { get { return rightMargin; } set { rightMargin = value; } } private int topMargin = 10; public int TopMargin { get { return topMargin; } set { topMargin = value; } } private int bottomMargin = 10; public int BottomMargin { get { return bottomMargin; } set { bottomMargin = value; } } private int interCharacterGap = 2; public int InterCharacterGap { get { return interCharacterGap; } set { interCharacterGap = value; } } private int wideWidth = 2; public int WideWidth { get { return wideWidth; } set { wideWidth = value; } } private int narrowWidth = 1; public int NarrowWidth { get { return narrowWidth; } set { narrowWidth = value; } } private Font font = new Font(FontFamily.GenericSansSerif, 12); public Font Font { get { return font; } set { font = value; } } private int codeToTextGapHeight = 10; public int BarCodeToTextGapHeight { get { return codeToTextGapHeight; } set { codeToTextGapHeight = value; } } } public class Code39 { #region Static initialization static Dictionary<char, Pattern> codes; static Code39() { object[][] chars = new object[][] { new object[] {'0', "n n n w w n w n n"}, new object[] {'1', "w n n w n n n n w"}, new object[] {'2', "n n w w n n n n w"}, new object[] {'3', "w n w w n n n n n"}, new object[] {'4', "n n n w w n n n w"}, new object[] {'5', "w n n w w n n n n"}, new object[] {'6', "n n w w w n n n n"}, new object[] {'7', "n n n w n n w n w"}, new object[] {'8', "w n n w n n w n n"}, new object[] {'9', "n n w w n n w n n"}, new object[] {'A', "w n n n n w n n w"}, new object[] {'B', "n n w n n w n n w"}, new object[] {'C', "w n w n n w n n n"}, new object[] {'D', "n n n n w w n n w"}, new object[] {'E', "w n n n w w n n n"}, new object[] {'F', "n n w n w w n n n"}, new object[] {'G', "n n n n n w w n w"}, new object[] {'H', "w n n n n w w n n"}, new object[] {'I', "n n w n n w w n n"}, new object[] {'J', "n n n n w w w n n"}, new object[] {'K', "w n n n n n n w w"}, new object[] {'L', "n n w n n n n w w"}, new object[] {'M', "w n w n n n n w n"}, new object[] {'N', "n n n n w n n w w"}, new object[] {'O', "w n n n w n n w n"}, new object[] {'P', "n n w n w n n w n"}, new object[] {'Q', "n n n n n n w w w"}, new object[] {'R', "w n n n n n w w n"}, new object[] {'S', "n n w n n n w w n"}, new object[] {'T', "n n n n w n w w n"}, new object[] {'U', "w w n n n n n n w"}, new object[] {'V', "n w w n n n n n w"}, new object[] {'W', "w w w n n n n n n"}, new object[] {'X', "n w n n w n n n w"}, new object[] {'Y', "w w n n w n n n n"}, new object[] {'Z', "n w w n w n n n n"}, new object[] {'-', "n w n n n n w n w"}, new object[] {'.', "w w n n n n w n n"}, new object[] {' ', "n w w n n n w n n"}, new object[] {'*', "n w n n w n w n n"}, new object[] {'$', "n w n w n w n n n"}, new object[] {'/', "n w n w n n n w n"}, new object[] {'+', "n w n n n w n w n"}, new object[] {'%', "n n n w n w n w n"} }; codes = new Dictionary<char, Pattern>(); foreach (object[] c in chars) codes.Add((char)c[0], Pattern.Parse((string)c[1])); } #endregion private static Pen pen = new Pen(Color.Black); private static Brush brush = Brushes.Black; private string code; private Code39Settings settings; public Code39(string code) : this(code, new Code39Settings()) { } public Code39(string code, Code39Settings settings) { foreach (char c in code) if (!codes.ContainsKey(c)) throw new ArgumentException("Invalid character encountered in specified code."); if (!code.StartsWith("*")) code = "*" + code; if (!code.EndsWith("*")) code = code + "*"; this.code = code; this.settings = settings; } public Bitmap Paint() { string code = this.code.Trim('*'); SizeF sizeCodeText = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(code, settings.Font); int w = settings.LeftMargin + settings.RightMargin; foreach (char c in this.code) w += codes[c].GetWidth(settings) + settings.InterCharacterGap; w -= settings.InterCharacterGap; int h = settings.TopMargin + settings.BottomMargin + settings.BarCodeHeight; if (settings.DrawText) h += settings.BarCodeToTextGapHeight + (int)sizeCodeText.Height; Bitmap bmp = new Bitmap(w, h, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(bmp); int left = settings.LeftMargin; foreach (char c in this.code) left += codes[c].Paint(settings, g, left) + settings.InterCharacterGap; if (settings.DrawText) { int tX = settings.LeftMargin + (w - settings.LeftMargin - settings.RightMargin - (int)sizeCodeText.Width) / 2; if (tX < 0) tX = 0; int tY = settings.TopMargin + settings.BarCodeHeight + settings.BarCodeToTextGapHeight; g.DrawString(code, settings.Font, brush, tX, tY); } return bmp; } private class Pattern { private bool[] nw = new bool[9]; public static Pattern Parse(string s) { Debug.Assert(s != null); s = s.Replace(" ", "").ToLower(); Debug.Assert(s.Length == 9); Debug.Assert(s.Replace("n", "").Replace("w", "").Length == 0); Pattern p = new Pattern(); int i = 0; foreach (char c in s) p.nw[i++] = c == 'w'; return p; } public int GetWidth(Code39Settings settings) { int width = 0; for (int i = 0; i < 9; i++) width += (nw[i] ? settings.WideWidth : settings.NarrowWidth); return width; } public int Paint(Code39Settings settings, Graphics g, int left) { #if DEBUG Rectangle gray = new Rectangle(left, 0, GetWidth(settings), settings.BarCodeHeight + settings.TopMargin + settings.BottomMargin); g.FillRectangle(Brushes.Gray, gray); #endif int x = left; int w = 0; for (int i = 0; i < 9; i++) { int width = (nw[i] ? settings.WideWidth : settings.NarrowWidth); if (i % 2 == 0) { Rectangle r = new Rectangle(x, settings.TopMargin, width, settings.BarCodeHeight); g.FillRectangle(brush, r); } x += width; w += width; } return w; } } } }

    Read the article

  • asp.net MVC: binary deployment of mvc views

    - by user287107
    Hi, how can I deploy an mvc application, without publishing the aspx view files. Is there a way to publish the generated dll assemblies? In the project file is an option "MvcBuildViews", which builds these dll files. But they are build in a temp directory and not used in the publishment process. Is there a way to include these files? best regards

    Read the article

  • Does protobuf-net generated binary compatible with Google specs

    - by cornerback84
    Actually I want to serialize my data using Google's java implementation and then deserialize using C# implementation? I have chosen portobuf-net as it seems to be more stable (porto# is still v0.9 or I would have gone for it). Before I start working on it I wanted to be sure that I can achieve this (serializing data using java implementation and deserializing it using potobuf-net). Or is there any list of methods that are specific to portobuf-net implementation?

    Read the article

  • Binary comparison operators on generic types

    - by Brian Triplett
    I have a generic class that takes a type T. Within this class I have a method were I need to compare a type T to another type T such as: public class MyClass<T> { public T MaxValue { // Implimentation for MaxValue } public T MyMethod(T argument) { if(argument > this.MaxValue) { // Then do something } } } The comparison operation inside of MyMethod fails with Compiler Error CS0019. Is it possible to add a constraint to T to make this work? I tried adding a where T: IComparable<T> to the class definition to no avail.

    Read the article

  • Reading a .dat file as "rb" read binary

    - by donpal
    I have a web-accessible php script that accesses a folder above the webroot (not web accessible) called \folder\. This is done via setting the path to \folder\ in .htaccess the usual way so that \folder\ becomes part of the project. \folder\ contains a .php script (communicates with the web-accessible script inside the webroot) some .inc files (used by the .php in the same folder, above the webroot) a dat file (used by the .inc in the same folder, above the webroot) All files are accessible to each other as needed: the web-accessible php inside the webroot can communicate with the php above the webroot the php above the webroot can communicate with the inc in the same folder But the inc above the webroot can't communicate with the dat in the same folder, and I have no idea why that's the case The inc myinc.inc is supposed to open the dat mydat.dat in the same folder like this fopen('mydat.dat', "rb"); but I get an error that no file called mydat.dat exists inside \folder\myinc.inc. Of course it does not, the .dat is sibling to .inc and is not supposed to be inside it. Why is php expecting to find the .dat file inside the .inc. The stranger thing is that if I move the .dat in the web-accessible folder, it becomes readable now. Any ideas why php is trying to find the .dat inside the .inc?

    Read the article

  • How to output binary data to a socket with Ruby

    - by Earlz
    Hello I have a very simple HTTP ruby server. I want it to simply server a PNG image. So I sent headers like image/png but I think that Ruby is converting the image data to a string first. Here is my relevant code webserver = TCPServer.new('127.0.0.1', 20001) while (session = webserver.accept) #.... file = File.open("tmp_testserve.png", "rb") contents = file.read file.close session.print @content session.close #.... Is this what is happening?

    Read the article

  • mEncrypt/Decrypt binary mp3 with mcrypt, missing mimetype

    - by Jeremy Dicaire
    I have a script that read a mp3 file and encrypt it, I want to be able to decrypt this file and convert it to base64 so it can play in html5. Key 1 will be stored on the page and static, key2 will be unique for each file, for testing I used: $key1 = md5(time()); $key2 = md5($key1.time()); Here is my encode php code : //Get file content $file = file_get_contents('test.mp3'); //Encrypt file $Encrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $file, MCRYPT_MODE_CBC, $key2); $Encrypt = trim(base64_encode($Encrypt)); //Create new file $fileE = "test.mp3e"; $fileE = fopen($file64, 'w') or die("can't open file"); //Put crypted content fwrite($fileE, $Encrypt); //Close file fclose($fileE); Here is the code that doesnt work (decoded file is same size, but no mimetype): //Get file content $fileE = file_get_contents('test.mp3e'); //Decode $fileDecoded = base64_decode($fileE); //Decrypt file $Decrypt = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $fileDecoded, MCRYPT_MODE_CBC, $key2); $Decrypt = trim($Decrypt); //Create new file $file = "test.mp3"; $file = fopen($file, 'w') or die("can't open file"); //Put crypted content fwrite($file, $Decrypt); //Close file fclose($file);

    Read the article

  • Does portobuf-net generated binary compatible with Google specs

    - by cornerback84
    Actually I want to serialize my data using Google's java implementation and then deserialize using C# implementation? I have chosen portobuf-net as it seems to be more stable (porto# is still v0.9 or I would have gone for it). Before I start working on it I wanted to be sure that I can achieve this (serializing data using java implementation and deserializing it using potobuf-net). Or is there any list of methods that are specific to portobuf-net implementation?

    Read the article

  • using compareTo in Binary Search Tree program

    - by Scott Rogener
    I've been working on this program for a few days now and I've implemented a few of the primary methods in my BinarySearchTree class such as insert and delete. Insert seemed to be working fine, but once I try to delete I kept getting errors. So after playing around with the code I wanted to test my compareTo methods. I created two new nodes and tried to compare them and I get this error: Exception in thread "main" java.lang.ClassCastException: TreeNode cannot be cast to java.lang.Integer at java.lang.Integer.compareTo(Unknown Source) at TreeNode.compareTo(TreeNode.java:16) at BinarySearchTree.myComparision(BinarySearchTree.java:177) at main.main(main.java:14) Here is my class for creating the nodes: public class TreeNode<T> implements Comparable { protected TreeNode<T> left, right; protected Object element; public TreeNode(Object obj) { element=obj; left=null; right=null; } public int compareTo(Object node) { return ((Comparable) this.element).compareTo(node); } } Am I doing the compareTo method all wrong? I would like to create trees that can handle integers and strings (seperatly of course)

    Read the article

  • .net IHTTPHandler Streaming SQL Binary Data

    - by Yisman
    Hello everybody I am trying to implement an ihttphandeler for streaming files. files may be tiny thumbnails or gigantic movies the binaries r stored in sql server i looked at a lot of code online but something does not make sense isnt streaming supposed to read the data piece by piece and move it over the line? most of the code seems to first read the whole field from mssql to memory and then use streaming for the output writing wouldnt it b more eficient to actually stream from disk directly to http byte by byte (or buffered chunks?) heres my code so far but cant figure out the correct combination of the sqlreader mode and the stream object and the writing system Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest context.Response.BufferOutput = False Dim FileField=safeparam(context.Request.QueryString("FileField")) Dim FileTable=safeparam(context.Request.QueryString("FileTable")) Dim KeyField=safeparam(context.Request.QueryString("KeyField")) Dim FileKey=safeparam(context.Request.QueryString("FileKey")) Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("Main").ConnectionString) Using command As New SqlCommand("SELECT " & FileField & "Bytes," & FileField & "Type FROM " & FileTable & " WHERE " & KeyField & "=" & FileKey, connection) command.CommandType = Data.CommandType.Text enbd using end using end sub please be aware that this sql command also returns the file extension (pdf,jpg,doc...) in the second field of the query thank you all very much

    Read the article

  • Is portobuf-net generated binary compatible with Google specs

    - by cornerback84
    Actually I want to serialize my data using Google's java implementation and then deserialize using C# implementation? I have chosen portobuf-net as it seems to be more stable (porto# is still v0.9 or I would have gone for it). Before I start working on it I wanted to be sure that I can achieve this (serializing data using java implementation and deserializing it using potobuf-net). Or is there any list of methods that are specific to portobuf-net implementation?

    Read the article

  • Display Pdf Stream on page load with Binary Write

    - by Israfel
    I have a pdf file being generated on the fly which I want to display inline on pageload, as below Response.Clear() Response.AppendHeader("Content-Disposition", "inline; filename=_Bulk_Print.pdf") Response.ContentType = "application/pdf" Response.BinaryWrite(docData) Response.End() If I put this in a click event it works perfectly but when on page load I Just get a blank aspx page despite the fact it's stepping through that code and the generation of the DocData no problem. Does anyone know the reason for this or a workaround, thanks for your help.

    Read the article

  • Copy binary image data into a string

    - by Alien01
    I need to send image data over network using HttpSendRequest POST request. For this purpose I am creating a string , adding some parameters to string, then I need to add raw image data. Now I would like to know how can I send the image in post request.

    Read the article

  • Reading a Delphi binary file in Python

    - by Brendan
    I have a file that was written with the following Delphi declaration ... Type Tfulldata = Record dpoints, dloops : integer; dtime, bT, sT, hI, LI : real; tm : real; data : array[1..armax] Of Real; End; ... Var: fh: File Of Tfulldata; I want to analyse the data in the files (many MB in size) using Python if possible - is there an easy way to read in the data and cast the data into Python objects similar in form to the Delphi records? Does anyone know of a library perhaps that does this?

    Read the article

  • recursive add binary numbers

    - by davit-datuashvili
    i need following algorithm let say we have 5 //101 and 7 //111 numbers are arbitrary i need to add these numbers using the recursive method and at the same time using bitwise methods such that result should be 101 + 111 110 0 or 12 can anybody help me?

    Read the article

  • Count subset of binary pattern ..

    - by mr.bio
    Hi there . I have a A=set of strings and a B=seperate string. I want to count the number of occurences in from B in A. Example : A: 10001 10011 11000 10010 10101 B: 10001 result would be 3.(10001 is a subset of 10001,10011,10101) So i need a function that takes a set and string and returns an int. int myfunc(set<string> , string){ int result; // My Brain is melting return result ; }

    Read the article

  • String or binary data would be truncated -- Heisenberg problem

    - by harpo
    When you get this error, the first thing you ask is, which column? Unfortunately, SQL Server is no help here. So you start doing trial and error. Well, right now I have a statement like: INSERT tbl (A, B, C, D, E, F, G) SELECT A, B * 2, C, D, E, q.F, G FROM tbl ,othertable q WHERE etc etc Note that Some values are modified or linked in from another table, but most values are coming from the original table, so they can't really cause truncation going back to the same field (that I know of). Eliminating fields one at a time eventually makes the error go away, if I do it cumulatively, but — and here's the kicker — it doesn't matter which fields I eliminate. It's as if SQL Server is objecting to the total length of the row, which I doubt, since there are only about 40 fields in all, and nothing large. Anyone ever seen this before? Thanks. UPDATE: I have also done "horizontal" testing, by filtering out the SELECT, with much the same result. In other words, if I say WHERE id BETWEEN 1 AND 100: Error WHERE id BETWEEN 1 AND 50: No error WHERE id BETWEEN 50 AND 100: No error I tried many combinations, and it cannot be limited to a single row.

    Read the article

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