Daily Archives

Articles indexed Saturday October 13 2012

Page 7/15 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How can I create an instance of a class that I can use is more than one place in c#

    - by user1743574
    So I've been working on a class that details students of a university. I have one button that sets the details to a new instance of a class, and another to check if the student passed, through a method in my Class. The problem is that I create an instance of a class in the first button to add the values from what the user input, but I cannot use the second button to access the instance of the class created in the first button. private void button3_Click(object sender, EventArgs e) { Student student1 = new Student(); label1.Text = student1.text(); if (student1.hasPassed() == true) { passfailtextbox.Text = "Pass"; } else { passfailtextbox.Text = "Fail"; } } private void button1_Click(object sender, EventArgs e) { Student student1 = new Student(); student1.FirstName = firstnamebox.Text; student1.SecondName = secondnamebox.Text; student1.DateofBirth = DateTime.Parse(dobtextbox.Text).Date; student1.Course = coursetextbox.Text; student1.MatriculationNumber = int.Parse(matriculationtextbox.Text); student1.YearMark = double.Parse(yearmarktextbox.Text); } public Boolean hasPassed() { if (YearMark < 40) { return false; } else { return true; } } public string text() { return "Student" + " " + firstname + " " + secondname + " " + course + " " + dob.ToString() + " " + matriculationnumber.ToString() + " " + yearmark.ToString() ; }

    Read the article

  • Micro Controller Serial Data identification or classification

    - by Posiedon
    I have a x51 family micro controller (P89V51RD2). I'm going to send some data from computer using serial port. The data i'll be sending are Character 'S' Character 'R' and a 2 digit integer. Upon receiving the data, I will be calling separate functions. I used if(chr=='S') and elseif(chr=='R')for character data. The main problem lies with identifying the 2 digit number sent. Any other data other than the above three mentioned will be discarded. Any ideas for identifying two digit integer ??

    Read the article

  • Delphi plugin for pasting text constants in source code?

    - by mjn
    Inserting (pasting from clipboard) of text constants in the Delphi code editor requires some manual "postprocessing" ... split up long text into multiple lines (and insert the string concatenation symbol) escape quotes (replace single quotes with double quotes) enclose the string with quotes keep original white space (leadinng blanks, line feeds) Is there a IDE plugin available which helps to reduce these manual steps?

    Read the article

  • Animation in a table view cell

    - by theomen
    I'm not sure if it is possible to achieve, but my costumer wants that when user taps a table view cell, an animation of a UIView sliding from left to right is committed, leaving the content under the UIView visible. My concern is about how to trigger gesture recognizer added to the upper UIVIew for the animation and do not enter in conflict with didSelectRowatIndex: table view delegate method. Is it possible to achieve? Mant thanks!

    Read the article

  • jQuery model-view-controller vs Spring MVC

    - by user1515968
    my question is what potential problems or difficulties would be with implementing usual web app with somewhat reach user interface (multiple dynamic tabs, accordians and so on) using jQuery MVC approach with Spring REST vs using Spring MVC. Problems what I can think of could be: I will not be able to use Spring security fully, JavaScript coding could become hard to manage, any form verification becomes not easy to manage... what else? and does jQuery MVC with REST make sense at all? On other side jQuery with MVC and REST move all GUI concerns to JavaScript side (whether it is bad or not) and leave all data manipulation to server side.

    Read the article

  • Resize images to fit image control in asp.net javascript

    - by tszoro
    I change an image in the header based on which menu item is selected. The problem is that the image stretches in the image control. I want it to automatically zoom without distorting the image. Is this possible. Note: The images reside in an images folder and are not all the same size. Javascript <script type="text/javascript"> function ChangeProjectImage(imgpath) { var img1 = document.getElementById("Image2") img1.src = imgpath; } </script>

    Read the article

  • Cannot running next process when a variable save no value

    - by bruine
    First, I wanna compare between 2 tables tb_wrapper and tb_summary to get the data in the tb_wrapper that doesn't exist in the tb_summary then save in $link. If I don't get the same data, I want to print the result $link. When I don't get the not same data, I want it to go to another process. Here's the code : $q2 = mysql_query(" SELECT a.doc_url FROM tb_wrapper a LEFT JOIN tb_summary b ON a.doc_name = b.doc_summ WHERE b.doc_summ IS NULL"); while ($row = mysql_fetch_array($q2)){ $link = $row['doc_url']; if (!$link){ include 'next_process.php'; } else { print_r($link); } } it doesn't work. When I don't get the not same data or $link not save a value. table : CREATE TABLE tb1 (`id` int, `doc_name` varchar(100), `doc_url` varchar(50)) } CREATE TABLE tb2 (`id` int, `doc_summ` varchar(100)) }

    Read the article

  • Semantically correct nested anchors

    - by Blackie123
    I am working on a web applicaton. And what we also create is something that could be described as inline editing. Just to portray thing I am trying to solve I use example of Facebook post. You have post like. Steve Jobs added 5 new photos Steve Jobs is link that redirects to his profile so in HTML, that would be: <div class="post-block"> <p><a href="stevejobs/" title="#">Steve Jobs</a> added 5 new photos.<p> </div> But what I want is the whole post "block" to be clickable although I want only that name to appear to be link. Normally in HTML logic would say to to this: <a href="stevejobs/" title="#"><div class="post-block"> <p><a href="stevejobs/" title="#">Steve Jobs</a> added 5 new photos.<p> </div></a> But this isn't semantically correct. Quick look to HTML 4.01 or any other standard says something like this: Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements. How to create it semantically correct other than using javascript and defining div:hover state for the whole "div anchor"?

    Read the article

  • Direct3D Rotation Matrix from Vector and vice-versa

    - by Beta Carotin
    I need to compute a rotation matrix from a direction vector, and a direction vector from a rotation matrix. The up direction should correspond to the z-axis, forward is y and right is x; D3DXMATRIX m; // the rotation matrix D3DXVECTOR3 v; // this is the direction vector wich is given D3DXVECTOR3 r; // resulting direction vector float len = D3DXVec3Length(&v); // length of the initial direction vector // compute matrix D3DXMatrixLookAtLH(&m, &v, &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,0,1)); // use the matrix on a vector { 0, len, 0 } D3DXVec3TransformCoord(&r, &D3DXVECTOR3(0,len,0), &m); Now, the vector r should be equal to v, but it isnt. What exactly do I have to do to get the results I need?

    Read the article

  • Integrating twitter pull request with another application

    - by jade
    i'm an absolute newbie to webapps, so please forgive if my question is quite naive or not upto the mark.i have been assigned a task to develop a web app which integrates the twitter pull request with another application using the particular application APIs.basically i dont know what it means.Can anyone explain what is intended to be done and if there is any example of such web apps if any,it will be most appreciated, so that i can get an idea of what is to be actually done.i'm planning to do this using ruby

    Read the article

  • xcode storyboard reverting in compile

    - by darren
    I started having some very odd behaviour in Xcode 4.5 recently. I made a change to a UITableViewController with static cells but the changes did not appear in the simulator and neither did my code changes. I removed the app from the simulator and ran clean on the project, then started again and all the changes appeared. I made another code change, ran the debugger via simulator and once again I saw my old UITableViewController values and my code changes were absent. This project is using storyboards, but I am not sure if this problem is related to just storyboards given my code changes are reverted as well. I am deeply confused here. Not even clean fixed this issue. Any thoughts or suggestions?

    Read the article

  • Using IF statements to find string length in array for alignment (Visual Basic)

    - by Brodoin
    My question is just as it says in the title. How would one use IF statements to find the string-length of content in an array, and then make it so that they show up in a Rich Text Box with the left sides aligned? Noting that one value in my array is a Decimal. Imports System.IO Imports System.Convert Public Class frmAll 'Declare Streamreader Private objReader As StreamReader 'Declare arrays to hold the information Private strNumber(24) As String Private strName(24) As String Private strSize(24) As String Private decCost(24) As Integer Private Sub frmAll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Set objReader objReader = New StreamReader("products.csv") 'Call the FillArray sub to fill the array Call FillArray() End Sub Private Sub FillArray() 'Declare variables and arrays Dim decCost(24, 1) As Decimal Dim strFields() As String Dim strRec As String Dim intCount As Integer = 0 Dim chrdelim As Char = ToChar(",") 'Set strRec to read the lines strRec = objReader.ReadLine 'Do while loop to fill array. Do While strRec <> Nothing strFields = strRec.Split(chrdelim) strNumber(intCount) = strFields(0) strName(intCount) = strFields(1) strSize(intCount) = strFields(2) decCost(intCount, 0) = ToDecimal(strFields(3)) decCost(intCount, 1) = ToDecimal(strFields(4)) 'Set strRec to read the lines again strRec = objReader.ReadLine 'increment the index intCount += 1 Loop 'Call the Calculate sub for calculation Call Calculate(decCost) End Sub Private Sub Calculate(ByVal numIn(,) As Decimal) 'Define arrays to hold total cost Dim decRowTotal(24) As Decimal 'Define variables to hold the counters for rows and columns Dim intR As Integer Dim intC As Integer 'Calcualte total cost For intC = 0 To 1 For intR = 0 To 24 decRowTotal(intR) += numIn(intR, intC) * 1 Next Next 'Call the Output sub to configure the output. Call Output(numIn, decRowTotal) End Sub Private Sub Output(ByVal NumIn(,) As Decimal, _ ByVal RowTotalIn() As Decimal) 'Variables Dim strOut As String Dim intR As Integer = 0 Dim intC As Integer = 0 'Set header for output. strOut = "ID" & vbTab & "Item" & vbTab & vbTab & vbTab & "Size" & _ vbTab & vbTab & vbTab & vbTab & "Total Price" & _ vbCrLf & "---------- ... -------------------------" & vbCrLf 'For loop to add each line to strOut, setting 'the RowTotalIn to currency. For intC = 0 To 24 strOut &= strNumber(intC) & vbTab strOut &= strName(intC) & vbTab strOut &= strSize(intC) & vbTab strOut &= RowTotalIn(intC).ToString("c") & vbCrLf Next 'Add strOut to rbtAll rtbAll.Text = strOut End Sub End Class Output It shows up with vbTabs in my output, but still, it looks similar in that they are not aligned. The first two do, but after that they are not, and I am totally lost. P0001 Coffee - Colombian Supreme 24/Case: Pre-Ground 1.75 Oz Bags $16.50 P0002 Coffee - Hazelnut 24/Case: Pre-Ground 1.75 Oz Bags $24.00 P0003 Coffee - Mild Blend 24/Case: Pre-Ground 1.75 Oz Bags $20.50 P0004 Coffee - Assorted Flavors 18/Case. Pre-Ground 1.75 Oz Bags $23.50 P0005 Coffee - Decaf 24/Case: Pre-Ground 1.75 Oz Bags $20.50

    Read the article

  • how to pass instance variables between handlers (routes) in sinatra (without flash, sessions, class variable or db)?

    - by jj_
    Say you have: get '/' do haml :index end get '/form' do haml :form end post '/form' do @message = params[:message] redirect to ('/') --- how to pass @message here? end I'd like the @message instance variable to be available (passed to) in "/" action as well, so I can show it in haml view. How can I do that without using session, flash, a @@class_variable, or db persistence ? I'd simply like to pass values as if I was working with passing values between methods. I don't want to use session cookies because user could have them turned off, I don't like it being a class variable which is exposed to all code, and I don't need to overhead of a db. Thanks edit: This is another question explaining a very easy way to deal with this in rails Passing parameters in rails redirect_to This is some more info i gathered around from forums. The following works for rails, i've tried it in Sinatra but no luck, but please try it, maybe I did something wrong, I don't know, and if this code help someone come up with a new idea, please share it If you are redirecting to action2 at the end of action1, just append the value to the end of the redirect: my_var = <some logic> redirect_to :action => 'action2', :my_var => my_var on the same thread another user proposes the folowing: def action1 redirect_to :action => 'action2', :value => params[:current_varaible] end def action2 puts params[:value].inspect end source: http://www.ruby-forum.com/topic/134953 Can something like this work in Sinatra? Thanks

    Read the article

  • "error creating files compilation failed" when publishing for iOS on Flash CS5.5

    - by user1662660
    I'm currently developing an app using Flash CS5.5 for iOS. All of my .ipa files have been created and tested with no problems so far. Until now. I'm using Windows. It only started today and happens to every file I try to publish. I get the error "error creating files. compilation failed..." That is the only piece of information I am given about the error. All of my certificates and provisioning profiles are legit and still valid. Has anyone had any experience with this before? Since posting the question I have found a resolution that I will post for anyone who encounters the same problem. In this case I was unable to publish my .ipa file as I was opening the document (and Flash) from the start menu in Windows 7. To fix this instance of the issue I simply opened Flash first and then opened my document and I was able to publish.

    Read the article

  • Redis suggesstion for selecting data type

    - by PHP Connect
    We have questions based where in home page we were showing 2 list Questions by date modified Question have bigger views and ans count. And in this both listing if question have same views or ans count then sorting is based on date. Previously i am directly quiring to MySQL database and fetching the values so it's easy. But each page request hitting to MySQL it's bit expensive then start doing caching. I started using Redis. Following is the cases when i use redis cache Issues is On second listing i have to display questions by votes and not answered combine. How can i stored this type of data in redis to load faster with sorting based by 2 conditions votes with time and ans count with time?

    Read the article

  • How to crete a Java Iterator that throws IOException

    - by Antonio
    I'd like to implement an iterator that retrieves objects from disk/network. Iterator itr = getRemoteIterator(); while(itr.hasNext()) { Object element = itr.next(); System.out.print(element + " "); } However the problem is that hasNext() and next() methods of the Iterator object does not allow to throw IOException. Is there any other standard interface work around this issue? Desired code is: public interface RemoteIterator<E> { boolean hasNext() throws IOException; E next() throws IOException; void remove(); }

    Read the article

  • My PHP code is commented out

    - by Mr A
    Before everything happened, I was running this wordpress install for developing themes using xampp. But I decided to upgrade the memory of this machine from 2GB to 6GB since I need extra room for applications. I back-up my code in a separate partition by copying them. Since I have a 32bit OS at the time, I format the computer and installed a 64bit version. All is well and fine the OS side. When I setup my web dev environment something goes wrong. When I imported my htdocs back, first by just fully copying them to a new fresh install of xampp and notice that all of the codes that put are not working. My CI code is displaying my PHP code in the browser. My theme in wordpress is also commenting out my PHP code when I view the source. The themes included in my fresh wordpress install works so there's something I am missing here. From the looks of it, the php is being executed properly since anything that I install works. Just that the ones that came from a previous xampp is not.

    Read the article

  • Change the colors of JvectorMap when there are 2 maps on the page

    - by Youssef
    i am using Jvectormap to place 2 maps on my page. the maps are placed normally and everything is fine. they are placed in 2 different divs: <div id="map1"> </div> <div id="map2"> </div> and the Jquery: $(function () { $('#map1').vectorMap({ color: '#aaaaaa', backgroundColor: '#ffffff', hoverOpacity: 1, hoverColor: true }); }); $(function () { $('#map2').vectorMap({ color: '#aaaaaa', backgroundColor: '#ffffff', hoverOpacity: 1, }); }); Now when I try to change the colors of map2 dynamically using: $("#map2").vectorMap("set", "colors", colorsDictionnary); The colors of the first one only is changed. and this happens only when changing colors. Always the first one have it's colors changed even if I am using $("#map2") How can change the colors of the map2 without touching map1? Thank you very much for any help, I really need it

    Read the article

  • Pivot to obtain EAV data

    - by Snowy
    I have an EAV table (simple key/value in every row) and I need to take the 'value' from two of the rows and concat them into a single row with a single column. I can't seem to get through the part where I just have the pivot straight. Can anyone help me figure this out? Declare @eavHelp Table ( [Key] VARCHAR (8) NOT NULL, [Value] VARCHAR (8) NULL ) Insert Into @eavHelp Values ( 'key1' , 'aaa' ) Insert Into @eavHelp Values ( 'key2' , 'bbb' ) Select * From @eavHelp Pivot ( Min( [Value] ) For [Value] in ( hmm1 , hmm2 ) ) as Piv Where [Key] = 'key1' or [Key] = 'key2' That makes: Key hmm1 hmm2 -------- -------- -------- key1 NULL NULL key2 NULL NULL But what I want to make is: hmmmX ----- aaa;bbb

    Read the article

  • Div at bottom of window and adaptable height div

    - by Rob
    Is there a way to get a div to always be at the bottom of the window, and another div to change its height to fill any space that it leaves, and that div will scroll if its content is too long. (I never want the window to scroll). This is best illustrated by a picture: The green div will always put itself at the bottom of the window, and the orange div will fill the gap. When the window is smaller, like in the right hand image, the orange div will be smaller and will scroll. The green div can be toggled. Sometimes the green div will have display: none, and then the orange div will stretch to the bottom. When the green div has display: block again, it will look like the picture again. It has to work in IE6. So far I can get the green div to go to the bottom by: position: absolute; bottom: 0; But I don't know how to get the orange div to do what I want.

    Read the article

  • How do you search the text of changelist descriptions in Perforce?

    - by raven
    On occasion, I find myself wanting to search the text of changelist descriptions in Perforce. There doesn't appear to be a way to do this in P4V. I can do it by redirecting the output of the changes command to a file... p4 changes -l > p4changes.txt ...(the -l switch tells it to dump the full text of the changelist descriptions) and then searching the file, but this is rather cumbersome. Has anyone found a better way?

    Read the article

  • Windows 7 Laptop, cursor jumping after typing the letters "y" or "t" [closed]

    - by Dave K
    My wife has an HP laptop running windows 7. She has a very frustrating problem when typing: in some, but not all cases, typing the letter's "y" or "t" will cause the cursor to jump back a few lines or some number of words. The result is that she ends up typing over whatever it was that she was working on. (as a matter of fact, I just experienced this while typing this question on her computer with the phrase: "typing the letter..." above.) I've installed the latest drivers for her touchpad from Synaptic and disabled tap touching and gesture features to rule out simple unintended mouse clicks. Still the "y" and "t" keys continue to cause problems.

    Read the article

  • A really unique case of Load Balancing

    - by Shamshun
    I have an internet connection which has limited up/down bandwidth per IP address. What I want to do is to get multiple IP addresses on a "single" LAN interface, and use a load balancer to distribute traffic through them. I was successful at getting 100 ip addresses on a single interface. my problem is that Linux and Windows use the first ip address of an interface by default, so my bandwidth is not increased. I would appreciate if someone tells me what Load Balancing software has the ability to distribute load between multiple IPs on a single interface. I have tried to do so on both Win7 and Backtrack-LinuxR2

    Read the article

  • No scheduled tasks in Esxi 5?

    - by Jeroen Jacobs
    I'm using the free version of VMWare's ESXi 5.1.0. I'm logged in as root in the vSphere client, and I want to create some scheduled tasks. According to the documentation, I should go to "Home"="Management"="Scheduled tasks". However, when I go to "Home", I only have "Inventory" and "Administration". There is no "Management" section. Is this a limitation of the free version (I doubt it, but still), or am I missing the obvious here?

    Read the article

  • Requests are making it to my app server, but not into node.js -- why?

    - by Zane Claes
    I detailed in this question on StackOverflow how some random requests are not making it from the client to my Node.js app server, resulting in a gateway timeout. In summary, identical requests are, at random, not even making it far enough to trigger a console.log() in my first line of express middleware. I need to narrow down the problem, though, to find out WHERE the traffic is being lost and it was suggested that I try a packet sniffer on my app servers. Here's my setup: 2x Load Balancers (m1.larges) 2x node.js servers (also m1.large) Here's what's interesting/unusual: the node.js servers started as PHP servers with an Apache stack and continue to serve PHP files for my domain (streamified.me). However, I use a little httpd.conf magic on the app servers so that requests to api.streamified.me get routed over port 8888 to the node.js server: RewriteCond %{HTTP_HOST} ^api.streamified.me RewriteRule ^(.*) http://localhost:8888$1 [P] So, the request hits the load balancer = goes to an app server = gets routed to port 8888 if it's intended for the API = gets handled by node.js So, in the same httpd.conf file, I turned on RewriteLogLevel 5 and then created a simple PHP+CURL script on my localhost to hit my api.streamified.me with a random URL (which should cause node.js to trigger a simple "not found" response) until it resulted in a Gateway timeout. Here, you can see that it has happened -- and the rewrite log shows that the request was definitely received by the app server and forwarded to port 8888... but it was never received by node.js (or, at least, the first line of code in the first line of middleware never gets it...) Image Link: http://i.stack.imgur.com/3OQxS.png

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >