Search Results

Search found 220 results on 9 pages for 'tyler benson'.

Page 6/9 | < Previous Page | 2 3 4 5 6 7 8 9  | Next Page >

  • Custom Java Swing Meter Control

    - by Tyler
    I'm trying to make a custom swing control that is a meter. The arrow will move up and down. Here is my current code, but I feel I've done it wrong. import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.LinearGradientPaint; import java.awt.Polygon; import java.awt.Stroke; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import javax.swing.JFrame; import javax.swing.JPanel; public class meter extends JFrame { Stroke drawingStroke = new BasicStroke(2); Rectangle2D rect = new Rectangle2D.Double(105, 50, 40, 200); Double meterPercent = new Double(0.57); public meter() { setTitle("Meter"); setLayout(null); setSize(300, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); } public void paint(Graphics g) { // Paint Meter Graphics2D g1 = (Graphics2D) g; g1.setStroke(drawingStroke); g1.draw(rect); // Set Meter Colors Point2D start = new Point2D.Float(0, 0); Point2D end = new Point2D.Float(0, this.getHeight()); float[] dist = { 0.1f, 0.5f, 0.9f }; Color[] colors = { Color.green, Color.yellow, Color.red }; LinearGradientPaint p = new LinearGradientPaint(start, end, dist, colors); g1.setPaint(p); g1.fill(rect); // Make a triangle - Arrow on Meter int[] x = new int[3]; int[] y = new int[3]; int n; // count of points // Set Points for Arrow Integer meterArrowHypotenuse = (int) rect.getX(); Integer meterArrowTip = (int) rect.getY() + (int) (rect.getHeight() * (1 - meterPercent)); x[0] = meterArrowHypotenuse - 25; x[1] = meterArrowHypotenuse - 25; x[2] = meterArrowHypotenuse - 5; y[0] = meterArrowTip - 20; // Top Left y[1] = meterArrowTip + 20; // Bottom Left y[2] = meterArrowTip; // Tip of Arrow n = 3; // Number of points, 3 because its a triangle // Draw Arrow Border Polygon myTriShadow = new Polygon(x, y, n); // a triangle g1.setPaint(Color.black); g1.fill(myTriShadow); // Set Points for Arrow Board x[0] = x[0] + 1; x[1] = x[1] + 1; x[2] = x[2] - 2; y[0] = y[0] + 3; y[1] = y[1] - 3; y[2] = y[2]; Robot robot = new Robot(); Color colorMeter = robot.getPixelColor(x[2]+10, y[2]); // Draw Arrow Polygon myTri = new Polygon(x, y, n); // a triangle Color colr = new Color(colorMeter.getRed(), colorMeter.getGreen(), colorMeter.getBlue()); g1.setPaint(colr); g1.fill(myTri); } public static void main(String[] args) { new meter(); } } Thanks for looking.

    Read the article

  • Flash AS3 button eventlistener array bug

    - by Tyler Pepper
    Hi there, this is my first time posting a question here. I have an array of 12 buttons on a timeline that when first visiting that part of the timeline, get a CLICK eventlistener added to them using a for loop. All of them work perfectly at that point. When you click one it plays a frame label inside the specific movieClip and reveals a bio on the corresponding person with a close button and removes the CLICK eventlisteners for each button, again using a for loop. The close button plays a closing animation, and then the timeline goes back to the first frame (the one with the 12 buttons on it) and the CLICK eventlisteners are re-added, but now only the first 9 buttons of the array work. There are no output errors and the code to re-add the eventlisteners is exactly the same as the first time that works. I am completely at a loss and am wondering if anyone else has run into this problem. All of my buttons are named correctly, there are absolutely no output errors (I've used the debug module) and I made sure the array with the buttons in it is outputting all 12 at the moment the close button is clicked to add the eventlisteners back. for (var q = 0; q < ackBoDBtnArray.length; q++){ contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[q]].addEventListener(MouseEvent.CLICK, showBio); } private function showBio(eo:MouseEvent):void { trace("show the bio"); bodVar = ackBoDBtnArray.getIndex(eo.target.name); contentArea_mc.acknowledgements_mc.BoD_mc.gotoAndPlay(ackBoDPgArray[bodVar]); contentArea_mc.acknowledgements_mc.BoD_mc.closeBio_btn.addEventListener(MouseEvent.CLICK, hideBio); for (var r = 0; r < ackBoDBtnArray.length; r++){ contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[r]].mouseEnabled = false; contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[r]].removeEventListener(MouseEvent.CLICK, showBio); } } private function hideBio(eo:MouseEvent):void { trace("hide it!"); contentArea_mc.acknowledgements_mc.BoD_mc.closeBio_btn.removeEventListener(MouseEvent.CLICK, hideBio); contentArea_mc.acknowledgements_mc.BoD_mc.gotoAndPlay(ackBoDClosePgArray[bodVar]); for (var s = 0; s < ackBoDBtnArray.length; s++){ trace(ackBoDBtnArray[s]); contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[s]].mouseEnabled = true; contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[s]].addEventListener(MouseEvent.CLICK, showBio); } Thanks in advance for any help and insight you can provide...I have a slight feeling that its something that may be obvious to another set of eyes...haha.

    Read the article

  • URL encoding for document.location.href

    - by Tyler
    Hello - I am building an iFrame and am using document.location.href - my exact code is: <script type="text/javascript"> document.write("<iframe src='http://www.facebook.com/plugins/like.php?href=" + document.location.href + "&layout=standard&show_faces=false&action=like&font=verdana&colorscheme=light' frameborder=0></iframe>"); </script> This is working great for all of my pages except one. I believe the issue with the one page is caused by a dash "-" being in the page name. My questions is - is there a way to encode my src differently so that the link works? The CORRECT URL I want it to pull is: []/products/Product%252dExample.html But what it IS pulling in is: []/products/Product-Example.html And this is causing the page to not work correctly. Thanks!

    Read the article

  • Trying to understand MVC Models, Advice?

    - by Tyler
    I am writing my own MVC for the purpose of learning it. I have pretty much everything "down-pat" and my main stuff written besides models due to some trouble understanding them and lack of viable examples. Now, I've been told a model should reprecent a single row, someone told me, your model class should on update/insert and delete rows, anything that involves fetching a single or multiple rows - a "finder" class should be used. So... a) what is a finder class, b) how do I implement it in a useage example, c) Is what I've been told about models correct or is there a better way than "finders"? Advice is much appricated :)

    Read the article

  • need help with 301 redirect and seo urls

    - by tyler
    Ok, i used the below to "seoize" my urls. It works great..the only problem is when i go to the old page it doesnt redirect to the new page.. so i have a feeling i will get two pages indexed in google... how can i just permenantly redirect the old pages eto new urls... RewriteRule ^city/([^/]+)/([^/]+) /rate-page.php?state=$1&city=$2 [NC] http: / / www.ratemycommunity.com/city/Kansas/Independence and old page = http://www.ratemycommunity.com/rate-page.php?state=Kansas&city=Independence

    Read the article

  • Dispaly a gallery of images that are stored as Drawables in a List

    - by Tyler
    Hello - I am trying to modify this example: http://developer.android.com/resources/tutorials/views/hello-gridview.html But instead of displaying images that are resources, I want to display Drawables that I currently am storing in a List. Can anyone instruct me on how I would modify private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7 }; To display my drawable items instead? Thanks!

    Read the article

  • c# Resize Function

    - by Tyler
    So my logic is flawed and I need a better and correct way to resize an image in my c# app I need a function similar to this setup public void ResizeImageForWeb(string OriginalFile, string NewFile, int MaxWidth, int MaxHeight, int Quality) { // Resize Code } Basically, I'm a web designer lost trying to programming a desktop app.

    Read the article

  • Binding a Button to a GridView

    - by Tyler
    This a pretty simple question, I'm just not sure how to do it exactly. I would like to bind a Button or perhaps ImageButton to a GridView in ASP.NET/C#. Currently, the GridView has two columns and is bound to a DataTable with two columns. I want to add a third column to the GridView, which will include the Button. I know GridView has ButtonField, but I'm not too sure how to go about using it to do what I want. I want to dynamically generate these Buttons and add them to the GridView. Here is how my GridView looks right now: <asp:GridView ID="GridView1" Runat="server"> <Columns> <asp:HyperLinkField HeaderText="Display Name" DataNavigateUrlFields="DISPNAME" DataNavigateUrlFormatString="ViewItem.aspx" DataTextField="DISPNAME"> <ItemStyle Width="70%" /> </asp:HyperLinkField> <asp:BoundField DataField="TypeDisp" HeaderText="Type"> <ItemStyle Width="20%" /> </asp:BoundField> </Columns> </asp:GridView>

    Read the article

  • Why is my program printing out the null termination character?

    - by Tyler Pfaff
    When I run this, it will SOMETIMES print out a null termination character. Most of the time it will, and probably 1/5 times it will print just the characters. void cryptogram::Encrypt(){ cout<<"encrypt"<tempS){ len=tempS.length(); int a=0; for(int j=0;j if(j!=len){ //if the word still has more characters j++; a=0; }else{ //if the word is done being scanned cout<<" "; } } } } } } } So that's it and this is the corresponding EXPECTED output that is printed SOMETIMES xvk bkikhxlr wggbtfkj wiylekgbdhx wjjm hko wigbtubxt xvk iwhj uedjkm glctb gvrmdiwhj iebbdielmeggtbx ctb xvtmk gbtubxvk wjjdxdthgbtubodll khvxvk imkbfdik xt xvk bkudth whj gbtfdjk hko tgxdthm whj tggtbxehdxdkm ctb mxejkhxmibdzdhtltur whj pemxdik mxejdkm mxdh cok wbk wlmt gbkgctb cteb hko zdh cgvrmdikjeiwhj qdhkmdtlturzzkjdydtivkzdmxbrw zdh zdjjlkkjeiwhj w jtixtbdh kjeiwjzdhdmxbittgkbodxv mjme whj eimj This is what normally prints though xvkÈ bkikhxlrÈ wggbtfkjÈ wiylekgbdhxÈ wjjmÈ hkoÈ wigbtubxtÈ xvkÈ iwhjÈ uedjkmÈ glctbÈ gvrmdiwhjÈ iebbdielmeggtbxÈ ctbÈ xvtmkÈ gbtubxvkÈ wjjdxdthgbtubodllÈ khvxvkÈ imkbfdikÈ xtÈ xvkÈ bkudthÈ whjÈ gbtfdjkÈ hkoÈ tgxdthmÈ whjÈ tggtbxehdxdkmÈ ctbÈ mxejkhxmibdzdhtlturÈ whjÈ pemxdikÈ mxejdkmÈ mxdhÈ cokÈ wbkÈ wlmtÈ gbkgctbÈ ctebÈ hkoÈ zdhÈ cgvrmdikjeiwhjÈ qdhkmdtlturzzkjdydtivkzdmxbrwÈ zdhÈ zdjjlkkjeiwhjÈ wÈ jtixtbdhÈ kjeiwjzdhdmxbittgkbodxvÈ mjmeÈ whjÈ eimj or some variation of an odd character at the end of each word This is what the cryptogram array is filled with by the way wyijkcuvdpqlzhtgabmxefonrs

    Read the article

  • Passing Variable in load

    - by Tyler
    I have a load action tied to the submit button of a form. jQuery('#content').load("/control/ajxdata/installs.php?country=" + country); jQuery('#content').load("/control/ajxdata/installs.php",{ 'country': country }); The name, and the id of the form element I am trying to utilize is "country" In the error console, I am getting "Error: country is not defined"

    Read the article

  • Can I Move a MediaWiki site to a new virtual folder?

    - by Tyler
    I had MediaWiki installed in as the default site on my server using IIS 6 and I created a virtual directory and pointed it to the Wiki folder. The page loads, but all the links are pointing to the original location that is no longer pointing to the Wiki Folder. Info Server Name: tech Path to Wiki: http://tech/wiki/ Example Links Wrong Link - This is the current link displayed http://tech/index.php?title=Main_Page The link should look like this http://tech/wiki/index.php?title=Main_Page All of the links are not showing the /wiki Any ideas?

    Read the article

  • "Streaming" MJPG using python.

    - by tyler
    I have a webcam that I want to do some image processing on using Python. It's coming through as a Motion-JPEG. I want to try to process the stuff "live," but really what I want to do is this: Open the URL, start data streaming to some buffer... Read x bytes (where x is image size) to an image Process that image Display in result panel Return to number 2 The problem is that, while I do have the resolution, I have no idea how many bytes to read. I've tried googling the M-JPEG specification but can't find anything on if the images are separated by some header or what. Anybody have any ideas?

    Read the article

  • Arrays of different types

    - by Tyler
    Hi - Is it possible to have an array that contains two different types of data? I want to have an array that contains a double and also a string. I attempted: ArrayList<double><String> array; But that didn't work. Sorry for the silly question, but it has been a while since I have used something like this.. Can you refresh my memory on how would I declare and populate such an array? And then to take it a step further, I would like to sort the array by the double if possible? Thanks!

    Read the article

  • postgresql is incrementing an update by 2 ?

    - by John Tyler
    I'm migrating our model to postgresql for the FTS and data integrity update myschema.counters set counter_count= (counter_count+1) where counter_id =? Works as expected in mysql, however in postgres it is incrementing by 2 each time? It is simple int field I believe, I don't have anything special going on.

    Read the article

  • Can a Site get a Virus from using Curl?

    - by Mark Tyler
    I have a script which uses simple php curl requests to get the contents from rss/atom feeds.... now my question is it possible that by using curl, is there a chance i might get a virus? Let's say I do a php curl request to a rss feed in feedburner (I know this site does not contain any viruses, but this is only an example) and let's say this site has a malicious virus of some kind. Is there a chance that I might inherit that virus too? If yes, what precautions can I do to make sure something like that never happens. This is the php code I am currently using to fetch the RSS $headers [] = 'Connection: Keep-Alive'; $headers [] = 'Content-type: application/x-www-form-urlencoded; charset=utf-8'; $headers [] = 'Accept-Encoding: application/xhtml+xml,application/xml,text/xml,text/html;q=0.9,*/*;q=0.8'; $ch = curl_init($url); //curl_setopt($ch, CURLOPT_USERAGENT,'Phenoix/0.1.3 (Feed Parser Beta; Beta ; Allow like Gecko) Build/20111112'); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1'); //curl_setopt($ch, CURLOPT_REFERER, "http://google.com/auto/clogger"); //curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate' ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers ); //curl_setopt($channel, CURLOPT_HEADER, 0); curl_setopt($ch, CURLINFO_HEADER_OUT, 1); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_FAILONERROR, 1); //allow cookie $cookie_file = "cookie1.txt"; curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); $xml = curl_exec($ch); if(curl_error($ch)){ //$text .= "Error while updating. Please try again later"; return array(0, curl_error($ch)); } $info = curl_getinfo($ch); curl_close($ch);

    Read the article

  • declaring a 2D array of pointer objects

    - by Tyler Stennette
    I'm having a tough time figuring out how to instantiate a 2D array of pointer objects. Here is how I'm doing it: Pieces* chessBoard[9][9]; When I want to set it to an actual object pointer, I'm doing the following: chessBoard[1][1] = new Rook(p1Rook); Rook is a class that inherits attributes from the Pieces class and p1Rook is a char variable set to 'R'. This class also implements virtual functions (not pure virtual) from Pieces such as move() or getPiece() that are unique to the particular chess piece. However, when I compile my program, I get the following error: ChessBoard.cpp:69: error: expected type-specifier before ‘Rook’ ChessBoard.cpp:69: error: cannot convert ‘int*’ to ‘Pieces*’ in assignment Can someone please explain what I should change to get rid of this rather annoying persistent error? I would appreciate it.

    Read the article

  • How can I solve this NHibernate Querying in an n-tier architecture?

    - by Tyler Wright
    I've hit a wall with trying to decouple NHibernate from my services layer. My architecture looks like this: web - services - repositories - nhibernate - db I want to be able to spawn nhibernate queries from my services layer and possibly my web layer without those layers knowing what orm they are dealing with. Currently, I have a find method on all of my repositories that takes in IList<object[]> criteria. This allows me to pass in a list of criteria such as new object() {"Username", usernameVariable}; from anywhere in my architecture. NHibernate takes this in and creates a new Criteria object and adds in the passed in criteria. This works fine for basic searches from my service layer, but I would like to have the ability to pass in a query object that my repository translates into an NHibernate Criteria. Really, I would love to implement something like what is described in this question: Is there value in abstracting nhibernate criterion. I'm just not finding any good resources on how to implement something like this. Is the method described in that question a good approach? If so, could anyone provide some pointers on how to implement such a solution?

    Read the article

  • Passing a 2D array to a function in C

    - by Tyler Treat
    I have, essentially, a matrix of data (lets say ints) that I would like to store in a 2D array in which the dimensions are not known until runtime (say x columns and y rows). I want to populate the array in a function, so I assume I need to do something like this: int main(int argc, char **argv) { int y = atoi(argv[1]); int x = atoi(argv[2]); int **matrix = malloc(x * sizeof(int*)); populateMatrix(matrix, y, x); return 0; } void populateMatrix(**matrix, int y, int x) { int i, j; for (i = 0; i < y; i++) { for (j = 0; j < x; j++) { matrix[i][j] = i * j; // populated with trivial data to keep it simple } } } Obviously this doesn't work, but I'm not sure how to do what I'm describing exactly.

    Read the article

  • Object responsibilities - list and item

    - by Mark Tyler
    My question is more like a theoretical. Say you have an object, that represents the list of something (articles, pages, accounts etc.) class ObjCollection You have a class, that represents a specific item in collection: class objItem I have a problem thinking of a basic responsibilities of each object. Which class is responsible for creating a new objItem? Which class is responsible for deleting a objItem? Should it delete itself as a method?

    Read the article

  • ASP.Net 4.0 Database Created Pages

    - by Tyler
    I want to create asp.net 4.0 dynamic pages loaded from my MS SQL server. Basically, its a list of locations with informations. For example: Location1 would have the page www.site.com/location/location1.aspx Location44 would have the page www.site.com/location/location44.aspx I dont even know where to start with this, url writting maybe?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9  | Next Page >