Search Results

Search found 2199 results on 88 pages for 'printing'.

Page 77/88 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Which Stroustrup book should I use?

    - by Chris Simmons
    I'm a C# programmer that is looking to branch out. I'm bored of writing business software and want to start getting into graphics programming and games/simulators. So I figured, although writing that stuff isn't impossible in managed code, the "right" way to do that would be to look to C++, of course focussing on the language first, then getting into OpenGL or DirectX (or whatever). Way way back ('98? '99?) I had tried and failed to really grasp Stroustrup's The C++ Programming Language. I know that this book is often not recommended for the beginner. Anyway, I picked it back up (in a much more recent printing) and I'm actually getting it and enjoying it. I also have a copy of his textbook, Programming: Principles and Practice Using C++, which, as I understand it, is really geared toward teaching programming, not necessarily C++. I'm certainly not arrogant enough to claim I don't have anything more to learn about programming, data structures, algoriths, etc., however I'm not a novice there either. So my question is, with the goal of gaining the broader and more real-world-useful understanding of C++ and given my background, on which should I focus? The denser (as I perceive it) TCPPPL or the gentler Programming? EDIT: I thank everyone for the responses. However, I've got a personal choice here to make between these two books. Granted there are other very good books out there, but I'm already a good length into both of the books I mention and I'd like to finish one. So, can anyone respond on which would be the better and why? Time is not an issue; I'm not looking (at this point) at an "accelerated" read.

    Read the article

  • import the data in xls file and open them without Microsoft Excel

    - by user3669577
    I need to perform an application that cath values from SQL database after the esecution of a query. I must import the data in xls file and open them without Microsoft Excel. I'm a beginner and have too many problem. Can anyone help me. This is my code, at the moment: Option Infer On Imports System.Linq Imports System.Data.SqlClient Imports System Imports System.IO Imports System.Drawing Imports System.Drawing.Printing Imports System.Windows.Forms Imports ExcelLibrary.SpreadSheet Public Class frmLottiCaricati Dim CnSql As SqlConnection Private Sub frmLottiCaricati_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.MdiParent = Inizio 'TB_MinusValenza.Text = VariazionePrezzi.MinusValenza 'TB_Periodo.Text = VariazionePrezzi.Periodo 'DG_Prodotti.AutoGenerateColumns = False Try Dim StringaSql = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" + Inizio.DatabaseSql + ";Data Source=" + Inizio.ServerSql + ";User ID=" + Inizio.UtenteSql + ";Password=" + Inizio.PwdSql CnSql = New SqlConnection(StringaSql) CnSql.Open() Dim command As SqlCommand Dim dadapter As New SqlDataAdapter Dim DS_Prodotti As New Data.DataSet Dim qry_Prodotti = "SELECT sistemaf.prodscadenze.Ministeriale, sistemaf.prodscadenze.Lotto, sistemaf.prodscadenze.Scadenza " & _ "FROM sistemaf.Prodscadenze " 'INNER JOIN sistemaf.Prodscadenze ON sistemaf.prodbase.Cod39 = sistemaf.prodscadenze.Ministeriale ;" command = New SqlCommand(qry_Prodotti, CnSql) dadapter.SelectCommand = command dadapter.Fill(DS_Prodotti) DG_Prodotti.DataSource = DS_Prodotti.Tables(0) 'DG_Prodotti.Columns("Descrizione").Width = 220 'DG_Prodotti.Columns("Ministeriale").Width = 60 DG_Prodotti.Columns("Lotto").Width = 60 'DG_Prodotti.Columns("Descrizione").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells 'DG_Prodotti.Columns("Totale").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class I can open the data only with Microsoft Excel now. Have any suggestions?

    Read the article

  • Is it possible to include a Sexpr before the expression has been evaluated in Sweave / R ?

    - by PaulHurleyuk
    Hello, I'm writing a Sweave document, and I want to include a small section that details the R and package versions, platofrms and how long ti took to evalute the doucment, however, I want to put this in the middle of the document ! I was using a \Sexpr{elapsed} to do this (which didn't work), but thought if I put the code printing elapsed in a chunk that evaluates at the end, I could then include the chunk half way through, which also fails. My document looks something like this % \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{longtable} \usepackage{geometry} \usepackage{Sweave} \geometry{left=1.25in, right=1.25in, top=1in, bottom=1in} \begin{document} <<label=start, echo=FALSE, include=FALSE>>= startt<-proc.time()[3] @ Text and Sweave Code in here % This document was created on \today, with \Sexpr{print(version$version.string)} running on a \Sexpr{print(version$platform)} platform. It took approx sec to process. <<>>= <<elapsed>> @ More text and Sweave code in here <<label=bye, include=FALSE, echo=FALSE>>= odbcCloseAll() endt<-proc.time()[3] elapsedtime<-as.numeric(endt-startt) @ <<label=elapsed, include=FALSE, echo=FALSE>>= print(elapsedtime) @ \end{document} But this doesn't seem to work (amazingly !) Does anyone know how I could do this ? Thanks Paul.

    Read the article

  • (outofmemoryerror: java heap space) when iterating through oracle records...

    - by rockit
    hello fellow java developers. I'm having a bit of an issue here. I have code that gets a resultset from an oracle database, prints each row to a file, then gets the next row - and continues till the end of the resultset. Only this isn't what happens. What happens is that it gets the resultset, starts iterating through the rows, printing to file as it goes, until it runs out of memory - claiming it needs more space on the java heap. The app is currently running with 2g of memory on the heap and the code breaks at about the 150000th row. I'm using jodbc6.jar and java 6 Here is an idea of what my code is doing: Connection conn = DriverManager.getConnection(url,"name","pwd"); conn.setAutoCommit(false); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(strSql); String strVar_1 = null; long lCount = 0; while(rset.next()){ lCount++; if (lCount % 100000 == 0){ System.out.println(lCount + " rows completed"); } strVar_1 = rset.getString("StringID"); /// breaks here!!!!!!!!! if (strVar_1 == null){ strVar_1 = ""; } if (!strQuery_1.equals("")){ out.write(strVar_1 + "\n"); } } out.close();

    Read the article

  • Cache data in SQL CE database

    - by user93422
    Background I have an SQL CE database, that is constantly updated (every second). I have a (web) application that allows a user to look at the data in real-time. At some point a user can click "take a snapshot" button, and it will open the snapshot in a different window. And then on that form, there is "print" and "download" buttons that will either generate a page for printing, or will stream the data as CSV file - but same data snapshot has to be used, i.e. I can't go to the DB to get latest data for that. Details SQL CE dabatase is exposed through WCF web service. Snapshot consists of up to 500 records, 10 columns each. Expiration time on the snapshot of 2 hours is sufficient. It is a low-traffic application, so I don't expect more than few (5) connections at the same time. Loosing snapshot is not a big deal, user can simply generate new one. database is accessed by self-hosted WCF web service using Linq-to-SQL. Web site is ASP.NET MVC hosted on UltiDev Cassini. database, and web site are most likely be on the same box, when deployed. The entire app is intranet bound. Problem I need to cache the snapshot of the data at the moment user pressed "take a snapshot" button, so that I can use same data to generate print page, or generate a file for download. Solution 1: Each time there is a need to generate a snapshot, I will create a table in the database. Since there are no temp tables in SQL CE, I will need to clean it up myself. Solution 2: Cache the snapshot in-memory on either DB server, or web server. Question: Is there anything wrong with proposed solutions? Any different solution suggestions?

    Read the article

  • Internet Explorer randomly drops sessions between pages in cakePHP

    - by Emerson Taymor
    Hello everyone, I've come across an extremely unusual bug that my team has literally no idea how to solve. Doing some research, I found some similar solutions that I thought would work, but alas did not. Here is my situation, let me know if I can provide additional insight to help solve the problem. The first step is that someone chooses a country via a flash map. Flash passes this region name (as well as a date) through the URL, which we then convert to a session. The next page contains no Flash and doesn't display the selected region, but it does hold on to it for further down the process. Everything works perfectly in Safari and Firefox; however, in IE sometimes unexpected results occur. Frequently (but not always), the session is dropped completely and no sessions are stored between the first and 2nd pages. Here are the steps that I have taken thus far, unsuccessfully: 1. Changed Security from Medium - Low 2. Changed CheckUserAgent from True - False 3. Changed storing of sessions from PHP - Database Some additional information that may be useful: I have tried printing out the session data in Debug (debug($_SESSION) on my view file and debug set to 2 in config). In Internet Explorer everything prints out as expected EXCEPT when the region and date don't get set. For example: If the region and date don't get set NOTHING is printed out for debug. I don't get the session details at the top, and I don't get the normal dump of calls at the bottom of the page either. I am not using redirection on these pages. Please let me know if you have ANY idea of what is causing this or any solutions. I am beyond frustrated and have tried as much as I can to solve this. Thanks!

    Read the article

  • Project Euler, Problem 10 java solution not working

    - by Dennis S
    Hi, I'm trying to find the sum of the prime numbers < 2'000'000. This is my solution in java but I can't seem get the correct answer. Please give some input on what could be wrong and general advice on the code is appreciated. Printing 'sum' gives: 1308111344, which is incorrect. /* The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. */ class Helper{ public void run(){ Integer sum = 0; for(int i = 2; i < 2000000; i++){ if(isPrime(i)) sum += i; } System.out.println(sum); } private boolean isPrime(int nr){ if(nr == 2) return true; else if(nr == 1) return false; if(nr % 2 == 0) return false; for(int i = 3; i < Math.sqrt(nr); i += 2){ if(nr % i == 0) return false; } return true; } } class Problem{ public static void main(String[] args){ Helper p = new Helper(); p.run(); } }

    Read the article

  • system out output for double numbers in a java program

    - by Nikunj Chauhan
    I have a program where I am generating two double numbers by adding several input prices from a file based on a condition. String str; double one = 0.00; double two = 0.00; BufferedReader in = new BufferedReader(new FileReader(myFile)); while((str = in.readLine()) != null){ if(str.charAt(21) == '1'){ one += Double.parseDouble(str.substring(38, 49) + "." + str.substring(49, 51)); } else{ two += Double.parseDouble(str.substring(38, 49) + "." + str.substring(49, 51)); } } in.close(); System.out.println("One: " + one); System.out.println("Two: " + two); The output is like: One: 2773554.02 Two: 6.302505836000001E7 Question: None of the input have more then two decimals in them. The way one and two are getting calculated exactly same. Then why the output format is like this. What I am expecting is: One: 2773554.02 Two: 63025058.36 Why the printing is in two different formats ? I want to write the outputs again to a file and thus there must be only two digits after decimal.

    Read the article

  • CGI Buffering issue

    - by Punit
    I have a server side C based CGI code as: cgiFormFileSize("UPDATEFILE", &size); //UPDATEFILE = file being uploaded cgiFormFileName("UPDATEFILE", file_name, 1024); cgiFormFileContentType("UPDATEFILE", mime_type, 1024); buffer = malloc(sizeof(char) * size); if (cgiFormFileOpen("UPDATEFILE", &file) != cgiFormSuccess) { exit(1); } output = fopen("/tmp/cgi.tar.gz", "w+"); printf("The size of file is: %d bytes", size); inc = size/(1024*100); while (cgiFormFileRead(file, b, sizeof(b), &got_count) == cgiFormSuccess) { fwrite(b,sizeof(char),got_count,output); i++; if(i == inc && j<=100) { ***inc_pb*** = j; i = 0; j++; // j is the progress bar increment value } } cgiFormFileClose(file); retval = system("mkdir /tmp/update-tmp;\ cd /tmp/update-tmp;\ tar -xzf ../cgi.tar.gz;\ bash -c /tmp/update-tmp/update.sh"); However, this doesn't work the way as is seen above. Instead of printing 1,2,...100 to progress_bar.txt one by one it prints at ONE GO, seems it buffers and then writes to the file. fflush() also didn't work. Any clue/suggestion would be really appreciated.

    Read the article

  • Designing a class in such a way that it doesn't become a "God object"

    - by devoured elysium
    I'm designing an application that will allow me to draw some functions on a graphic. Each function will be drawn from a set of points that I will pass to this graphic class. There are different kinds of points, all inheriting from a MyPoint class. For some kind of points it will be just printing them on the screen as they are, others can be ignored, others added, so there is some kind of logic associated to them that can get complex. How to actually draw the graphic is not the main issue here. What bothers me is how to make the code logic such that this GraphicMaker class doesn't become the so called God-Object. It would be easy to make something like this: class GraphicMaker { ArrayList<Point> points = new ArrayList<Point>(); public void AddPoint(Point point) { points.add(point); } public void DoDrawing() { foreach (Point point in points) { if (point is PointA) { //some logic here else if (point is PointXYZ) { //...etc } } } } How would you do something like this? I have a feeling the correct way would be to put the drawing logic on each Point object (so each child class from Point would know how to draw itself) but two problems arise: There will be kinds of points that need to know all the other points that exist in the GraphicObject class to know how to draw themselves. I can make a lot of the methods/properties from the Graphic class public, so that all the points have a reference to the Graphic class and can make all their logic as they want, but isn't that a big price to pay for not wanting to have a God class?

    Read the article

  • C standard addressing simplification inconsistency

    - by Chris Lutz
    Section §6.5.3.2 "Address and indirection operators" ¶3 says (relevant section only): The unary & operator returns the address of its operand. ... If the operand is the result of a unary * operator, neither that operator nor the & operator is evaluated and the result is as if both were omitted, except that the constraints on the operators still apply and the result is not an lvalue. Similarly, if the operand is the result of a [] operator, neither the & operator nor the unary * that is implied by the [] is evaluated and the result is as if the & operator were removed and the [] operator were changed to a + operator. ... This means that this: int *i = NULL; printf("%p", (void *) (&*i) ); printf("%p", (void *) (&i[10]) ); Should be perfectly legal, printing the null pointer (probably 0) and the null pointer plus 10 (probably 10). The standard seems very clear that both of those cases are required to be optimized. However, it doesn't seem to require the following to be optimized: struct { int a; short b; } *s = 0; printf("%p", (void *) (&s->b) ); This seems awfully inconsistent. I can see no reason that the above code shouldn't print the null pointer plus sizeof(int) (possibly 4). Simplifying a &-> expression is going to be the same conceptually (IMHO) as &[], a simple address-plus-offset. It's even an offset that's going to be determinable at compile time, rather than potentially runtime with the [] operator. Is there anything in the rationale about why this is so seemingly inconsistent?

    Read the article

  • What is the best way to store site configuration data?

    - by DaveDev
    I have a question about storing site configuration data. We have a platform for web applications. The idea is that different clients can have their data hosted and displayed on their own site which sits on top of this platform. Each site has a configuration which determines which panels relevant to the client appear on which pages. The system was originally designed to keep all the configuration data for each site in a database. When the site is loaded all the configuration data is loaded into a SiteConfiguration object, and the clients panels are generated based on the content of this object. This works, but I find it very difficult to work with to apply change requests or add new sites because there is so much data to sift through and it's difficult maintain a mental model of the site and its configuration. Recently I've been tasked with developing a subset of some of the sites to be generated as PDF documents for printing. I decided to take a different approach to how I would define the configuration in that instead of storing configuration data in the database, I wrote XML files to contain the data. I find it much easier to work with because instead of reading meaningless rows of data which are related to other meaningless rows of data, I have meaningful documents with semantic, readable information with the relationships defined by visually understandable element nesting. So now with these 2 approaches to storing site configuration data, I'd like to get the opinions of people more experienced in dealing with this issue on dealing with these two approaches. What is the best way of storing site configuration data? Is there a better way than the two ways I outlined here? note: StackOverflow is telling me the question appears to be subjective and is likely to be closed. I'm not trying to be subjective. I'd like to know how best to approach this issue next time and if people with industry experience on this could provide some input.

    Read the article

  • How to print a page when a JButton is pressed in java swing using PrinterJob?

    - by Prayag Upd
    I tried the following code AWT but at runtime shows multiple print dialogs repeatedly.... package printerjob; import java.awt.BasicStroke; import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.WindowAdapter; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; /** * * @author pragX */ public class FramePrinterJob extends Frame implements Printable{ public void start(){ add(button); } @Override public void paint(Graphics graphics){ PrinterJob printerJob=PrinterJob.getPrinterJob(); printerJob.setPrintable(this); if(printerJob.printDialog()){ try{ printerJob.print(); }catch(PrinterException printerException){ //printerException.printStackTrace(); System.out.println("Error Printing." + printerException); } } } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { //throw new UnsupportedOperationException("Not supported yet."); if(pageIndex>=1){ return Printable.NO_SUCH_PAGE; } graphics.translate((int) pageFormat.getImageableX(), (int)pageFormat.getImageableY()); Graphics2D graphics2D=(Graphics2D)graphics; graphics2D.setStroke(new BasicStroke(4f)); graphics2D.drawLine(20, 20, 20, 120); graphics2D.drawLine(40, 20, 40, 120); graphics2D.drawLine(20, 70, 40, 70); graphics2D.drawLine(60, 70, 60, 120); graphics2D.drawLine(60, 40, 60, 45); return Printable.PAGE_EXISTS; } public static void main(String args[]){ Frame frame=new FramePrinterJob(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(){System.exit(0);}}); frame.setSize(300,400); frame.setVisible(true); } }

    Read the article

  • Examples using Active Directory/LDAP groups for permissions \ roles in Rails App.

    - by Nick Gorbikoff
    Hello. I was wondering how other people implemented this scenario. I have an internal rails app ( inventory management, label printing, shipping,etc). I'm rewriting security on the system, cause the old way got to cumbersome to maintain ( users table, passwords, roles) - I used restful_authentication and roles. It was implemented about 3 years ago. I already implemented AuthLogic with ruby-ldap-net to authenticate users ( actually that was surprisingly easy, compared to how I struggled with other frameworks/languages before). Next step is roles. I already have groups defined in Active Directory - so I don't want to run a separate roles system in my rails app, I just want to reuse Active Directory groups - since that part of the system is already maintained for other purposes ( shared drives, backups, pc access, etc) So I was wondering if others had experience implementing permissions/roles in a rails app based on groups in Active Directory or LDAP. Also the roles requirements are pretty complex. Here is an example: For instance I have users that belong to the supervisors group in AD and to inventory dept, so I was that user to be able to run "advanced" tasks in invetory - adjust qty, run reports, however other "supervisors" from other departmanets, shouldn't be able to do this, also Top Management - should be able to use those reports (regardless weather they belong to the invetory or not), but not Middle Management, unless they are in inventory group. Admins of the system (Domain Admins) should have unrestricted access to the system , except for HR & Finances part unless they are in HR ( like you don't want all system admins (except for one authorized one) to see personal info of other employees). I looked at acl9, cancan, aegis. I was wondering if there are any advantaged/cons to using one versus the other for this particular use of system access based on AD. Suggest other systems if you had good experience. Thank you!!!

    Read the article

  • SpeechRecognizer causes ANR... I need help with Android speech API.

    - by Dondo Chaka
    I'm trying to use Android's speech recognition package to record user speech and translate it to text. Unfortunately, when I attempt initiate listening, I get an ANR error that doesn't point to anything specific. As the SpeechRecognizer API indicates, a RuntimeException is thrown if you attempt to call it from the main thread. This would make me wonder if the processing was just too demanding... but I know that other applications use the Android API for this purpose and it is typically pretty snappy. java.lang.RuntimeException: SpeechRecognizer should be used only from the application's main thread Here is a (trimmed) sample of the code I'm trying to call from my service. Is this the proper approach? Thanks for taking the time to help. This has been a hurdle I haven't been able to get over yet. Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.domain.app"); SpeechRecognizer recognizer = SpeechRecognizer .createSpeechRecognizer(this.getApplicationContext()); RecognitionListener listener = new RecognitionListener() { @Override public void onResults(Bundle results) { ArrayList<String> voiceResults = results .getStringArrayList(RecognizerIntent.EXTRA_RESULTS); if (voiceResults == null) { Log.e(getString(R.string.log_label), "No voice results"); } else { Log.d(getString(R.string.log_label), "Printing matches: "); for (String match : voiceResults) { Log.d(getString(R.string.log_label), match); } } } @Override public void onReadyForSpeech(Bundle params) { Log.d(getString(R.string.log_label), "Ready for speech"); } @Override public void onError(int error) { Log.d(getString(R.string.log_label), "Error listening for speech: " + error); } @Override public void onBeginningOfSpeech() { Log.d(getString(R.string.log_label), "Speech starting"); } }; recognizer.setRecognitionListener(listener); recognizer.startListening(intent);

    Read the article

  • Java client server sending bytes receiver listens indefinitely

    - by Rob
    Hello, I'm trying to write a Java program for Windows that involves communication with a server program located on a foreign machine.My program successfully connects to the server, successfully writes a byte array to it, and waits for a response. I know that the server is printing bytes (the response) back to me one byte at a time. I've tried using a DataInputStream object with various methods (read, readByte etc.), I've tried using a BufferedReader object with its methods (read, readLine etc.) but all the reader objects and various methods that I've used all come up against the same problem. The bytes are being successfully read (each time a byte or bytes are read, I can print them to the console, and they are what I'd expect them to be). The problem is that my reader doesn't know when to stop reading. Even if the server has sent all its bytes, the reader function on my end waits for more data, indefinitely, and so the program hangs at the read function. This problem seems to affect all the techniques that I have tried. I've been running tests with a simple client program and server program, each about 40 or 50 lines long, where the client connects to the server, and sends some bytes to it. All the techniques I've tried for the server reader result in the same problem mentioned above (the server hangs waiting for more input from the client, even though it has sent all its data). I'm really desperate for some help on this. It's important that I get this program finished soon, and it's basically complete except for this communication issue. Any help is much appreciated! -Rob

    Read the article

  • Is there a Scala version of .irbrc or another way to define some default libraries for REPL use?

    - by Tom Morris
    I've written a little library that uses implicits to add functionality that one only needs when using the REPL in Scala. Ruby has libraries like this - for things like pretty printing, firing up text editors (like the interactive_editor gem which invokes Vim from irb - see this post), debuggers and the like. The library I am trying to write adds some methods to java.lang.Class and java.lang.reflect classes using the 'pimp my library' implicit conversion process to help you go and find documentation (initially, with Google, then later possibly with a JavaDoc/ScalaDoc viewer, and maybe the StackOverflow API eventually!). It's an itch-scratching library: I spend so much time copying and pasting classnames into Google that I figured I may as well automate the process. It is the sort of functionality that developers will want to add to their system for use only in the REPL - they shouldn't really be adding it to projects (partly because it may not be something that their fellow developers want, but also because if you are doing some exploratory development, it may be with just a Scala REPL that's not being invoked by an IDE or build tool). In my case, I want to include a few classes and set up some implicits - include a .jar on the CLASSPATH and import it, basically. In Ruby, this is the sort of thing that you'd add to your .irbrc file. Other REPLs have similar ways of setting options and importing libraries. Is there a similar file or way of doing this for the Scala REPL?

    Read the article

  • XAML get new width and height for Canvas

    - by Jack Navarro
    I have searched through many times but have not seen this before. Probably really simple question but can't wrap my head around it. Wrote a VSTO add-in for Excel that draws a Grid dynamically. Then launches a new window and replaces the contents of the Canvas with the generated Grid. The problem is with printing. When I call the print procedure the canvas.height and canvas.width returned is the old value prior to replacing it with the grid. Sample: string="<Grid Name=\"CanvasGrid\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">..Lots of stuff..</Grid>"; // Launch new window and replace the Canvas element WpfUserControl newWindow = new WpfUserControl(); newWindow.Show(); //To test MessageBox.Show(myCanvas.ActualWidth.ToString()); //return 894 Grid testGrid = myCanvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 StringReader stringReader = new StringReader(LssAllcChrt); XmlReader xmlReader = XmlReader.Create(stringReader); Canvas myCanvas = newWindow.FindName("GrphCnvs") as Canvas; myCanvas.Children.Clear(); myCanvas.Children.Add((UIElement)XamlReader.Load(xmlReader)); //To test MessageBox.Show(myCanvas.ActualWidth.ToString()); //return 894 but should be much larger the Grid spans all three of my screens Grid testGrid = myCanvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 but should be much larger the Grid spans all three of my screens //Run code from WpfUserControl.cs after it loads from button click Grid testGrid = canvas.FindName("CanvasGrid") as Grid; MessageBox.Show("Grid " + testGrid.ActualWidth.ToString()); //return 234 but should be much larger the Grid spans all three of my screens So basically I have no way of telling what my new width and height are.

    Read the article

  • Summarising grouped records in a dataframe in R

    - by monch1962
    Hello all, I have a data frame in R that looks like this: > TimeOffset, Source, Length > 0 1 1500 > 0.1 1 1000 > 0.2 1 50 > 0.4 2 25 > 0.6 2 3 > 1.1 1 1500 > 1.4 1 18 > 1.6 2 2500 > 1.9 2 18 > 2.1 1 37 > ... and I want to convert it to > TimeOffset, Source, Length > 0.2 1 2550 > 0.6 2 28 > 1.4 1 1518 > 1.9 2 2518 > ... Trying to put this into English, I want to group consecutive records with the same 'Source' together, then printing out a single record per group showing the highest time offset in that group, the source, and the sum of the lengths in that group. The TimeOffset values will always increase. I suspect this is possible in R, but I really don't know where to start. In a pinch I could export the data frame out and do it in e.g. Python, but I'd prefer to stay within R if possible. Thanks in advance for any assistance you can provide

    Read the article

  • PHP code displayed in browser

    - by Drake
    so, I'm working on a databases project, and i'm trying to code incrementally. the problem is, when i go to test the php in browser, it displays the php code after my use of "-". the html printing is displayed properly, which is AFTER the point where the - is. here is the php: <?php function getGraphicNovel(){ include_once("./connect.php"); $db_connection = new mysqli($SERVER, $USERNAME, $PASSWORD, $DATABASE); if (mysqli_connect_errno()) { echo("Can't connect to MySQL Server. Error code: " . mysqli_connect_error()); return null; } $stmt = $db_connection->stmt_init(); $returnValue = "invalid"; if($stmt.prepare("select series from graphic_novel_main natural join graphic_novel_misc")) { $stmt->execute(); $stmt->bind_result($series); while ($stmt->fetch()) { echo "<tr><td>" . $series . "</td></tr>"; } $stmt->close(); } $db_connection->close(); } getGraphicNovel(); ?> here is a link to the page. hopefully it works for people outside the school's network. http://plato.cs.virginia.edu/~paw5k/cainedb/viewall.html if anyone knows why this is happening, your input would be great!

    Read the article

  • Get the character count of a textarea including newlines

    - by styfle
    I tested this code in Chrome and there seems to be a bug involving the newlines. I am reaching the maxlength before I actually use all the characters. <textarea id="myText" maxlength="200" style="width:70%;height:200px"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s... Enter something: </textarea> <div> Char Count <span id="count"></span>/<span id="max"></span> </div>? <script> var ta = document.getElementById('myText'); document.getElementById('max').innerHTML = ta.maxLength; setInterval(function() { document.getElementById('count').innerHTML = ta.value.length; }, 250);? </script> How can I accurately get the char count of a textarea? jsFiddle demo: http://jsfiddle.net/Qw6vz/1/

    Read the article

  • Python opening a file and putting list of names on separate lines

    - by Jeremy Borton
    I am trying to write a python program using Python 3 I have to open a text file and read a list of names, print the list, sort the list in alphabetical order and then finally re-print the list. There's a little more to it than that BUT the problem I am having is that I'm supposed to print the list of names with each name on a separate line Instead of printing each name on a separate line, it prints the list all on one line. How can I fix this? def main(): #create control loop keep_going = 'y' #Open name file name_file = open('names.txt', 'r') names = name_file.readlines() name_file.close() #Open outfile outfile = open('sorted_names.txt', 'w') index = 0 while index < len(names): names[index] = names[index].rstrip('\n') index += 1 #sort names print('original order:', names) names.sort() print('sorted order:', names) #write names to outfile for item in names: outfile.write(item + '\n') #close outfile outfile.close() #search names while keep_going == 'y' or keep_going == 'Y': search = input('Enter a name to search: ') if search in names: print(search, 'was found in the list.') keep_going = input('Would you like to do another search Y for yes: ') else: print(search, 'was not found.') keep_going = input('Would you like to do another search Y for yes: ') main()

    Read the article

  • PHP Ampersand in String

    - by John
    Hello. I'm having a bit of a problem. I am trying to create an IRC bot, which has an ampersand in its password. However, I'm having trouble putting the ampersand in a string. For example... <?php $var = "g&abc123"; echo $var; ?> I believe this should print g&abc123. However it's printing g. I have tried this as well: <?php $arr = array("key" => "g&abc123"); print_r($arr); ?> This prints it correctly with the g&abc123, however when I say echo $arr['key']; it prints g again. Any help would be appreciated. I'm running PHP5.3.1. EDIT: Also, I just noticed that if I use g&abc123&abc123 it prints g&abc123. Any suggestions?

    Read the article

  • Fast, Unicode-capable, cross-platform programmer's text editor that shows invisibles like ZWSP?

    - by Roger_S
    Our publishing workflow includes Windows and Linux machines (there are some Macs too, but not in the critical-path workflow). Many texts include both English and Khmer and are marked-up in XML. XML Copy Editor is the best cross-platform open-source XML editor I've discovered. It utilizes the Scintilla editing component, which is generally good with Unicode but which does not enable non-printing or invisible characters like U+200B (zero-width space) and U+200C (zero-width non-joiner) to be displayed. Khmer does not separate words with a space character as Western languages do, so ZWSP is used in electronic texts to enable applications to break lines easily. Ideally I'd edit the markup and the content in a single editor, but XML awareness is less important at times than being able to display invisibles. (OpenOffice.org Writer and Microsoft Word are the only two apps I know that will display ZWSP. They are not suitable for the markup and text manipulations that need to be done to prepare manuscripts for publication, unfortunately, although I guess they're fine for authoring.) I tried out a promising editor last week, but a search-and-replace regex operation that took under a second in TextPad 4.7.3 lasted over twenty seconds. So I want to mention that speed and the ability to handle large (up to 150mb) files is also a concern. Is there a good, fast, free or not too expensive text editor, with versions on Windows and Linux and maybe mac too, Unicode-aware and capable of displaying invisibles like ZWSP? That has syntax highlighting, can handle large files and is customizable enough that I won't tear my hair out in frustration? Thanks, Roger_S

    Read the article

  • How do I append Word templates to a new document in VB.NET?

    - by Tom
    I'm poking around to see if this app can be done. Basically the end user needs to create a bunch of export documents that are populated from a database. There will be numerous document templates (.dot) and the end result will be the user choosing templates x y and z to include for documentation, click a button and have the app create a new Word document, append the templates, and then populate the templates with the appropriate data. The reason it needs to be done in Word as opposed to something like Crystal Reports is that the user may customize some fields before printing the documents as it can vary from export to export. Is this possible to do through VB.NET (VS 2010)? I assume it is but I'm having difficulty tracking down a solution. Or alternatively is there a better solution? Here's what I have so far (not much I know) Import Microsoft.Office.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oDoc As Word.Document oWord = CreateObject("Word.Application") oWord.Visible = False oDoc = oWord.Documents.Add 'Open templates x.dot, y.dot, z.dot 'Append above templates to new document created 'Populate new document oWord.Visible = True End Sub End Class Thanks.

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >