Daily Archives

Articles indexed Monday July 1 2013

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

  • Reason why a Brand new website is ranking for a top keyword? [on hold]

    - by Prasad EBK
    Its been noticed, one of our (new)competitor website is ranking 5 for a top keyword with high competition. The website is barely 2 months old. When I checked not much SEO is done on the website other than basic title/desc tags. No backlinks. The website pushed down our website and took its place for the keyword. The only reason that came to my mind is the latest penguin update. Or is the ranking just temporary???, will it eventually be pushed back?? its been holding on for atleast one month and its irritating. Thanks in advance.

    Read the article

  • Getting a lot of '/_' errors from webmaster tools

    - by Vermino
    I'm using a WordPress site and I thought I got all the kinks out of it. For some reason Webmaster Tools is crawling my website and showing a lot of 404 errors which are from /_ like additional pages that I've never created. I just can't figure out what is creating these for Google crawlers and then displaying a 404. My robots.txt is here. My sitemap (created by the Yoast plugin) is here. I have Yoast and Jetpack plugins installed. What could be causing these links to appear

    Read the article

  • Setting up VPS: How to configure name servers

    - by MeltingDog
    So I got a VPS set up (LAMP) and have transfered a couple of sites over. Now I want to point my domain names from the old host to the new VPS host, which does not have any name servers yet. On my registrars console I have set the domain name 'www.mydomain.com' domain host settings to point to my VPS's ip address, eg: ns1.mydomain.com = 111.222.3.4 and ns2.mydomain.com = 111.222.3.4 I then lowered the TTL to one hour. I then switched the Nameservers on that domain to these new ones. (ns1/2.mydomain.com) In WHM I then set the servers name servers to ns1.mydomain.com and ns2.mydomain.com. I waited an hour to test...but nothing changed - the domain name still directed to the old host. Have I missed something? Is the some other record I need to change on the DNS? I find this very confusing, does anyone know a resource or can provide a step by step guide on how to configure a new servers nameservers? Thanks EDIT: added image (sorry bout the censoring. Client insists) On my regisrars console: And on my VPS' WHM:

    Read the article

  • Forwarding a subdomain to main domain using Godaddy

    - by Ryan Hayes
    I have current blog, which was hosted on Tumblr at http://blog.ryanhayes.net. I'm moving it over to http://ryanhayes.net, and have all the 301 redirects set up for the blog entries to map to my new blog, which is hosted using Godaddy (domain included). When I try to set up a subdomain forward, I'm greeted with a nice 403 Forbidden response (as of this writing, you can see it at http://blog.ryanhayes.net. When I try to ping both the subdomain and domain, they point to the same IP address, so I know blog subdomain has at least switched over to point to the same content. I don't really understand why I would get a 403 Forbidden on the same content that I can see perfectly fine via another domain. Currently, I have a CNAME of blog pointing to @, which is how "www" is set up to forward, so I'm assuming it would do the same thing. My question is what is the proper way to set up my DNS to make the blog subdomain forward to my main domain (301) using the GoDaddy DNS manager? Bonus: What is the background on why I am getting a 403 error the current way? Forbidden You don't have permission to access / on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. UPDATE 12/7/2010 Error on site has been fixed, you can no longer view it from my site.

    Read the article

  • Multiplayer in a game. How to design it object wise?

    - by Ninetou
    I was suggested on StackOverflow to ask this question here. I'm working on a simple game and I was thinking of adding multiplayer feature but I'm a bit stuck. I'm not sure what approach should I take, keeping in mind good programming practices. I have a Player object which is created for each player but then I have many other classes that would have to be able to access them. The thing is, if I initialise them in, let's say my main method, then I can't relate to different instances of player class from other classes. The only solution to my problem that comes to my mind is using some form of global objects but afaik using anything globally in apps is usually not a good practice. Any suggestions/ideas?

    Read the article

  • When I shoot from a gun while walking, the bullet is off the center, but when stand still it's fine

    - by Vlad1k
    I am making a small project in Unity, and whenever I walk with the gun and shoot at the same time, the bullets seem to curve and shoot off 2-3 CMs from the center. When I stand still this doesn't happen. This is my main Javascript code: @script RequireComponent(AudioSource) var projectile : Rigidbody; var speed = 500; var ammo = 30; var fireRate = 0.1; private var nextFire = 0.0; function Update() { if(Input.GetButton ("Fire1") && Time.time > nextFire) { if(ammo != 0) { nextFire = Time.time + fireRate; var clone = Instantiate(projectile, transform.position, transform.root.rotation); clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed)); ammo = ammo - 1; audio.Play(); } else { } } } I assume that these two lines need to be tweaked: var clone = Instantiate(projectile, transform.position, transform.root.rotation); clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed)); Thanks in advanced, and please remember that I just started Unity, and I might have a difficult time understanding some things. Thanks!

    Read the article

  • Implementing Scrolling Background in LibGDX game

    - by Vishal Kumar
    I am making a game in LibGDX. After working for whole a day..I could not come out with a solution on Scrolling background. My Screen width n height is 960 x 540. I have a png image of 1024 x 540. I want to scroll the background in such a way that it contuosly goes back with camera x-- as per camera I tried many alternatives... drawing the image twice ..did a lot of calculations and many others.... but finally end up with this dirty code if(bg_x2 >= - Assets.bg.getRegionWidth()) { //calculated it to position bg .. camera was initially at 15 bg_x2 = (16 -4*camera.position.x); bg_x1=bg_x2+Assets.bg.getRegionWidth(); } else{ bg_x1 = (16 -4*camera.position.x)%224; // this 16 is not proper //I think there can be other ways bg_x2=bg_x1+Assets.bg.getRegionWidth(); } //drawing twice batch.draw(Assets.bg, bg_x2, bg_y); batch.draw(Assets.bg, bg_x1, bg_y); The Simple idea is SCROLLING BACKGROUND WITH SIZE SOMEWHAT MORE THAN SCREEN SIZE SO THAT IT LOOK SMOOTH. Even after a lot of search, i didn't find an online solution. Please help.

    Read the article

  • Memory is full with vertex buffer

    - by Christian Frantz
    I'm having a pretty strange problem that I didn't think I'd run into. I was able to store a 50x50 grid in one vertex buffer finally, in hopes of better performance. Before I had each cube have an individual vertex buffer and with 4 50x50 grids, this slowed down my game tremendously. But it still ran. With 4 50x50 grids with my new code, that's only 4 vertex buffers. With the 4 vertex buffers, I get a memory error. When I load the game with 1 grid, it takes forever to load and with my previous version, it started up right away. So I don't know if I'm storing chunks wrong or what but it stumped me -.- for (int x = 0; x < 50; x++) { for (int z = 0; z < 50; z++) { for (int y = 0; y <= map[x, z]; y++) { SetUpVertices(); SetUpIndices(); cubes.Add(new Cube(device, new Vector3(x, map[x, z] - y, z), grass)); } } } vertexBuffer = new VertexBuffer(device, typeof(VertexPositionTexture), vertices.Count(), BufferUsage.WriteOnly); vertexBuffer.SetData<VertexPositionTexture>(vertices.ToArray()); indexBuffer = new IndexBuffer(device, typeof(short), indices.Count(), BufferUsage.WriteOnly); indexBuffer.SetData(indices.ToArray()); Thats how theyre stored. The array I'm reading from is a byte array which defines the coordinates of my map. Now with my old version, I used the same loading from an array so that hasn't changed. The only difference is the one vertex buffer instead of 2500 for a 50x50 grid. cubes is just a normal list that holds all my cubes for the vertex buffer. Another thing that just came to mind would be my draw calls. If I'm setting an effect for each cube in my cube list, that's probably going to take a lot of memory. How can I avoid doing this? I need the foreach method to set my cubes to the right position foreach (Cube block in cube.cubes) { effect.VertexColorEnabled = false; effect.TextureEnabled = true; Matrix center = Matrix.CreateTranslation(new Vector3(-0.5f, -0.5f, -0.5f)); Matrix scale = Matrix.CreateScale(1f); Matrix translate = Matrix.CreateTranslation(block.cubePosition); effect.World = center * scale * translate; effect.View = cam.view; effect.Projection = cam.proj; effect.FogEnabled = false; effect.FogColor = Color.CornflowerBlue.ToVector3(); effect.FogStart = 1.0f; effect.FogEnd = 50.0f; cube.Draw(effect); noc++; }

    Read the article

  • Python 3.3 Webserver restarting problems

    - by IPDGino
    I have made a simple webserver in python, and had some problems with it before as described here: Python (3.3) Webserver script with an interesting error In that question, the answer was to use a While True: loop so that any crashes or errors would be resolved instantly, because it would just start itself again. I've used this for a while, and still want to make the server restart itself every few minutes, but on Linux for some reason it won't work for me. On windows the code below works fine, but on linux it keeps saying Handler class up here ... ... class Server: def __init__(self): self.server_class = HTTPServer self.server_adress = ('MY IP GOES HERE, or localhost', 8080) global httpd httpd = self.server_class(self.server_adress, Handler) self.main() def main(self): if count > 1: global SERVER_UP_SINCE HOUR_CHECK = int(((count - 1) * RESTART_INTERVAL) / 60) SERVER_UPTIME = str(HOUR_CHECK) + " MINUTES" if HOUR_CHECK > 60: minutes = int(HOUR_CHECK % 60) hours = int(HOUR_CHECK // 60) SERVER_UPTIME = ("%s HOURS, %s MINUTES" % (str(hours), str(minutes))) SERVING_ON_ADDR = self.server_adress SERVER_UP_SINCE = str(SERVER_UP_SINCE) SERVER_RESTART_NUMBER = count - 1 print(""" SERVER INFO ------------------------------------- SERVER_UPTIME: %s SERVER_UP_SINCE: %s TOTAL_FILES_SERVED: %d SERVING_ON_ADDR: %s SERVER_RESTART_NUMBER: %s \n\nSERVER HAS RESTARTED """ % (SERVER_UPTIME, SERVER_UP_SINCE, TOTAL_FILES, SERVING_ON_ADDR, SERVER_RESTART_NUMBER)) else: print("SERVER_BOOT=1\nSERVER_ONLINE=TRUE\nRESTART_LOOP=TRUE\nSERVING_ON_ADDR:%s" % str(self.server_adress)) while True: try: httpd.serve_forever() except KeyboardInterrupt: print("Shutting down...") break httpd.shutdown() httpd.socket.close() raise(SystemExit) return def server_restart(): """If you want the restart timer to be longer, replace the number after the RESTART_INTERVAL variable""" global RESTART_INTERVAL RESTART_INTERVAL = 10 threading.Timer(RESTART_INTERVAL, server_restart).start() global count count = count + 1 instance = Server() if __name__ == "__main__": global SERVER_UP_SINCE SERVER_UP_SINCE = strftime("%d-%m-%Y %H:%M:%S", gmtime()) server_restart() Basically, I make a thread to restart it every 10 seconds (For testing purposes) and start the server. After ten seconds it will say File "/home/username/Desktop/Webserver/server.py", line 199, in __init__ httpd = self.server_class(self.server_adress, Handler) File "/usr/lib/python3.3/socketserver.py", line 430, in __init__ self.server_bind() File "/usr/lib/python3.3/http/server.py", line 135, in server_bind socketserver.TCPServer.server_bind(self) File "/usr/lib/python3.3/socketserver.py", line 441, in server_bind self.socket.bind(self.server_address) OSError: [Errno 98] Address already in use As you can see in the except KeyboardInterruption line, I tried everything to make the server stop, and the program stop, but it will NOT stop. But the thing I really want to know is how to make this server able to restart, without giving some wonky errors.

    Read the article

  • Issue with Multiple Text Fields and SharedObject Storing

    - by user1662660
    I'm currently working on an AIR for iOS application in Flash CS6. I'm trying to store multiple pieces of data from various text inputs; i.e "name_txt", "number_txt" etc. I have the following code working for a local save file; import flash.events.Event; import flash.desktop.NativeApplication; import flash.events.Event; var n1:String = so.data.Number1; var so:SharedObject = SharedObject.getLocal("TravelPal"); emerg1.text = n1; emerg1.addEventListener(Event.CHANGE, updateEmerg1); function updateEmerg1 (e:Event):void { so.data.Number1 = emerg1.text; so.flush(); } NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit); function onExit(e:Event):void { so.flush(); } Now as soon as I create multiple text inputs and attempt to store them in my SharedObject, the whole system just falls apart. None of the text gets saved, even the previously working ones. I'm pretty new to ShardObject usage. What am I missing here? Is this a good way to go about storing multiple text inputs?

    Read the article

  • EXCEL - Locking a Cell from User input whilst allowing a Linked combobox?

    - by Christopher Leach
    I have a Protected Worksheet which is a checklist with a series of checkpoints. Each row has Item and Description cells that are locked. Each row has several columns with its contents to be set by a ComboBox and a text input column. Both i have left unlocked. I have Locked the the Item and Description columns and left only the 'Select Unlocked Cells' checked via Sheet Protection. I have one ComboBox on the worksheet that moves around and adjusts its LinkedCell and its Content list using the worksheets SelectionChanged event. When the user selects a cell to bring up the drop down list, the user is able to type into the cell and the Drop Down Box disappears. What is the best way to keep the cell unlocked so it can be selectable(as 'Select Locked Cells" is unchecked) however stop the user from being able to type in the cell and to allow the cells contents to become modifiable only via the ComboBox?

    Read the article

  • Stretch column table in Primefaces

    - by Orange91
    How I can prevent to stretch table when I input long text: Screen: http://zapodaj.net/71821572f2445.jpg.html Meyby is it possible to make the text lines stretched row horizontally? My fragment example table: <p:dataTable id="table" styleClass="table" value="#{userMB.allInactive}" var="inactive" paginator="true" rows="15" rowKey="#{inactive.id}" selection="#{userMB.user}" selectionMode="single" > <f:facet name="header"> Lista kont nieaktywnych </f:facet> <p:column headerText="#{msg.firstName}"> <h:outputText value="#{inactive.firstName}" /> </p:column> I tried <p:column headerText="#{msg.firstName}" width="20px"> styleClass for column: <p:column styleClass="column" headerText="#{msg.firstName}" width="20px"> .column { width: 20px; } but I do not see any change, it does not work.

    Read the article

  • Change Label Control Property Based on Data from SqlDataSource Inside a Repeater

    - by Furqan Muhammad Khan
    I am using a repeater control to populate data from SqlDataSource into my custom designed display-box. <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnDataBinding="Repeater_ItemDataBound"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div class="bubble-content"> <div style="float: left;"> <h2 class="bubble-content-title"><%# Eval("CommentTitle") %></h2> </div> <div style="text-align: right;"> <asp:Label ID="lbl_category" runat="server" Text=""><%# Eval("CommentType") %> </asp:Label> </div> <div style="float: left;"> <p><%# Eval("CommentContent") %></p> </div> </div> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater> <asp:SqlDataSource ID="mySqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="SELECT [CommentTitle],[CommentType],[CommentContent] FROM [Comments] WHERE ([PostId] = @PostId)"> <SelectParameters> <asp:QueryStringParameter Name="PostId" QueryStringField="id" Type="String" /> </SelectParameters> </asp:SqlDataSource> Now, there can be three types of "CommentTypes" in the database. I want to change the CssClass property of "lbl_category" based on the value of [CommentType]. I tried doing this: <asp:Label ID="lbl_category" runat="server" CssClass="<%# Eval("CommentType") %>" Text=""><%# Eval("CommentType") %></asp:Label> But this gives an error: "The server control is not well formed" and haven't been able to find a way to achieve this in the code behind. Can someone please help?

    Read the article

  • How to sort an array by (smallest, largest, second smallest, second, largest) etc?

    - by Binka
    Any ideas? I can sort an array. But not in this pattern? It needs to sort by the pattern I mentioned above. public void wackySort2(int[] nums) { int sign = 0; int temp = 0; int temp2 = 0; for (int i = 0; i < nums.length; i++) { for (int j = 0; j < nums.length - 1; j++) { if (nums[j] > nums[j + 1]) { temp = nums[j]; nums[j] = nums[j + 1]; nums[j + 1] = temp; //sign = 1; System.out.println("Something has been done"); } } } }

    Read the article

  • Using jQuery find string A or B and replace based on css class and ID

    - by Jason
    Using jQuery, how do you check for and replace the occurrence of stringA or stringB when it falls under a specific css class and ID? stringA = " | " stringB = "|" css = .login #bav <p id="nav"> <a href="#">oh ya</a> | <a href="#" title="Password Lost and Found"></a> </p> I have variations of this: jQuery(document).ready(function($) { $(".login #nav").replaceText( /testA|testB/gi, "fooBar" ); }); });

    Read the article

  • How to use locks/synchronization here

    - by MasterGberry
    I have this code block here and i need to make sure the rankedPlayersWaitingForMatch is synchronized between threads properly. I was going to use synchronize but that i don't think will work here because of the variable being used in the if statement. I read online about final Lock lock = new ReentrantLock(); but I am a bit confused on how to use it in this case properly with the try/finally block. Can I get a quick example? Thanks // start synchronization if (rankedPlayersWaitingForMatch.get(rankedType).size() >= 2) { Player player1 = rankedPlayersWaitingForMatch.get(rankedType).remove(); Player player2 = rankedPlayersWaitingForMatch.get(rankedType).remove(); // end synchronization // ... I don't want this all to be synchronized, just after the first 2 remove() } else { // end synchronization // ... }

    Read the article

  • How to pass a member function to a function used in another member function?

    - by Tommaso Ferrari
    I found something about my problem, but I don't already understand very well. I need to do something like this: class T{ double a; public: double b; void setT(double par){ a=par; }; double funct(double par1) { return par1/a; } void exec(){ b=extfunct(funct, 10); } } double extfunct(double (*f)(double),double par2){ return f(par2)+5; } Operation and function are only for example, but the structure is that. The reason of this structure is that I have a precostituited class which finds the minimum of a gived function (it's extfunct in the example). So I have to use it on a function member of a class. I understood the difference between pointer to function and pointer to member function, but I don't understand how to write it. Thanks, and sorry for the poor explanation of the problem.

    Read the article

  • Extract string that is delimited with constant and ends with two numbers (numbers have to be included)

    - by Edmon
    I have a text that contains string of a following structure: text I do not care about, persons name followed by two IDs. I know that: a person's name is always preceded by XYZ code and that is always followed by two, space separated numbers. Name is not always just a last name and first name. It can be multiple last or first names (think Latin american names). So, I am looking to extract string that follows the constant XYZ code and that is always terminated by two separate numbers. You can say that my delimiter is XYZ and two numbers, but numbers need to be part of the extracted value as well. From blah, blah XYZ names, names 122322 344322 blah blah I want to extract: names, names 122322 344322 Would someone please advise on the regular expression for this that would work with Python's re package.

    Read the article

  • Merge two excel files (with the condition)

    - by chennai
    I have a form in access in which i have two text boxes which accepts two excel files with a button click. now when i click generate button an output excel file has to be generated or created based on the following conditions In one excel file i have these data : id code country count t100 gb123 india 3123 t100 gh125 UK 1258 t123 ytr15 USA 1111 t123 gb123 Germany 100 t145 gh575 india 99 t458 yt777 USA 90 In another excel file i have these data country location India delhi UK london USA wallstreet Germany frankfurt The rows can be more than what i mentioned here ... now i want to merge them according to the country. In book1 excel file for example wherever you find country india the location field delhi has to be inserted right beside the country field and it has to be done for each and every country which i mentioned in book2 excel file and the output file has to be sorted according to the count at last. For example the output file should like this id code country count Location t100 gb123 india 3123 delhi t100 gh125 UK 1258 london t123 ytr15 USA 1111 wallstreet t123 gb123 Germany 100 frankfrt t145 gh575 india 99 delhi t458 yt777 USA 90 wallstreet

    Read the article

  • Modifying the Google Drive menu interface

    - by Dangerbunny
    So I'm working on a web-app for the Google Marketplace that's going to involve integration with Google Drive. Part of what I want to be able to do with the app involves something along the lines of adding a menu option to the Drive menu interface. For instance, you could be editing a document in drive and browse to File-"My new fancy option." Does anyone know if this is possible? Or if it is not, is there another way of adding this sort of custom action functionality where you are able to perform non Drive standard actions on files from within the Drive interface?

    Read the article

  • AlarmManager Calling Function in Same Class

    - by jsc123
    I am trying to give a LocationClient a two-minute period to connect before calling getLastLocation on it. Initially I implemented this with a Timer (and TimerTask), but because Timers do not work in sleepmode, I would like to translate it to an AlarmManager. However, I am a bit confused as to how to do this, considering an AlarmManager calls another class, whereas I want to remain in the same class and simply delay for a two-minute period. This is how it looks with a Timer. Timer theTimer = new Timer(); theTimer.schedule(new TimerTask() { @Override public void run() { if(checkIfGooglePlay() && checkTime()) { getPostLocation(); stopSelf(); mLocationClient.disconnect(); } } }, TWO_MINUTES);

    Read the article

  • MySQL Rank Not Matching High Score in Table

    - by boddie
    While making a game the MySQL call to get the top 10 is as follows: SELECT username, score FROM userinfo ORDER BY score DESC LIMIT 10 This seems to work decently enough, but when paired with a call to get a individual player's rank the numbers may be different if the player has a tied score with other players. The call to get the players rank is as follows: SELECT (SELECT COUNT(*) FROM userinfo ui WHERE (ui.score, ui.username) >= (uo.score, uo.username)) AS rank FROM userinfo uo WHERE username='boddie'; Example results from first call: +------------+-------+ | username | score | +------------+-------+ | admin | 4878 | | test3 | 3456 | | char | 785 | | test2 | 456 | | test1 | 253 | | test4 | 78 | | test7 | 0 | | boddie | 0 | | Lz | 0 | | char1 | 0 | +------------+-------+ Example results from second call +------+ | rank | +------+ | 10 | +------+ As can be seen, the first call ranks the player at number 8 on the list, but the second call puts him at number 10. What changes or what can I do to make these calls give matching results? Thank you in advance for any help!

    Read the article

  • Binding a date string parameter in an MS Access PDO query

    - by harryg
    I've made a PDO database class which I use to run queries on an MS Access database. When querying using a date condition, as is common in SQL, dates are passed as a string. Access usually expects the date to be surrounded in hashes however. E.g. SELECT transactions.amount FROM transactions WHERE transactions.date = #2013-05-25#; If I where to run this query using PDO I might do the following. //instatiate pdo connection etc... resulting in a $db object $stmt = $db->prepare('SELECT transactions.amount FROM transactions WHERE transactions.date = #:mydate#;'); //prepare the query $stmt->bindValue('mydate', '2013-05-25', PDO::PARAM_STR); //bind the date as a string $stmt->execute(); //run it $result = $stmt->fetch(); //get the results As far as my understanding goes the statement that results from the above would look like this as binding a string results in it being surrounded by quotes: SELECT transactions.amount FROM transactions WHERE transactions.date = #'2013-05-25'#; This causes an error and prevents the statement from running. What's the best way to bind a date string in PDO without causing this error? I'm currently resorting to sprintf-ing the string which I'm sure is bad practise. Edit: if I pass the hash-surrounded date then I still get the error as below: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[22018]: Invalid character value for cast specification: -3030 [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. (SQLExecute[-3030] at ext\pdo_odbc\odbc_stmt.c:254)' in C:\xampp\htdocs\ips\php\classes.php:49 Stack trace: #0 C:\xampp\htdocs\ips\php\classes.php(49): PDOStatement-execute() #1 C:\xampp\htdocs\ips\php\classes.php(52): database-execute() #2 C:\xampp\htdocs\ips\try2.php(12): database-resultset() #3 {main} thrown in C:\xampp\htdocs\ips\php\classes.php on line 49

    Read the article

  • Noob - Cycle through stored names and skip blanks

    - by ActiveJimBob
    NOOB trying to make my code more efficient. On scroll button push, the function 'SetName' stores a number to integer 'iName' which is index against 5 names stored in memory. If a name is not set in memeory, it skips to the next. The code works, but takes up a lot of room. Any advice appreciated. Code: #include <string.h> int iName = 0; int iNewName = 0; BYTE GetName () { return iName; } void SetName (int iNewName) { while (iName != iNewName) { switch (byNewName) { case 1: if (strlen (memory.m_nameA) == 0) new_name++; else iName = iNewName; break; case 2: if (strlen (memory.m_nameB) == 0) new_name++; else iName = iNewName; break; case 3: if (strlen (memory.m_nameC) == 0) new_name++; else iName = iNewName; break; case 4: if (strlen (memory.m_nameD) == 0) new_name++; else iName = iNewName; break; case 5: if (strlen (memory.m_nameE) == 0) new_name++; else iName = iNewName; break; default: iNewName = 1; break; } // end of case } // end of loop } // end of SetName function void main () { while(1) { if (Button_pushed) SetName(GetName+1); } // end of infinite loop } // end of main

    Read the article

  • Fast response on first Socket I/O request but slow every other time when communicating with remote serial port

    - by GreenGodot
    I'm using sockets to pass Serial commands to a remote device. And the response to that request is sent back and printed out. However, I am having a problem in that the first time it is instant but the rest of the time it can take up to 20 seconds to receive a reply. I think the problem is with my attempt at threading but I am not entirely sure. new Thread() { @Override public void run() { System.out.println("opened"); try { isSocketRetrieving.setText("Opening Socket"); socket = new Socket(getAddress(), getRemotePort())); DataOutput = new DataOutputStream(socket .getOutputStream()); inFromServer = new BufferedReader( new InputStreamReader(socket .getInputStream())); String line = ""; isSocketRetrieving.setText("Reading Stream......"); while ((line = inFromServer.readLine()) != null) { System.out.println(line); if (line.contains(getHandshakeRequest())) { DataOutput.write((getHandshakeResponse()toString() + "\r").getBytes()); DataOutput.flush(); DataOutput .write((getCommand().toString() + "\r").getBytes()); DataOutput.flush(); int pause = (line.length()*8*1000)/getBaud(); sleep(pause); } else if (line.contains(readingObject .getExpected())) { System.out.println(line); textArea.append("value = " + line + "\n"); textAreaScroll.revalidate(); System.out.println("Got Value"); break; } } System.out.println("Ended"); try { inFromServer.close(); DataOutput.close(); socket.close(); isSocketRetrieving.setText("Socket is inactive..."); rs232Table.addMouseListener(listener); interrupt(); join(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { System.out.println("Thread exited"); } } catch (NumberFormatException e1) { e1.printStackTrace(); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }.start();

    Read the article

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