Search Results

Search found 5783 results on 232 pages for 'translation unit'.

Page 57/232 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • WPF Animate a Maxtrix using interpolation

    - by Mark
    Im having a issue with my application that is using touch gestures to scale, translate and rotate my scene. I was using a TransformGroup which contained TranslateTransform, ScaleTransform and a RotateTransform but I could not get the movement correct, it always jumps and skips, so I moved to a MaxtrixTransform which I was able to use much easier to get my scene to be zoomable, rotatable and panable nicely. However, what I later found out was that you cannot animate smoothly (using interpolation) the values of a Matrix, for what reason I have no idea, but its part of the MSDN doco and the properties of the Matrix are not dependency properties anyways... Has anyone had any luck animating a maxtrix to make it smooth? The only idea(s) I have had is to animate a few different, custom DP which all have callbacks that I update the Matrix from OR To convert the Maxtix to a set of Transform object that I then animate and then afterwords convert back. Is there a smarter way to do this?

    Read the article

  • Please help me translate C# code to Ruby

    - by Valentin Vasilyev
    Here is the code: using System; using System.Collections.Generic; using System.Linq; namespace cs2 { class Program { static void Main(string[] args) { var i=Fibs.TakeWhile(x=>x < 1000).Where(x=>x % 2==0).Sum(); } static IEnumerable<long> Fibs() { long a = 0, b = 1; while (true) { yield return b; b += a; a = b - a; } } } }

    Read the article

  • Microsoft sublanguage string to locale identifier

    - by Jacob
    I can't seem to find a way to convert, or find, a local identifier from a sublanguage string. This site shows the mappings: http://msdn.microsoft.com/en-us/library/dd318693(v=VS.85).aspx I want the user to enter a sublanguage string, such as "France (FR)" and to get the local identifier from this, which in this case would be 0x0484. Or the other way around, if a user enters 0x0480 then to return French (FR). Has anyone encountered this problem before and can point me in the right direction? Otherwise I'm going to be writing a few mapping statements to hard code it and maintain future releases if anything changes. BTW, I'm coding in C++ for Windows platform. Cheers

    Read the article

  • Something similar to this C# code in Ruby on Rails

    - by Jimmy
    Hey guys, I am trying to get a collection of objects based on a conditions. Now normally in C# I would do something like this employeesCollection.Where(emp => emp.Name == "john"); how can I do something similar in Ruby on Rails (I am trying to map a collection of objects to a select but I only want to map certain objects that match a condition. My current ruby on rails code looks like this <%= select( 'page', 'id', @post.pages.map {|page| [page.title, page.id]}) %> I want to add a condition to an attribute of page Can anyone help?

    Read the article

  • 3D Animation Rotating and Translating simultaneously in WPF

    - by sklitzz
    Hi, I have ModelVisual3D of a cube. I want to translate and rotate it at the same time. I wish the center of rotation to be in the middle of the cube(the cube rotates around its own axis). But when I try to do this applying both transformations the effect is not what you would expect. Since the object is translating the center of rotation is different thus making it move and rotate in a strange way. How do I get the desired effect? Transform3DGroup transGroup = new Transform3DGroup(); DoubleAnimation cardAnimation = new DoubleAnimation(); cardAnimation.From = 0; cardAnimation.To = 3; cardAnimation.Duration = new Duration(TimeSpan.FromSeconds(2)); Transform3D transform = new TranslateTransform3D(0,0,0); transGroup.Children.Add(transform); RotateTransform3D rotateTransform = new RotateTransform3D(); AxisAngleRotation3D rotateAxis = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 180); Rotation3DAnimation rotateAnimation = new Rotation3DAnimation(rotateAxis, TimeSpan.FromSeconds(2)); rotateAnimation.DecelerationRatio = 0.8; transGroup.Children.Add(rotateTransform); Model.Transform = transGroup; transform.BeginAnimation(TranslateTransform3D.OffsetXProperty, cardAnimation); rotateTransform.BeginAnimation(RotateTransform3D.RotationProperty, rotateAnimation);

    Read the article

  • Translate from Java to C#: simple code to re-encode a string

    - by Dr. Zim
    We were sent this formula to encrypt a string written in Java: String myInput = "test1234"; MessageDigest md = MessageDigest.getInstance("SHA"); byte[] myD = md.digest(myInput.getBytes()); BASE64Encoder en64 = new BASE64Encoder(); String myOutput = new String ( Java.net.URLEncoder.encode( en64.encode(myD))); // myOutput becomes "F009U%2Bx99bVTGwS3cQdHf%2BJcpCo%3D" Our attempt at writing this in C# is: System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); string myOutput = HttpUtility.UrlEncode( Convert.ToBase64String( sha1.ComputeHash( ASCIIEncoding.Default.GetBytes(myInput)))); However the output is no where near the same. It doesn't even have percent signs in it. Any chance anyone would know where we are going wrong?

    Read the article

  • zooming from a particular point

    - by Chandan Shetty SP
    I am using this code to zoom from a particular point CGPoint getCenterPointForRect(CGRect inRect) { CGRect screenRect = [[UIScreen mainScreen] bounds]; return CGPointMake((screenRect.size.height-inRect.origin.x)/2,(screenRect.size.width-inRect.origin.y)/2); } -(void) startAnimation { CGPoint centerPoint = getCenterPointForRect(self.view.frame); self.view.transform = CGAffineTransformMakeTranslation(centerPoint.x, centerPoint.y); self.view.transform = CGAffineTransformScale( self.view.transform , 0.001, 0.001); [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:kTransitionDuration]; self.view.transform = CGAffineTransformIdentity; [UIView commitAnimations]; } Its not working. What is the correct way to do zooming from a particular point.

    Read the article

  • What is the best way to translate a big amount of text data?

    - by sashaeve
    I have a lot of text data and want to translate it to different languages. Possible ways I know: Google Translate API Bing Translate API The problem is that all these services have limitations on text length, number of calls etc. which makes them inconveniente in use. What services / ways you could advice to use in this case?

    Read the article

  • How would you write this C# code succinctly in Ruby?

    - by Valentin Vasilyev
    Here is the code: using System; using System.Collections.Generic; using System.Linq; namespace cs2 { class Program { static void Main(string[] args) { var i=Fibs().TakeWhile(x=>x < 1000).Where(x=>x % 2==0).Sum(); } static IEnumerable<long> Fibs() { long a = 0, b = 1; while (true) { yield return b; b += a; a = b - a; } } } } If it is possible, please give an example.

    Read the article

  • Need help in translating code from C to Java.

    - by Vuntic
    From this article. Here's the code: float InvSqrt(float x){ // line 0 float xhalf = 0.5f * x; int i = *(int*)&x; // store floating-point bits in integer i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method x = *(float*)&i; // convert new bits into float x = x*(1.5f - xhalf*x*x); // One round of Newton's method return x; } ...I can't even tell if that's C or C++. [okay apparently it's C, thanks] Could someone translate it to Java for me, please? It's (only, I hope) lines 2 and 4 that are confusing me.

    Read the article

  • How to handle dynamic site localizations?

    - by James Simpson
    I've got a website that is currently all in english. It is an online game, so it has a bunch of different pages with static text, as well as a lot of content in a database. I am trying to expand more globally and am gearing up to release some localizations of the site. However, I'm not sure about the best way to go about setting this up so that it'll be the easiest for me to manage and the easiest for users to use as well. Should I be storing the translated texts in a database, or should this be done in a completely different way? If it matters at all, the site is written in PHP and uses MySQL.

    Read the article

  • How to translate such AS3 class into C#?

    - by Ole Jak
    So I try to create opensource C# project for slicing FLVs I began with translating of existing project called flvslicer Can any one please help me with translating one of their classes package org.bytearray.video.events { import flash.events.Event; import flash.utils.ByteArray; public final class MergedEvent extends Event { public var time:Number; public var stream:ByteArray; public static const COMPLETE:String = "mergeComplete"; public function MergedEvent(type:String, stream:ByteArray, duration:Number) { super(type, false, false); // base this.stream = stream; this.time = duration; } } }

    Read the article

  • What's the proper way of importing option lists into an Android app?

    - by Scott
    I have been storing option lists for my Android app in a cloud table. For example, categories like "historical fiction","biography","science fiction", etc. I see the following pros and cons: Pro: I can make changes to the list without sending an app update to Google Play Not normalized - I can use the text in my other data tables instead of a reference ID Con: App needs to take time to download from the web each time (or at least check for changes) English only I believe the "proper" way to do this is the use the XML resource files. But I need to make sure the selection references correctly with my data. That is, my app needs to understand that "Poetry" and "Poesía" are the same thing. Is the correct thing to do: Forget about it since I'll never get to the point where I'm translating my app anyway Use a string-array and use the index (0...x) to know what the selection is Use a 2-dimensional string-array with a reference ID in the first column and the text in the second?

    Read the article

  • void foo(int &x) -> Ruby? Passing integers by reference?

    - by Earlz
    Hello, as a way to spice up my C++ programming homework, I've decided to instead of typing the C++ from the book onto my computer, instead reforming it in Ruby. Yes it's a bit silly, but I'm bored. Anyway, I'm having trouble converting this kind of function to Ruby void swap(int &a,int &b){ int c=b; b=a; a=c } What would the equivalent ruby code looking inside a function ?

    Read the article

  • How do I convert this cURL command to PHP (libcurl)?

    - by Daddy Warbox
    In continuation off of this question, what are the PHP statements I need to accomplish this: curl -is -F 'J:A-login=BTDT::Action::Login' -F 'J:A:F-address-login=EMAILADDRESS' -F 'J:A:F-password-login=PASSWORD' http://hiveminder.com/splash | grep -o 'JIFTY_SID_HIVEMINDER=[0-9a-f]\+' The flags and fields are still mysterious, and I've not the time presently to swim through docs to figure out how this translates. I do at least understand the | grep ... portion, though.

    Read the article

  • php cron jobs overlapping

    - by naveen gupta
    Hi I wrote few months back a script in perl for checking overlapping of jobs use Fcntl ':flock'; INIT { my $waitcount=12; # possible attemtps to run script my $waitseconds=300; # wait for $waitseconds each attempt my $lockstatus=0;#no lock was attained while ($waitcount > 0){ if (open LH, $0){ while ($waitcount > 0){ if (flock LH, LOCK_EX|LOCK_NB){ $waitcount=0;#signal end of waiting $lockstatus=1;#lock was attained } else{ --$waitcount;#decrement waitcount print "waiting to be able to lock $0\n"; sleep $waitseconds; }#end else }#end while }#end if else{ --$waitcount;#decrement waitcount print "waiting to be able to open $0\n"; sleep $waitseconds; }#end else }#end while if ($lockstatus == 0){ die "no lock was attained\n"; }#end if } I wanted to know if we can do similar thing in php .. How to integrate with your current php code which is running a part of php jobs?

    Read the article

  • How can I change the language of dynamic text in a SWF using flashvars?

    - by Cormac
    I have a SWF with text embedded from an external .txt file. Is there a way I can have a different file used as the text source through the embedcode (swfObject) depending on the language? Here is my current actionscript: myData = new LoadVars(); myData.onLoad = function() { text_clips.project_title.text = this.projecttitle1; }; myData.load("translatetext.txt"); var loader:MovieClipLoader = new MovieClipLoader(); loader.loadClip(_level0.projectimage1,pic1.image_holder); This is the content of translatetext.txt: projecttitle1=This is my translatable text This is the embed code I'm using: <div> <object width="960" height="275" id="rvFlashcontent"> <param name="movie" value="lang_test_3.swf" /> <param name="wmode" value="transparent" /> <param name="flashvars" value="projectimage1=flashimages/testimage.jpg" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="lang_test_3.swf" width="960" height="275"> <param name="wmode" value="transparent" /> <param name="flashvars" value="projectimage1=flashimages/testimage.jpg" /> <!--<![endif]--> <h1>Alt Content</h1> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> What I want to do is add a Flashvars parameter to name the file to load, so I can change the language: <param name="flashvars" value="projectimage1=flashimages/image.jpg&projecttext=textfrench.txt" /> There are four languages needed so far, but this will grow so it needs to be flexible enough to let the developers add languages without getting a new SWF each time. Thanks in advance all!

    Read the article

  • How to translate the fields of a database model?

    - by Tõnis M
    I have some tables/models in a web app that will have multilingual content. For example a university, with it's description in a default language(english) and the user wants he can see the same information in another language( if the object has it's fields translated). If there were only a few languages then I would just add fields like name_en and name_de and so on, but the number of languages isn't fixed, so that' would create a mess. I could also just create a new object with the translated data but then foreign keys wouldn't work, and only some of the fields can be translated so that would create duplicate data. Storing the translations in a file and using gettext or something similar is also not an option since the objects fields can be translated by the website user, not only developers/admins. What would be the best way to design/architect such a database? Searching from the translated data should also be not too complex - as it should not require creating complex joins which would make the queries slower I'm using PostgreSQL and Ruby of Rails but I'm not looking for a technical solution but for a general idea how to design it.

    Read the article

  • crc24 from c to python

    - by biiiiiaw
    can someone please translate this code to python? i have tried and tried again, but have not managed it: #define CRC24_INIT 0xB704CEL #define CRC24_POLY 0x1864CFBL typedef long crc24; crc24 crc_octets(unsigned char *octets, size_t len) { crc24 crc = CRC24_INIT; int i; while (len--) { crc ^= (*octets++) << 16; for (i = 0; i < 8; i++) { crc <<= 1; if (crc & 0x1000000) crc ^= CRC24_POLY; } } return crc & 0xFFFFFFL; } i have the rotate left function (ROL24(value,bits_to_rotate_by)), which i know works since i got it from a source code of a reputable programmer, but i dont get the * and ++ on octet. i only sort of understand how ++ works in c++, and i dont know what * is at all

    Read the article

  • RESTful API: How to handle translated textfields in representations?

    - by Jan P.
    I am designing a RESTful API for a booking application. There are accommodations that you can request a list or the details. As the application targets a multi-language audience, the descriptions are (sometimes) available in different languages. Now I'm not sure how to handle these translations in the representation of an accommodation. Without the multiple languages I would make "description" a field or the accommodation object, quite simple. Any idea how to solve this elegantly? My current idea: Add a list of descriptions with text<-culture pairs instead of the description field and an additional subressource /descriptions to the accommodation for the creating (POST), updating (PUT) and deleting (DELETE) of new translations.

    Read the article

  • Help translating from assembly to C

    - by user324994
    I have some code from a function subl $24, %esp movl 8(%ebp), %eax cmpl 12(%ebp), %eax Before the code is just the 'ENTER' command and afterwards there's an if statement to return 1 if ebp eax or 0 if it's less. I'm assuming cmpl means compare, but I can't tell what the concrete values are. Can anyone tell me what's happening?

    Read the article

  • Can i Convert VB code to C++ code

    - by shubu
    Can I convert my VB code to C++? How can I do it? This is my VB code: Dim OpenFileDialog1 As New OpenFileDialog With OpenFileDialog1 .CheckFileExists = True .ShowReadOnly = False .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg" .FilterIndex = 2 If .ShowDialog = DialogResult.OK Then ' Load the specified file into a PictureBox control. PictureBox1.Image = Image.FromFile(.FileName) End If End With

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >