Daily Archives

Articles indexed Wednesday December 22 2010

Page 1/32 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Cluster Shared Volumes Mount Point

    - by Ryan H
    I am using Cluster Shared Volumes on Windows Server 2008 R2 with Hyper-V. The different volumes available have different sizes, and are physically located on different disks on the SAN. These volumes defaulted to labels such as C:\ClusterStorage\Volume1. I know that it is not possible / recommended to change where the CSV mount points are (C:\ClusterStorage), but I want to change the rest of the path to be a more useful name than "Volume1". In the Failover Cluster Manager, under Cluster Shared Volumes, I can see these CSVs, and they are working just fine. When I go into their properties, I can see a list, which has the mount point listed, but the entries are not modifiable. How can I change the mount point of a Cluster Shared Volume in Windows Server 2008 R2?

    Read the article

  • Server Configuration / Important Parameter for 500Req/Second

    - by Sparsh Gupta
    I am configuring a server to be used as nginx server for a very heavy traffic website. It is expected to receive traffic from a large number of IP addresses simultaneously. It is expected to get 500Req/Second with atleast 20Million unique IPs connecting it. One of the problems I noticed in my previos server was related to iptables / ipconntrack. I am not aware of this behaviour and would be glad to know which all parameters of a ubuntu / debian (32/64) bit machine should I tweek to get maximum performance from the server. I can put in a lot of RAM on the server but mission critical task is the response times. We ideally dont want any connection to be hanging / timing out / waiting and want as low as possible overall response times. P.S. We are also looking for a kick ass freelancer system admin who can help us figuring / setting this all up. Reach me incase you have some spare time and interested in working on some very heavy traffic website servers.

    Read the article

  • Forward differing hostnames to different internal IPs through NAT router

    - by abrereton
    Hi, I have one public IP address, one router and multiple servers behind the router. I would like to forward differing domains (All using HTTP) through the router to different servers. For example: example1.com => 192.168.0.110 example2.com => 192.168.0.120 foo.example2.com => 192.168.0.130 bar.example2.com => 192.168.0.140 I understand that this could be accomplished using Port Forwarding, but I need all hosts running on port 80. I found some information about IP Masquerading, but I found this difficult to understand, and I am not sure if it is what I am after. Another solution I have found is to direct all traffic to Reverse Proxy server, which forwards the requests onto the appropriate server. What about iptables? I am using a Billion 7404 VNPX router. Is there a feature that this router has that can accomplish this? Are these my only options? Have I missed something completely? Is one recommended over the others? I have searched around but I don't think I am hitting the correct keywords. Thanks in advance.

    Read the article

  • Running Excel 2007 as admin on Win7 causes “There was a problem sending the command to the program”

    - by Flack
    I am running Excel 2007 on Windows 7 64bit. I need to run Excel as administrator so I have the "Run as Administrator" box in the Excel shortcut checked. Now, when I try to open an Excel file by double clicking, I get the following error: There was a problem sending the command to the program Excel opens fine after that, and I can open the file fine through Excel's File/Open menu. Why can't I open the file by double clicking? Some sites suggest changing a specific Excel option. I tried while checking/unchecking Excel's "Ignore other applications that use Dynamic Data Exchange (DDE)" but that didn't help. The issue goes away if I uncheck "Run as Administrator" but I want to be able to leave that checked. Any ideas?

    Read the article

  • Home network with Windows 7 as router

    - by Michael
    Background: I have tried to use routers, but so far all of them can't handle the bandwidth, number of connections eventually limited by the hardware resources, so overall the home routers are decreasing the internet speed. I went through DD-WRT and stuff like that. Question: What I want is to use my Windows7 PC as router. It has 2 LAN cards. I'm going to connect to this router another desktop 2 pcs and notebook through wireless router. The main question is what is the most efficient way to turn this Windows7 box(and I need Windows for native NTFS support) into router with NAT/Routing/Firewall functionality? Is there any routing software recommended for this purpose or I should just use windows native "Internet Sharing"? I'm going to run SIP phones in the LAN, so I need friendly NAT(Full cone perhaps). Also I'm going to have FTP server on that Windows7 "server" PC. As firewall I'm thinking about Comodo. Need to drop all incoming, unless explicitly allowed.

    Read the article

  • Disabling mouse acceleration in Mac OS X

    - by aib
    I've been looking for a solution to the unusable mouse problem in Mac OS X for ages. I've tried a gazillion programs and fiddled with every setting there is or there can be added. So far, I haven't found a way to get linear mouse response in Mac OS X. At this point I'm seriously considering installing another operating system. But before I do that, or go hacking around OS binaries, maybe someone here has a solution? I want linear mouse response. I want high sensitivity. I like my touchpad acceleration and would like to keep it if possible. Any ideas? P.S. I've been at this for a long time, I'll probably have already tried the most popular answers. I'm running Mac OS X 10.6.5 on a MacBook Pro. I don't use a particular brand of mouse. I'm not looking for any commercial solutions. I've tried: Mouse Acceleration Preferences Pane, the Snow Leopard version of which can get me close to a linear response, but at the cost of tracking speed (sensitivity). Answers on this question: Make Mac OS X mouse acceleration more Windows-like About every code snippet I found via Google.

    Read the article

  • Mounting a TrueCrypt volume over FTP

    - by Maxim Zaslavsky
    Is it possible to mount a TrueCrypt volume file over FTP? Here's how TrueCrypt works with a local file: User inputs path to volume file, enters password TrueCrypt verifies that the password is correct (probably by decrypting the very first part of the volume file?) TrueCrypt reads the directory listing from the volume file and mounts the volume. However, in this step, TrueCrypt does NOT process the whole volume file. The user browses the directory listing and opens a file. TrueCrypt reads only the part of the volume file that contains the file the user wants, and then decrypts it. Once again, TrueCrypt doesn't process the whole volume file - it only reads part of it. The user edits part of the file and saves it. TrueCrypt encrypts the change and edits the volume file. I'm pretty sure it should be possible to mount a volume over FTP, without undermining security and without having to transfer the whole volume file just to read one small part of the volume. Here's how I imagine it: User inputs FTP path to volume file, enters FTP login information, enters password to volume TrueCrypt downloads the very first part of the volume file and verifies that the password is correct TrueCrypt downloads the part of the volume file that contains the directory listing - the data is sent encrypted over FTP and is decrypted locally. The user browses the directory listing and opens a file. TrueCrypt downloads only the part of the volume file that contains the file the user wants, and then decrypts it locally. The user edits part of the file and saves it. TrueCrypt encrypts the change and edits the volume file over FTP, transferring encrypted data only. Is such a feature available?

    Read the article

  • wvMaxima Error: "Not Connected To Maxima" on Windows

    - by muntoo
    Maxima gives an error "Not Connected To Maxima" whenever I try to do anything with it. I've looked around, but I couldn't figure out how to fix this on Windows. The only results I got were for Fedora. According to them, I think this may have something to do with the Firewall, but I can't figure out what. I even tried adding wvMaxima to the Windows Firewall exceptions list, but the same error comes up.

    Read the article

  • Javascript: how to document.print option value in Select block?

    - by HH
    The below returns [object HTMLOptionElement] while I try to return the value. document.write(document.getElementById("allSelect").options[0]).value; by value, I mean the thing called value there (there is a form around it but not relevant now): <select name="allSelect" id="allSelect" size=3> <option value="1"selected">1</option> <option value="2">2</option> <option value="3">3</option> </select> How can I return the value of an option?

    Read the article

  • How do uppercase and lowercase letters differ by only one bit?

    - by Vibhakar SInha
    I have found one example in Data and Communication Networking book written by Behrouza Forouzan regarding upper- and lowercase letters which differ by only one bit in the 7 bit code. For example, character A is 1000001 (0x41) and character a is 1100001 (0x61).The difference is in bit 6, which is 0 in uppercase letters and 1 in lowercase letters. If we know the code for one case, we can easily find the code for the other by adding or subtracting 32 in decimal, or we can just flip the sixth bit. What does all this mean? I have found myself very confused with all these things. Could someone provide examples of how these things really work out?

    Read the article

  • What are best practices for collecting, maintaining and ensuring accuracy of a huge data set?

    - by Kyle West
    I am posing this question looking for practical advice on how to design a system. Sites like amazon.com and pandora have and maintain huge data sets to run their core business. For example, amazon (and every other major e-commerce site) has millions of products for sale, images of those products, pricing, specifications, etc. etc. etc. Ignoring the data coming in from 3rd party sellers and the user generated content all that "stuff" had to come from somewhere and is maintained by someone. It's also incredibly detailed and accurate. How? How do they do it? Is there just an army of data-entry clerks or have they devised systems to handle the grunt work? My company is in a similar situation. We maintain a huge (10-of-millions of records) catalog of automotive parts and the cars they fit. We've been at it for a while now and have come up with a number of programs and processes to keep our catalog growing and accurate; however, it seems like to grow the catalog to x items we need to grow the team to y. I need to figure some ways to increase the efficiency of the data team and hopefully I can learn from the work of others. Any suggestions are appreciated, more though would be links to content I could spend some serious time reading. THANKS! Kyle

    Read the article

  • How to Run a batch file in a Remote machine Using ANT??

    - by ragz
    I want to run a batch file in a remote machine using ANT. The purpose of this is it solves many tasks once it's done. Some of them are we can resart a server(Jboss,weblogic,Tomcat,etc) we can run an ant script in a remote machine ...and so on. With all those commands present in the batch file of a remote machine, this could be executed easily. Is there a way to achieve to achieve this, please and kindly if any one do know provide a reply with example code I hope the answer to this question perhaps useful for many people Thanks in advance StackOverflow

    Read the article

  • Java random values and duplicates

    - by f-Prime
    I have an array (cards) of 52 cards (13x4), and another array (cardsOut) of 25 cards (5x5). I want to copy elements from the 52 cards into the 25 card array by random. Also, I dont want any duplicates in the 5x5 array. So here's what I have: double row=Math.random() *13; double column=Math.random() *4; boolean[][] duplicates=new boolean[13][4]; pokerGame[][] cardsOut = new pokerGame[5][5]; for (int i=0;i<5;i++) for (int j=0;j<5;j++){ if(duplicates[(int)row][(int)column]==false){ cardsOut[i][j]=cards[(int)row][(int)column]; duplicates[(int)row][(int)column]=true; } } 2 problems in this code. First, the random values for row and column are only generated once, so the same value is copied into the 5x5 array every time. Since the same values are being copied every time, I'm not sure if my duplicate checker is very effective, or if it works at all. How do I fix this?

    Read the article

  • displaying images in a list box so the image resizes based on parent container

    - by MikeU
    I have an expander with a list box in it that displays image thumbnails. I want the images to be sized according to the size of the listbox and the list box to be sized based on the width of the expander. When I expand the expander I want the list box and the images to resize also. Does anyone know how I can accomplish this? <Expander Style="{DynamicResource ExpanderStyle}" Name="pictureExpander" IsExpanded="True" ExpandDirection="Left" Collapsed="pictureExpander_Collapsed" Expanded="pictureExpander_Expanded" Grid.Column="4"> <ListBox Name="photoList" ItemsSource="{Binding Source={StaticResource PhotoBin}}" IsSynchronizedWithCurrentItem="True" HorizontalAlignment="Stretch" ScrollViewer.CanContentScroll="False"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Yellow" /> </Style.Resources> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="BorderBrush" Value="Black"/> <Setter Property="BorderThickness" Value="5"/> </Trigger> </Style.Triggers> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemTemplate> <DataTemplate> <Image Source="{Binding FileLocation}" Margin="0,5" HorizontalAlignment="Stretch" MouseLeftButtonDown="DragImage" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Expander>

    Read the article

  • Show choosen option in a notification Feed, Django

    - by apoo
    Hey I have a model where : LIST_OPTIONS = ( ('cheap','cheap'), ('expensive','expensive'), ('normal', 'normal'), ) then I have assigned the LIST_OPTIONS to nature variable. nature = models.CharField(max_length=15, choices=LIST_OPTIONS, null=False, blank=False). then I save it: if self.pk: new=False else: new=True super(Listing, self).save(force_insert, force_update) if new and notification: notification.send(User.objects.all().exclude(id=self.owner.id), "listing_new", {'listing':self, }, ) then in my management.py: def create_notice_types(app, created_models,verbosity, **kwargs): notification.create_notice_type("listing_new", _("New Listing"), _("someone has posted a new listing"), default=2) and now in my notice.html I want to show to users different sentences based on the options that they have choose so something like this: LINK href="{{ listing.owner.get_absolute_url }} {{listing.owner}} {% ifequal listing.nature "For Sale" %} created a {{ listing.nature }} listing, <a href="{{ listing.get_absolute_url }}">{{listing.title}}</a>. {% ifequals listing.equal "Give Away"%} is {{ listing.nature }} , LINK href="{{ listing.get_absolute_url }}" {{listing.title}}. {% ifequal listing.equal "Looking For"%} is {{ listing.nature }} , LINK href="{{ listing.get_absolute_url }}" {{listing.title}} {% endifequal %} {% endifequal %} {% endifequal %} Could you please help me out with this. Thank you

    Read the article

  • Implementing an async "read all currently available data from stream" operation

    - by Jon
    I recently provided an answer to this question: C# - Realtime console output redirection. As often happens, explaining stuff (here "stuff" was how I tackled a similar problem) leads you to greater understanding and/or, as is the case here, "oops" moments. I realized that my solution, as implemented, has a bug. The bug has little practical importance, but it has an extremely large importance to me as a developer: I can't rest easy knowing that my code has the potential to blow up. Squashing the bug is the purpose of this question. I apologize for the long intro, so let's get dirty. I wanted to build a class that allows me to receive input from a console's standard output Stream. Console output streams are of type FileStream; the implementation can cast to that, if needed. There is also an associated StreamReader already present to leverage. There is only one thing I need to implement in this class to achieve my desired functionality: an async "read all the data available this moment" operation. Reading to the end of the stream is not viable because the stream will not end unless the process closes the console output handle, and it will not do that because it is interactive and expecting input before continuing. I will be using that hypothetical async operation to implement event-based notification, which will be more convenient for my callers. The public interface of the class is this: public class ConsoleAutomator { public event EventHandler<ConsoleOutputReadEventArgs> StandardOutputRead; public void StartSendingEvents(); public void StopSendingEvents(); } StartSendingEvents and StopSendingEvents do what they advertise; for the purposes of this discussion, we can assume that events are always being sent without loss of generality. The class uses these two fields internally: protected readonly StringBuilder inputAccumulator = new StringBuilder(); protected readonly byte[] buffer = new byte[256]; The functionality of the class is implemented in the methods below. To get the ball rolling: public void StartSendingEvents(); { this.stopAutomation = false; this.BeginReadAsync(); } To read data out of the Stream without blocking, and also without requiring a carriage return char, BeginRead is called: protected void BeginReadAsync() { if (!this.stopAutomation) { this.StandardOutput.BaseStream.BeginRead( this.buffer, 0, this.buffer.Length, this.ReadHappened, null); } } The challenging part: BeginRead requires using a buffer. This means that when reading from the stream, it is possible that the bytes available to read ("incoming chunk") are larger than the buffer. Remember that the goal here is to read all of the chunk and call event subscribers exactly once for each chunk. To this end, if the buffer is full after EndRead, we don't send its contents to subscribers immediately but instead append them to a StringBuilder. The contents of the StringBuilder are only sent back whenever there is no more to read from the stream. private void ReadHappened(IAsyncResult asyncResult) { var bytesRead = this.StandardOutput.BaseStream.EndRead(asyncResult); if (bytesRead == 0) { this.OnAutomationStopped(); return; } var input = this.StandardOutput.CurrentEncoding.GetString( this.buffer, 0, bytesRead); this.inputAccumulator.Append(input); if (bytesRead < this.buffer.Length) { this.OnInputRead(); // only send back if we 're sure we got it all } this.BeginReadAsync(); // continue "looping" with BeginRead } After any read which is not enough to fill the buffer (in which case we know that there was no more data to be read during the last read operation), all accumulated data is sent to the subscribers: private void OnInputRead() { var handler = this.StandardOutputRead; if (handler == null) { return; } handler(this, new ConsoleOutputReadEventArgs(this.inputAccumulator.ToString())); this.inputAccumulator.Clear(); } (I know that as long as there are no subscribers the data gets accumulated forever. This is a deliberate decision). The good This scheme works almost perfectly: Async functionality without spawning any threads Very convenient to the calling code (just subscribe to an event) Never more than one event for each time data is available to be read Is almost agnostic to the buffer size The bad That last almost is a very big one. Consider what happens when there is an incoming chunk with length exactly equal to the size of the buffer. The chunk will be read and buffered, but the event will not be triggered. This will be followed up by a BeginRead that expects to find more data belonging to the current chunk in order to send it back all in one piece, but... there will be no more data in the stream. In fact, as long as data is put into the stream in chunks with length exactly equal to the buffer size, the data will be buffered and the event will never be triggered. This scenario may be highly unlikely to occur in practice, especially since we can pick any number for the buffer size, but the problem is there. Solution? Unfortunately, after checking the available methods on FileStream and StreamReader, I can't find anything which lets me peek into the stream while also allowing async methods to be used on it. One "solution" would be to have a thread wait on a ManualResetEvent after the "buffer filled" condition is detected. If the event is not signaled (by the async callback) in a small amount of time, then more data from the stream will not be forthcoming and the data accumulated so far should be sent to subscribers. However, this introduces the need for another thread, requires thread synchronization, and is plain inelegant. Specifying a timeout for BeginRead would also suffice (call back into my code every now and then so I can check if there's data to be sent back; most of the time there will not be anything to do, so I expect the performance hit to be negligible). But it looks like timeouts are not supported in FileStream. Since I imagine that async calls with timeouts are an option in bare Win32, another approach might be to PInvoke the hell out of the problem. But this is also undesirable as it will introduce complexity and simply be a pain to code. Is there an elegant way to get around the problem? Thanks for being patient enough to read all of this. Update: I definitely did not communicate the scenario well in my initial writeup. I have since revised the writeup quite a bit, but to be extra sure: The question is about how to implement an async "read all the data available this moment" operation. My apologies to the people who took the time to read and answer without me making my intent clear enough.

    Read the article

  • Debugging Cactus Tests in Eclipse

    - by Th3sandm4n
    Side note: This is inherited code, I didn't do any of the setup and am new to the project. I'm trying to set up remote debugging in Eclipse for these unit tests that use Cactus. I've read around a bit (but I can't seem to find any REAL information how to set this up). Closest I've found is here (http://www.eclipse.org/webtools/community/tutorials/CactusInWTP/CactusInWTP.html), but it just says to Debug - Debug on Server, but nowhere does it say where the debug port is set or anything, and I can't find anything on how to enable this, set it. Just asking to see if anyone has set this up before, it would really help stepping through the code rather than just logging. The plugin (http://jakarta.apache.org/cactus/integration/eclipse/runner_plugin.html) Looks promising, but I also don't even know where to download it, it doesn't link to a location -.- The project uses ant, cactus, and I'm using Eclipse. Thanks EDIT Here is the target I'm using <junit fork="no" forkmode="perTest" printsummary="yes" haltonfailure="no" haltonerror="no" failureproperty="tests.failed"> <jvmarg value="-Xdebug" /> <jvmarg value="-Xrunjdwp:transport=dt_socket,address=localhost:8005,server=y,suspend=y" /> <formatter type="xml" usefile="true" /> <formatter type="plain" usefile="false" /> <classpath> <pathelement location="${clover.jar}"/> <path refid="cactus.classpath.id" /> <pathelement location="../ejb/src" /> </classpath> <sysproperty key="cactus.contextURL" value="${cactus.contextURL}"/> <test name="com.test.AllTests" outfile="TESTS" /> </junit>

    Read the article

  • Why No android.content.SyncAdapter meta-data registering sync-adapter?

    - by mobibob
    I am following the SampleSyncAdapter and upon startup, it appears that my SyncAdapter is not configured correctly. It reports an error trying to load its meta-data. How can I isolate the problem? You can see the other accounts in the system that register correctly. Logcat: 12-21 17:10:50.667 W/PackageManager( 121): Unable to load service info ResolveInfo{4605dcd0 com.myapp.syncadapter.MySyncAdapter p=0 o=0 m=0x108000} 12-21 17:10:50.667 W/PackageManager( 121): org.xmlpull.v1.XmlPullParserException: No android.content.SyncAdapter meta-data 12-21 17:10:50.667 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache.parseServiceInfo(RegisteredServicesCache.java:391) 12-21 17:10:50.667 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache.generateServicesMap(RegisteredServicesCache.java:260) 12-21 17:10:50.667 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache$1.onReceive(RegisteredServicesCache.java:110) 12-21 17:10:50.667 W/PackageManager( 121): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892) 12-21 17:10:50.667 W/PackageManager( 121): at android.os.Handler.handleCallback(Handler.java:587) 12-21 17:10:50.667 W/PackageManager( 121): at android.os.Handler.dispatchMessage(Handler.java:92) 12-21 17:10:50.667 W/PackageManager( 121): at android.os.Looper.loop(Looper.java:123) 12-21 17:10:50.667 W/PackageManager( 121): at com.android.server.ServerThread.run(SystemServer.java:570) 12-21 17:10:50.747 D/Sources ( 294): Creating external source for type=com.skype.contacts.sync, packageName=com.skype.raider 12-21 17:10:50.747 D/Sources ( 294): Creating external source for type=com.twitter.android.auth.login, packageName=com.twitter.android 12-21 17:10:50.747 D/Sources ( 294): Creating external source for type=com.example.android.samplesync, packageName=com.example.android.samplesync 12-21 17:10:50.747 W/PackageManager( 121): Unable to load service info ResolveInfo{460504b0 com.myapp.syncadapter.MySyncAdapter p=0 o=0 m=0x108000} 12-21 17:10:50.747 W/PackageManager( 121): org.xmlpull.v1.XmlPullParserException: No android.content.SyncAdapter meta-data 12-21 17:10:50.747 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache.parseServiceInfo(RegisteredServicesCache.java:391) 12-21 17:10:50.747 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache.generateServicesMap(RegisteredServicesCache.java:260) 12-21 17:10:50.747 W/PackageManager( 121): at android.content.pm.RegisteredServicesCache$1.onReceive(RegisteredServicesCache.java:110) 12-21 17:10:50.747 W/PackageManager( 121): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892) 12-21 17:10:50.747 W/PackageManager( 121): at android.os.Handler.handleCallback(Handler.java:587) 12-21 17:10:50.747 W/PackageManager( 121): at android.os.Handler.dispatchMessage(Handler.java:92) 12-21 17:10:50.747 W/PackageManager( 121): at android.os.Looper.loop(Looper.java:123) 12-21 17:10:50.747 W/PackageManager( 121): at com.android.server.ServerThread.run(SystemServer.java:570)

    Read the article

  • Layout components Horizontally in Android

    - by xximjasonxx
    Greetings all, I am trying to create a layout in Android for a notification. My goal is to have the following displayed: 1: Icon for the app 2: Vertically stacked LinearLayout with Session title and Room to be held in 3: The start time of the session The problem I am facing is that #2 has a variable width depending on the size of the title. Hardcoding a width would look terrible if the user turns the handset sideways and goes into Landscape mode. Therefore here is my question: How can I layout three components horizontally in Android such that #1 and #3 are left and right aligned respectively, and #2 simply takes the space remaining? Thanks in advance

    Read the article

  • Moving a point along a vector

    - by Chris
    Hello- I have a point defined by x,y and a vector defined by heading, speed. I am attempting to move the point x,y along this vector, at a distance of 'speed'. Below is the code I am currently using: self.x += self.speed * cos(self.heading); self.y += self.speed * sin(self.heading); Heading can be any angle in a full circle - 0 to 2p (0-360 degrees). The problem is the above code: Only moves along the x or y axis when angle is 0-270 for example, when the avatar is facing the top-right corner (45 degrees relative), it moves straight up. Does not move at all when angle is 270-360 heading, speed, X and Y are all doubles, and heading is reported by the user touching a direction-pad in the lower corner. I know the heading is correct because the avatar rotates to the correct direction, it is just the actual movement I am having problems with. Thanks for any help - Chris

    Read the article

  • Does writing data to server using Java URL class require response from server?

    - by gigadot
    I am trying to upload files using Java URL class and I have found a previous question on stack-overflow which explains very well about the details, so I try to follow it. And below is my code adopted from the sniplet given in the answer. My problem is that if I don't make a call to one of connection.getResponseCode() or connection.getInputStream() or connection.getResponseMessage() or anything which is related to reponse from the server, the request will never be sent to server. Why do I need to do this? Or is there any way to write the data without getting the response? P.S. I have developed a server-side uploading servlet which accepts multipart/form-data and save it to files using FileUpload. It is stable and definitely working without any problem so this is not where my problem is generated. import java.io.Closeable; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import org.apache.commons.io.IOUtils; public class URLUploader { public static void closeQuietly(Closeable... objs) { for (Closeable closeable : objs) { IOUtils.closeQuietly(closeable); } } public static void main(String[] args) throws IOException { File textFile = new File("D:\\file.zip"); String boundary = Long.toHexString(System.currentTimeMillis()); // Just generate some unique random value. HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:8080/upslet/upload").openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); OutputStream output = output = connection.getOutputStream(); PrintWriter writer = writer = new PrintWriter(output, true); // Send text file. writer.println("--" + boundary); writer.println("Content-Disposition: form-data; name=\"file1\"; filename=\"" + textFile.getName() + "\""); writer.println("Content-Type: application/octet-stream"); FileInputStream fin = new FileInputStream(textFile); writer.println(); IOUtils.copy(fin, output); writer.println(); // End of multipart/form-data. writer.println("--" + boundary + "--"); output.flush(); closeQuietly(fin, writer, output); // Above request will never be sent if .getInputStream() or .getResponseCode() or .getResponseMessage() does not get called. connection.getResponseCode(); } }

    Read the article

  • Jquery animation callback issues

    - by ChrisOPeterson
    I'm trying to build a simple carousel animation with jQuery. There are 3 viewable images at any one time with buttons to click on each side to go forward or backwards. The center image is raised up by 30px to be given prominence. When one of the buttons is pushed the center image should drop down then all three images move together left or right. The initial up and down animation works but on a callback none of the other animations will work. If I hard code the direction into them only one of them works. Is there something wrong with my current code or approach? ctr_right.click(function() { carouselAnimate("right") }); ctr_left.click(function() { carouselAnimate("left") }); function carouselAnimate(direction) { var offset = img_width + img_offset; img_focus.animate({"top": "+="+focus_offset}, "slow", function() { img_left.animate({direction: "-="+offset}, "slow"); img_focus.animate({direction: "-="+offset}, "slow"); img_right.animate({direction: "-="+offset}, "slow"); }); };

    Read the article

  • .NET SerialPort DataReceived event thread interference with main thread

    - by Kiran
    I am writing a serial communication program using the SerialPort class in C# to interact with a strip machine connected via a RS232 cable. When i send the command to the machine it responds with some bytes depending on the command. Like when i send a "\D" command, i am expecting to download the machine program data of 180 bytes as a continous string. As per the machine's manual, it suggests as a best practice to send an unreognized characters like comma (,) character to make sure the machine is initialized before sending the first command in the cycle. My serial communication code is as follows: public class SerialHelper { SerialPort commPort = null; string currentReceived = string.Empty; string receivedStr = string.Empty; private bool CommInitialized() { try { commPort = new SerialPort(); commPort.PortName = "COM1"; if (!commPort.IsOpen) commPort.Open(); commPort.BaudRate = 9600; commPort.Parity = System.IO.Ports.Parity.None; commPort.StopBits = StopBits.One; commPort.DataBits = 8; commPort.RtsEnable = true; commPort.DtrEnable = true; commPort.DataReceived += new SerialDataReceivedEventHandler(commPort_DataReceived); return true; } catch (Exception ex) { return false; } } void commPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { SerialPort currentPort = (SerialPort)sender; currentReceived = currentPort.ReadExisting(); receivedStr += currentReceived; } internal int CommIO(string outString, int outLen, ref string inBuffer, int inLen) { receivedStr = string.Empty; inBuffer = string.Empty; if (CommInitialized()) { commPort.Write(outString); } System.Threading.Thread.Sleep(1500); int i = 0; while ((receivedStr.Length < inLen) && i < 10) { System.Threading.Thread.Sleep(500); i += 1; } if (!string.IsNullOrEmpty(receivedStr)) { inBuffer = receivedStr; } commPort.Close(); return inBuffer.Length; } } I am calling this code from a windows form as follows: len = SerialHelperObj.CommIO(",",1,ref inBuffer, 4) len = SerialHelperObj.CommIO(",",1,ref inBuffer, 4) If(inBuffer == "!?*O") { len = SerialHelperObj.CommIO("\D",2,ref inBuffer, 180) } A valid return value from the serial port looks like this: \D00000010000000000010 550 3250 0000256000 and so on ... I am getting some thing like this: \D00000010D,, 000 550 D,, and so on... I feel that my comm calls are getting interferred with the one when i send commands. But i am trying to make sure the result of the comma command then initiating the actual command. but the received thread is inserting the bytes from the previous communication cycle. Can any one please shed some light into this...? I lost quite some hair just trying to get this work. I am not sure where i am doing wrong

    Read the article

  • Why is file_get_contents() faster than using fsock_open()?

    - by eds
    In PHP, sometimes I want to send an HTTP request to a remote site just to look at the response headers, so I declare it all manually and use the fsock_open() function. However, this goes much slower than calling file_get_contents() with a remote URL (which loads the whole page content). Why is this? Is there a good alternative way to get just the response headers (to check if a page returns a 404 error, for example) that works as fast as file_get_contents()?

    Read the article

  • what's the right way to use scala.io.Source?

    - by woods
    In many examples, it is described that you can use scala.io.Source to read a whole file like this: val str = scala.io.Source.fromFile("test.txt").mkString() But closing the underlying stream is not mentioned. Why does Scala not provide a convenient way to do that such as with clause in Python? It looks useful but not difficult. Is there any other better way to do that safely in Scala, i means to read a whole file?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >