Search Results

Search found 27946 results on 1118 pages for 'output buffer empty'.

Page 46/1118 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Checking for empty variable in PHPTAL condition

    - by kodziek
    In PHPTAL tal:condition can check is variable empty? Something like that: < tag tal:condition="var" >Some text< /tag > but the value of variable is like that: <?php $variable = ''; $Tpl->var = $variable; ?> And it's a problem 'cause PHPTAL that value '' interpreting like not empty value and condition return true. How fix it in PHPTAL side?

    Read the article

  • Why does R sometimes stop displaying output?

    - by Winston C. Yang
    Sometimes R stops displaying output. I type the number 1, followed by the return key, and nothing appears. This situation occurred after I pressed the "STOP" icon in the window, which is for stopping long calculations. I'm using R 2.11.0 on a Mac. Does pressing "STOP" cause R to stop displaying output? How do I get R to display output again?

    Read the article

  • problem in reading output of dd command using pipe

    - by Ummar
    I am developing an application, in which I want to redirect the output (progress information) of dd command to my C++ program, but it is not actually getting the output, here is the code FILE * progressInfo = popen("gzip -dc backup/backup.img.gz | pv -ptrbe -i 2 -s 2339876653 | dd of=/dev/sdb","r"); if(!progressInfo) { return -1; } char buf[1024]; while(fgets(buff, sizeof(buff),progressInfo)!=NULL) { std::cout << buff << endl; } but the problem is the progress information is not received in buff, and the output is continuously printed on terminal, and above program halts on while(fgets(buff, sizeof(buff),progressInfo)!=NULL), and as soon as the dd operation is completed, the very next line to loop block is executed. if anyone has any idea why the output is not returned to buff, and its continuously retuned on terminal?

    Read the article

  • How do I effectively write to 146 output files in C++ using cstdlib library

    - by Elpezmuerto
    I have a very large binary file and I need to create separate files based on the id within the input file. There are 146 output files and I am using cstdlib and fopen and fwrite. FOPEN_MAX is 20, so I can't keep all 146 output files open at the same time. I also want to minimize the number of times I open and close an output file. How can I write to the output files effectively? I also must use the cstdlib library due to legacy code.

    Read the article

  • Stacking standard output of `su`

    - by Kristopher Ives
    I've got some code that I wrote that uses a combination of bash and PHP command line scripting. The script is ran as root and then uses su to become various uses. I start a session like this: $result = `su SomeUser ./dothis.php` Here ./dothis.php is a script that may generate some output being stored in $result, but the problem is that there is usually output that doesn't get caught and makes it hard for me to read my script output. How can I make sure that the output is being captured within this su stacking?

    Read the article

  • Bash Color Variable Output

    - by drewrockshard
    I've got a variable, let's say $x and it holds the value of website.com. I want to be able to call the variable and apply shell color to it like so: echo -e '\033[1;32m$x:\033[0m'; The problem is not the color, however, it's how the script it interpretting the output. So the output I'm getting is: $x: I need the output to obviously be the string in the variable, and not the variable name. Is there any way around this issue?

    Read the article

  • How to detect if a form input element of type file is empty

    - by Ankur
    I have some code which reads a file through a form field of type file <input type="file" ... /> I want to give the user another option of providing a url to a file rather than having to upload it as many are already online. How can I detect when this field is empty on the server side. I am using Apache Commons FileUpload FileItemStream item = iter.next(); name = item.getFieldName(); stream = item.openStream(); if(!item.isFormField()){ if(item.toString()!=""){ .... I need to detect when item is empty. The above code doesn't work, nor does using: if(item.equals(null)){ ....

    Read the article

  • Create empty C# event handlers automatically

    - by TomA
    It is not possible to fire an event in C# that has no handlers attached to it. So before each call it is necessary to check if the event is null. if ( MyEvent != null ) { MyEvent( param1, param2 ); } I would like to keep my code as clean as possible and get rid of those null checks. I don't think it will affect performance very much, at least not in my case. MyEvent( param1, param2 ); Right now I solve this by adding an empty inline handler to each event manually. This is error prone, since I need to remember to do that etc. void Initialize() { MyEvent += new MyEvent( (p1,p2) => { } ); } Is there a way to generate empty handlers for all events of a given class automatically using reflection and some CLR magic?

    Read the article

  • form not showing for empty records

    - by Chris Hodges
    I have a relatively simple PHP page called editcustomers with 3 columns. The problem I'm having is that the form will show when there is a record in the database and the fields will be populated with that info. When no such records exists, the form is not even shown, eliminating the possibility to insert a record. My page layout is as follows: Column 1 shows a form containing customer information, allowing it to be edited. Column 2 allows ordering of products and showing how many products were ordered Column 3 shows the total paid so far, and the total owing. The code for the page I have at present: <html> <?php $id = $_GET['id']; require_once('connect.php'); $sth = $dbh->query("SELECT * FROM users where id = '$id';"); $sth->setFetchMode(PDO::FETCH_ASSOC); $eth = $dbh->query("SELECT * FROM purchases where id = '$id';"); $eth->setFetchMode(PDO::FETCH_ASSOC); ?> <div id="main"> <div id="left"> <form name="custInfo" action ="process.php" method ="post" > <input type = "hidden" name ="formType" value="custInfo"/> <?php while($row = $sth->fetch()){ ?> <p><input type = "hidden" name ="id" value="<?php echo $row["id"] ?>"/> <p><input type = "text" name ="firstName" size ="30" value=" <?php echo $row["firstName"]?>"/> <p><input type = "text" name ="lastName" size ="30" value="<?php echo $row["lastName"]?>"/> <p><input type = "text" name ="country" size ="30" value="<?php echo $row["country"]?>"/> <p></p> <input type="submit" value="Update" /> <?php }?> </div> <div id="mid"> <form name="custCosts" action ="process.php" method ="post" > <input type = "hidden" name ="formType" value="custCosts"/> <?php while($row = $eth->fetch()){ ?> <p><input type = "hidden" name ="id" value="<?php echo $row["id"] ?>"/> <p><input type = "text" name ="amountOwed" size ="30" value=" <?php echo $row["amountOwed"]?>"/> <p><input type = "text" name ="numAaa" size ="30" value="<?php echo $row["numAaa"]?>"/> <p><input type = "text" name ="numBbb" size ="30" value="<?php echo $row["numBbb"]?>"/> <p></p> <input type="submit" value="Update" /> <?php }?> </div> <div id="right"> <b>Total Balance</b> <p> Money owed: </p> <p> aaa total: </p> <p> bbb total: </p> <p> Total: </p> <input type = "text" name ="pay" size ="20" /></p> <input type="submit" value="Make Payment" /> </div> <?php $dbh =null; ?> </body> </html> And the code for all the database trickery: <?php require_once 'connect.php'; $formType = $_POST['formType']; $id = $_POST['id']; $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $country = $_POST['country']; $amountOwed = $_POST['amountOwed ']; $numAaa = $_POST['numAaa']; $numBbb = $_POST['numBbb']; if(empty($_POST['id'])) { $sth = $dbh->prepare("INSERT INTO customers (firstName, lastName, country) VALUES ('$firstName', '$lastName', '$country')"); $sth->execute(); } elseif(!empty($_POST['id']) && !isset($_POST['stayCost']) && $_POST['formType'] == 'guestInfo'){ $sth = $dbh->prepare("UPDATE customers SET firstName = '$firstName', lastName = '$lastName', country = '$country' WHERE id = '$id'"); $sth->execute(); }elseif(!empty($_POST['id']) && isset($_POST['stayCost']) && $_POST['formType'] == 'guestInfo'){ $sth = $dbh->prepare("INSERT INTO purchases (id, amountOwed, numAaa, numBbb) VALUES ('$id', '$amountOwed', '$numAaa', '$numBbb'"); $sth->execute(); }elseif(!empty($_POST['id']) && $_POST['formType'] == 'guestCosts'){ $sth = $dbh->prepare("UPDATE purchases SET amountOwed= '$amountOwed', numAaa = '$numAaa', numBbb= '$numBbb' WHERE id = '$id'"); $sth->execute(); } $dbh =null; ?> Why does the form not even display if there is no record? An error or something I might understand....but the form is still in the HTML and should still be being output, from what I can see. Why is this not the case?

    Read the article

  • Solution Output Directory

    - by L.E.O
    The project that I'm currently working on is being developed by multiple teams where each team is responsible for different part of the project. They all have set up their own C# projects and solutions with configuration settings specific to their own needs. However, now we need to create another, global solution, which will combine and build all projects into the same output directory. The problem that I have encountered though, is that I have found only one way to make all projects build into the same output directory - I need to modify configurations for all of them. That is what we would like to avoid. We would prefer that all these projects had no knowledge about this "global" solution. Each team must retain possibility to work just with their own sub-solution. One possible workaround is to create a special configuration for all projects just for this "global" solution, but that could create extra problems since now you have to constantly sync this configuration settings with the regular one, used by that specific team. Last thing we want to do is to spend hours trying to figure out why something doesn't work when building under global solution just because of some check box that developers have checked in their configuration, but forgot to do so in the global configuration. So, to simplify, we need some sort of output directory setting or post build event that would only be present when building from that global, all-inclusive solution. Is there any way to achieve this without changing something in projects configurations? Update 1: Some extra details I guess I need to mention: We need this global solution to be as close as possible to what the end user gets when he installs our application, since we intend to use it for debugging of the entire application when we need to figure out which part of the application isn't working before sending this bug to the team working on that part. This means that when building under global solution the output directory hierarchy should be the same as it would be in Program Files after installation, so that if, for example, we have Program Files/MyApplication/Addins folder which contains all the addins developed by different teams, we need the global solution to copy the binaries from addins projects and place them in the output directory accordingly. The thing is, the team developing an addin doest necessary know that it is an addin and that it should be placed in that folder, so they cannot change their relative output directory to be build/bin/Debug/Addins.

    Read the article

  • Deserialize Xml with empty elements in C#

    - by user204086
    Trying to deserialize some xml snippits into objects. The problem is that I'm getting an invalid format on every empy element tag. I can deserialize the object no problem when all of the elements have values. Or the empty elements are ommitted. Xml Snippit: <foo><propOne>1</propOne><propTwo /></foo> C# Class: [Serialilbe()] public class foo { public foo(){} [XmlElementAttribute(IsNullable = true)] public int? propOne {get;set;} [XmlElementAttribute(IsNullable = true)] public int? propTwo {get;set;} } Is there a setting on the class I can make to adjust the parsing? or Is there an easy way I can apply xsl to remove these elements? or Should I use regEx to remove the empty elements be fore desrializing? or an even better way?

    Read the article

  • python dict.fromkeys() returns empty

    - by slooow
    I wrote the following function. It returns an empty dictionary when it should not. The code works on the command line without function. However I cannot see what is wrong with the function, so I have to appeal to your collective intelligence. def enter_users_into_dict(userlist): newusr = {} newusr.fromkeys(userlist, 0) return newusr ul = ['john', 'mabel'] nd = enter_users_into_dict(ul) print nd It returns an empty dict {} where I would expect {'john': 0, 'mabel': 0}. It is probably very simply but I don't see the solution.

    Read the article

  • How to empty a socket in python?

    - by luc
    I need to empty the data on a socket (making sure that there is nothing to receive). Unfortunately, there is no function for this in the python socket module. I've implemented something this way: def empty_socket(sock): """remove the data present on the socket""" input = [sock] while 1: inputready, o, e = select.select(input,[],[], 0.0) if len(inputready)==0: break for s in inputready: s.recv(1) What do you think? Is there a better way to do that? Update: I don't want to change the socket timeout. What's why i prefer a select to a read. Update: The original question was using the 'flush' term. It seems that 'empty' is a better term. Update - 2010-02-27 : I've noticed a bug after when the pair has closed. The inputready is always filled with the sockets. I fixed that by adding a maximum number of loops. Is there a better fix?

    Read the article

  • Return Empty String as NULL

    - by Daniel
    I have a listbox select and I want when the user selects null for the empty string it produces to pull the nulls from the SQL table. Here's what I have now. Blank strings return nothing because there are no empty fields in the table. SELECT * FROM dbo.Table WHERE ID = " & TextBox2.Text & " and And Field1 IN (" & Msg1 & ") How do I code that?

    Read the article

  • Jquery UI Dialog Empty On Auto-Open

    - by user1019588
    I am having a somewhat strange error with my jquery dialog. When I have it autoopen, the dialog box is completely empty. If I exit out of the dialog and then reopen (through the standard dialog open event) the content appears. The jquery setup: $("#content_locker").dialog({ autoOpen: true, modal: true, height: 600, width: 800 }); Here you can see the webpage that I am working on (it is a link-shortening service). The dialog div starts on line 148 of the source: <div id="content_locker" title="Exclusive Content"> You will see that the dialog is empty. If you exit out and click on the unlock button, the proper html is there. Any ideas?

    Read the article

  • Limit output of all Linux commands

    - by daniel
    I'm looking for a way to limit the amount of output produced by all command line programs in Linux, and preferably tell me when it is limited. I'm working over a server which has a lag on the display. Occasionally I will accidentally run a command which outputs a large amount of text to the terminal, such as cat on a large file or ls on a directory with many files. I then have to wait a while for all the output to be printed to the terminal. So is there a way to automatically pipe all output into a command like head or wc to prevent too much output having to be printed to terminal?

    Read the article

  • July, the 31 Days of SQL Server DMO’s – Day 29 (sys.dm_os_buffer_descriptors)

    - by Tamarick Hill
    The sys.dm_os_buffer_descriptors Dynamic Management View gives you a look into the data pages that are currently in your SQL Server buffer pool. Just in case you are not familiar with some of the internals to SQL Server and how the engine works, SQL Server only works with objects that are in memory (buffer pool). When an object such as a table needs to be read and it does not exist in the buffer pool, SQL Server will read (copy) the necessary data page(s) from disk into the buffer pool and cache it. Caching takes place so that it can be reused again and prevents the need of expensive physical reads. To better illustrate this DMV, lets query it against our AdventureWorks2012 database and view the result set. SELECT * FROM sys.dm_os_buffer_descriptors WHERE database_id = db_id('AdventureWorks2012') The first column returned from this result set is the database_id column which identifies the specific database for a given row. The file_id column represents the file that a particular buffer descriptor belongs to. The page_id column represents the ID for the data page within the buffer. The page_level column represents the index level of the data page. Next we have the allocation_unit_id column which identifies a unique allocation unit. An allocation unit is basically a set of data pages. The page_type column tells us exactly what type of page is in the buffer pool. From my screen shot above you see I have 3 distinct type of Pages in my buffer pool, Index, Data, and IAM pages. Index pages are pages that are used to build the Root and Intermediate levels of a B-Tree. A Data page would represent the actual leaf pages of a clustered index which contain the actual data for the table. Without getting into too much detail, an IAM page is Index Allocation Map page which track GAM (Global Allocation Map) pages which in turn track extents on your system. The row_count column details how many data rows are present on a given page. The free_space_in_bytes tells you how much of a given data page is still available, remember pages are 8K in size. The is_modified signifies whether or not a page has been changed since it has been read into memory, .ie a dirty page. The numa_node column represents the Nonuniform memory access node for the buffer. Lastly is the read_microsec column which tells you how many microseconds it took for a data page to be read (copied) into the buffer pool. This is a great DMV for use when you are tracking down a memory issue or if you just want to have a look at what type of pages are currently in your buffer pool. For more information about this DMV, please see the below Books Online link: http://msdn.microsoft.com/en-us/library/ms173442.aspx Follow me on Twitter @PrimeTimeDBA

    Read the article

  • How do I draw a scene with 2 nested frames

    - by Guido Granobles
    I have been trying for long time to figure out this: I have loaded a model from a directx file (I am using opengl and Java) the model have a hierarchical system of nested reference frames (there are not bones). There are just 2 frames, one of them is called x3ds_Torso and it has a child frame called x3ds_Arm_01. Each one of them has a mesh. The thing is that I can't draw the arm connected to the body. Sometimes the body is in the center of the screen and the arm is at the top. Sometimes they are both in the center. I know that I have to multiply the matrix transformation of every frame by its parent frame starting from the top to the bottom and after that I have to multiply every vertex of every mesh by its final transformation matrix. So I have this: public void calculeFinalMatrixPosition(Bone boneParent, Bone bone) { System.out.println("-->" + bone.name); if (boneParent != null) { bone.matrixCombined = bone.matrixTransform.multiply(boneParent.matrixCombined); } else { bone.matrixCombined = bone.matrixTransform; } bone.matrixFinal = bone.matrixCombined; for (Bone childBone : bone.boneChilds) { calculeFinalMatrixPosition(bone, childBone); } } Then I have to multiply every vertex of the mesh: public void transformVertex(Bone bone) { for (Iterator<Mesh> iterator = meshes.iterator(); iterator.hasNext();) { Mesh mesh = iterator.next(); if (mesh.boneName.equals(bone.name)) { float[] vertex = new float[4]; double[] newVertex = new double[3]; if (mesh.skinnedVertexBuffer == null) { mesh.skinnedVertexBuffer = new FloatDataBuffer( mesh.numVertices, 3); } mesh.vertexBuffer.buffer.rewind(); while (mesh.vertexBuffer.buffer.hasRemaining()) { vertex[0] = mesh.vertexBuffer.buffer.get(); vertex[1] = mesh.vertexBuffer.buffer.get(); vertex[2] = mesh.vertexBuffer.buffer.get(); vertex[3] = 1; newVertex = bone.matrixFinal.transpose().multiply(vertex); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[0])); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[1])); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[2])); } mesh.vertexBuffer = new FloatDataBuffer( mesh.numVertices, 3); mesh.skinnedVertexBuffer.buffer.rewind(); mesh.vertexBuffer.buffer.put(mesh.skinnedVertexBuffer.buffer); } } for (Bone childBone : bone.boneChilds) { transformVertex(childBone); } } I know this is not the more efficient code but by now I just want to understand exactly how a hierarchical model is organized and how I can draw it on the screen. Thanks in advance for your help.

    Read the article

  • What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330)

    - by datSilencer
    I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming. I'm currently trying to implement deferred shading by using FBO's and their associated targets (textures in my case). I have a simple (I think :P) geometry+fragment shader program and I'd like to write its Fragment Shader stage output to three different render targets (previously bound by a call to glDrawBuffers()), like so: #version 330 in vec3 WorldPos0; in vec2 TexCoord0; in vec3 Normal0; in vec3 Tangent0; layout(location = 0) out vec3 WorldPos; layout(location = 1) out vec3 Diffuse; layout(location = 2) out vec3 Normal; uniform sampler2D gColorMap; uniform sampler2D gNormalMap; vec3 CalcBumpedNormal() { vec3 Normal = normalize(Normal0); vec3 Tangent = normalize(Tangent0); Tangent = normalize(Tangent - dot(Tangent, Normal) * Normal); vec3 Bitangent = cross(Tangent, Normal); vec3 BumpMapNormal = texture(gNormalMap, TexCoord0).xyz; BumpMapNormal = 2 * BumpMapNormal - vec3(1.0, 1.0, -1.0); vec3 NewNormal; mat3 TBN = mat3(Tangent, Bitangent, Normal); NewNormal = TBN * BumpMapNormal; NewNormal = normalize(NewNormal); return NewNormal; } void main() { WorldPos = WorldPos0; Diffuse = texture(gColorMap, TexCoord0).xyz; Normal = CalcBumpedNormal(); } If my render target textures are configured as: RT1:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE0, GL_COLOR_ATTACHMENT0) RT2:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE1, GL_COLOR_ATTACHMENT1) RT3:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE2, GL_COLOR_ATTACHMENT2) And assuming that each texture has an internal format capable of contaning the incoming data, will the fragment shader write the corresponding values to the expected texture targets? On a related note, do the textures need to be bound to the OpenGL context when they are Multiple Render Targets? From some Googling, I think there are two other ways to output to MRTs: 1: Output each component to gl_FragData[n]. Some forum posts say this method is deprecated. However, looking at the latest OpenGL 3.3 and 4.0 specifications at opengl.org, the core profiles still mention this approach. 2: Use a typed output array variable for the expected type. In this case, I think it would be something like this: out vec3 [3] output; void main() { output[0] = WorldPos0; output[1] = texture(gColorMap, TexCoord0).xyz; output[2] = CalcBumpedNormal(); } So which is then the recommended approach? Is there a recommended approach at all if I plan to code on top of OpenGL 3.3? Thanks for your time and help!

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >