Search Results

Search found 3022 results on 121 pages for 'loose typing'.

Page 10/121 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • C++ and its type system: How to deal with data with multiple types?

    - by sub
    "Introduction" I'm relatively new to C++. I went through all the basic stuff and managed to build 2-3 simple interpreters for my programming languages. The first thing that gave and still gives me a headache: Implementing the type system of my language in C++ Think of that: Ruby, Python, PHP and Co. have a lot of built-in types which obviously are implemented in C. So what I first tried was to make it possible to give a value in my language three possible types: Int, String and Nil. I came up with this: enum ValueType { Int, String, Nil }; class Value { public: ValueType type; int intVal; string stringVal; }; Yeah, wow, I know. It was extremely slow to pass this class around as the string allocator had to be called all the time. Next time I've tried something similar to this: enum ValueType { Int, String, Nil }; extern string stringTable[255]; class Value { public: ValueType type; int index; }; I would store all strings in stringTable and write their position to index. If the type of Value was Int, I just stored the integer in index, it wouldn't make sense at all using an int index to access another int, or? Anyways, the above gave me a headache too. After some time, accessing the string from the table here, referencing it there and copying it over there grew over my head - I lost control. I had to put the interpreter draft down. Now: Okay, so C and C++ are statically typed. How do the main implementations of the languages mentioned above handle the different types in their programs (fixnums, bignums, nums, strings, arrays, resources,...)? What should I do to get maximum speed with many different available types? How do the solutions compare to my simplified versions above?

    Read the article

  • C#: How to find the default value for a run-time Type?

    - by George Mauer
    So given a static type in your code you can do var defaultMyTypeVal = default(MyType); How would you do the same thing given a variable of Type so you can use it during runtime? In other words how do I implement the following method without a bunch of if statements or using Generics (because I will not know the type I'm passing into the method at compile time)? public object GetDefaultValueForType(Type type) { .... }

    Read the article

  • Haskell type signature with multiple type somethings (predicates?, for example Eq a =>)

    - by Andrew
    I'm not sure if type predicates is the right term, in fact I've never learned the word for this, so an edit to correct would be helpful - I'm referring to when you give the tipe of function f :: a -> b and you want to say a is a Eq and you say f :: Eq a => a -> b, the name for Eq a => - this is the thing i called a type predicate. My question, though, is how to have multiple of these, so if A is an Eq and B is a Num, I could say either f :: Eq a => a -> b or f :: Num b => a -> b. So, how can I have Eq a => and Num b => at the same time? f :: Eq a => Num b => a -> b, f :: Eq a -> Num b => a -> b, and f :: Eq a, Num b => a -> b all didn't do what I wanted.

    Read the article

  • Will my shared variables loose value? (asp.net vb)

    - by Phil
    I have a class includes.vb that holds some variables (sharing them with other pages) like: Public Shared pageid As Integer = 0 I then have a function that does some work with these variables returning them with values; Return pageid When I step through the code, the variables have values (while stepping through the function), but when they are returned to the page, they come back null. Do they loose value everytime a page is loaded? Can you suggest an alternative method? Thanks a lot.

    Read the article

  • Is it OK to use dynamic typing to reduce the amount of variables in scope?

    - by missingno
    Often, when I am initializing something I have to use a temporary variable, for example: file_str = "path/to/file" file_file = open(file) or regexp_parts = ['foo', 'bar'] regexp = new RegExp( regexp_parts.join('|') ) However, I like to reduce the scope my variables to the smallest scope possible so there is less places where they can be (mis-)used. For example, I try to use for(var i ...) in C++ so the loop variable is confined to the loop body. In these initialization cases, if I am using a dynamic language, I am then often tempted to reuse the same variable in order to prevent the initial (and now useless) value from being used latter in the function. file = "path/to/file" file = open(file) regexp = ['...', '...'] regexp = new RegExp( regexp.join('|') ) The idea is that by reducing the number of variables in scope I reduce the chances to misuse them. However this sometimes makes the variable names look a little weird, as in the first example, where "file" refers to a "filename". I think perhaps this would be a non issue if I could use non-nested scopes begin scope1 filename = ... begin scope2 file = open(filename) end scope1 //use file here //can't use filename on accident end scope2 but I can't think of any programming language that supports this. What rules of thumb should I use in this situation? When is it best to reuse the variable? When is it best to create an extra variable? What other ways do we solve this scope problem?

    Read the article

  • Wireless connected but internet not working, modem is fine because I'm typing over wifi on my android

    - by Sandro Livaja
    I can't connect to the Internet in 11.10. I tried switching my wifi card to another USB slot but nothing changed. Is it possible that the card is able to connect while not being able to receive packages? $ ifconfig eth0 Link encap:Ethernet HWaddr 40:61:86:35:11:b0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:43 Base address:0x6000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 74:ea:3a:8c:d5:5c inet addr:192.168.2.5 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::76ea:3aff:fe8c:d55c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12 errors:0 dropped:0 overruns:0 frame:0 TX packets:102 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1209 (1.2 KB) TX bytes:15329 (15.3 KB)

    Read the article

  • Loose Coupling vs. Information Hiding and Ease of Change

    - by cretzel
    I'm just reading Code Complete by Steve McConell and I'm thinking of an Example he gives in a section about loose coupling. It's about the interface of a method that calculates the number of holidays for an employee, which is calculated from the entry date of the employee and her sales. The author suggests a to have entry date and sales as the parameters of the method instead of an instance of the employee: int holidays(Date entryDate, Number sales) instead of int holidays(Employee emp) The argument is that this decouples the client of the method because it does not need to know anything about the Employee class. Two things came to my mind: Providing all the parameters that are needed for the calculation breaks encapsulation. It shows the internals of the method on how it computes the result. It's harder to change, e.g. when someone decides that also the age of the employee should be included in the calculation. One would have to change the signature. What's your opinion?

    Read the article

  • Why does iTunes sometimes loose everything in the library when upgrading?

    - by Rod
    All of my kids have experienced problems at one time or another, when upgrading iTunes on their laptops. The version number doesn't matter, as this has happened for the last couple of years, so the version number has changed. It isn't consistent. What is consistent is sometimes, but not always, after upgrading iTunes, it will have lost all of it's information about the music, podcasts, etc, that it had. And yet if I bring up Windows Explorer, I can find all of it there. It's a pain to have to recover that. The pertinent question is, how do you recover all of the music, podcasts, playlists, etc, that is on the computer, but iTunes doesn't show it in the library? Second, what causes iTunes to do this in the first place?

    Read the article

  • In windows 7, how do I disable "Ease of Access" pop ups on the logon screen as I am typing my passwo

    - by Silfheed
    Heyas So the question is pretty much in the title. Things to note: 'Use On-Screen Keyboard' is un-checked I have disabled Ease of Access by replacing utilman.exe But my problem now is that when I'm typing my password, It'll stop all together on the 'u' or the 'p' character and I have to click on the ease of access button then move focus back to the password to continue. Yes, one obvious solution is to not use a password that has 'u' or 'p' in it (which I've done), but that's obviously not a completely satisfying answer. Thanks! I feel a tumbleweed badge...

    Read the article

  • [jquery/javascript] Trigger function when mouse click inside textarea AND type stop typing...

    - by marc
    Welcome, In short, my website use BBcode system, and i want allow users to preview message without posting it. I'm using JQuery library. I need 3 actions. 1) When user click in textarea i want display DIV what will contain preview, i want animate opening. 2) When user typing, i want dynamical load parsed by PHP code to DIV. (i'm still thinking what will be best option... refresh every 2 seconds, or maybe we can detect and refresh after 1 second of inactivity [stop typing]) 3) When user click outside textarea i want close preview div with animation. For example the PHP parser will have patch /api/parser.php and variable by POST called $_POST['message']. Any idea my digital friends ?

    Read the article

  • Trigger function when mouse click inside textarea AND type stop typing...

    - by marc
    Welcome, In short, my website use BBcode system, and i want allow users to preview message without posting it. I'm using JQuery library. I need 3 actions. 1) When user click in textarea i want display DIV what will contain preview, i want animate opening. 2) When user typing, i want dynamical load parsed by PHP code to DIV. (i'm still thinking what will be best option... refresh every 2 seconds, or maybe we can detect and refresh after 1 second of inactivity [stop typing]) 3) When user click outside textarea i want close preview div with animation. For example the PHP parser will have patch /api/parser.php and variable by POST called $_POST['message']. Any idea my digital friends ?

    Read the article

  • Does moving a file outside NTFS loose data in alternate data streams?

    - by jay
    I have a lot of files on machine running Windows Server 2008 which I wanted to move to a Fedora machine. How can I keep the attributes stored in, for example, media files (date taken, rating, length, etc) while transfering it to outside the realm of NTFS's Alternate Data Streams. I'm aware that similar metadata exists in other file systems, but what happens when you move these files? And what's the best way to retain them in other file systems?

    Read the article

  • Does moving a file outside NTFS loose data in alertnate data streams?

    - by jay
    I have a lot of files on machine running Windows Server 2008 which I wanted to move to a Fedora machine. How can I keep the attributes stored in, for example, media files (date taken, rating, length, etc) while transfering it to outside the realm of NTFS's Alternate Data Streams. I'm aware that similar metadata exists in other file systems, but what happens when you move these files? And what's the best way to retain them in other file systems?

    Read the article

  • In windows 7, how do I disable "Ease of Access" pop ups on the logon screen as I am typing my password?

    - by Silfheed
    So the question is pretty much in the title. Things to note: 'Use On-Screen Keyboard' is un-checked I have disabled Ease of Access by replacing utilman.exe But my problem now is that when I'm typing my password, It'll stop all together on the 'u' or the 'p' character and I have to click on the ease of access button then move focus back to the password to continue. Yes, one obvious solution is to not use a password that has 'u' or 'p' in it (which I've done), but that's obviously not a completely satisfying answer. Thanks! I feel a tumbleweed badge...

    Read the article

  • How to trigger an event in input text after I stop typing/writting?

    - by user1386320
    I want to trigger event just right after I stop typing (not while typing) characters in my input textbox. I've tried with: $('input#username').keypress(function() { var _this = $(this); // copy of this object for further usage setTimeout(function() { $.post('/ajax/fetch', { type: 'username', value: _this.val() }, function(data) { if(!data.success) { // continue working } else { // throw an error } }, 'json'); }, 3000); }); But this example produces a timeout for every typed character and I get about 20 AJAX requests if I type-in 20 characters. On this fiddle I demonstrate the same problem with a simple alert instead of an AJAX. Is there a solution for this or I'm just using a bad approach for this?

    Read the article

  • why is the address bar black in Google chrome so you cannot see what you're typing ? [closed]

    - by Tim
    The address bar background color in Google Chrome is black. I cannot see what I'm typing. What's going on? This is a problem when you're typing in a URL you've never used before (so there's no matching history). Type in a URL you've never used before. Imagine someone is giving it to you over the phone. Make a typo somewhere. Use the back arrow to go back and correct it. You cannot see where the cursor is. This just started happening yesterday. I'm on WinXP Pro.

    Read the article

  • How to disable typing in values in Dojo's NumberSpinner?

    - by callie16
    Hi, is there a way to disable typing in of values in the NumberSpinner of Dojo? Or is there a way for me to set back a previous value to it? Here's a sample situation: I have a spinner where the range is 1-3. However, the user types in an invalid value... say, a letter. The usual error handling happens. However, if the user deletes the value and focuses out (e.g. goes to another widget/control/etc. in the page), the spinner stays blank. Either I reset it to the last valid value or I disable typing so that the user can just use the up and down arrows to manipulate the widget. Any thoughts? Thanks!

    Read the article

  • Goldtouch USB Keyboard reverses keystrokes in fast typing -- expected?

    - by Justin Grant
    I am running into an odd keyboard problem: some key combinations end up reversed (e.g. "pl" ends up being emitted as "lp") when I'm typing quickly. The problematic ones are the key combos I hit with two adjacent fingers on my right hand-- in other words, the combos I can hit the fastest. No idea how fast is "fastest", but I guess around 50-150 msecs gap between them. I'm trying to track down whether this represents a failed keyboard, an inherent limitation of my Goldtouch USB keyboards, or a software problem on my Windows 7 Lenovo T500. I use a PS/2 version of the same Goldtouch keyboard at home with no problems. I've tried another USB keyboard with my laptop and can't repro the problem. I've also used this keyboard on other laptops without a problem. According to this SU thread, USB keyboards have higher latency than PS/2 keyboards-- up to 30 msecs. I find it hard to imagine that I can type key combos faster than 50 msecs, probably more like 100-150. Anyone encountered this problem with this or another keyboard? If so, how did you fix it? Any idea if there's a "keyboard log" or some way to diagnose the problem inside Windows?

    Read the article

  • How do you jump to a particular row in a DataGridView by typing (a la Windows Explorer details view)

    - by russcollier
    I have a .NET Winforms app in C# with a DataGridView that's read-only and populated with some number of rows. I'd like to have functionality similar to Windows Explorer's (and many other applications) details view for example. I'd like the DataGridView to behave such that when it has focus if you start typing, the current row selection will jump to the row where the (string) value of cell 0 (i.e. the first column in the row) starts with the characters you typed in. For example, if I have a DataGridView with 1 column and the following rows: Bob Jane Jason John Leroy Sam If the DataGridView has focus and I hit the 'b' key on my keyboard, the selected row is now "Bob". If I quickly type in the keys 'ja', the selected row is Jane. If I quickly type in the letters 'jas', the selected row is Jane. If I hit the 'z' key, nothing is selected (since nothing starts with Z). Likewise if Jane is currently selected and I keep typing the letter 'j', the selection will cycle through to Jason, then John, then back to Jane, each time I hit the 'j' key. I've been doing some Googling (and "stackoverflowing" :-)) for awhile and cannot find any examples of this type of functionality. I have a rough idea in my head to do this via some sort of short lived timer thread, collecting the keystrokes on KeyPress events for the DataGridView, and selecting rows based on those collected keystrokes matching a Cells[0].Value.StartsWith() type of condition. But it seems like there has to be an easier way that I'm just not seeing. Any ideas would be much appreciated. Thanks!

    Read the article

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