Daily Archives

Articles indexed Sunday December 26 2010

Page 16/23 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • why does it use the movl instead of push ?!

    - by user554403
    hi all. pay attention to this code : #include <stdio.h> void a(int a, int b, int c) { char buffer1[5]; char buffer2[10]; } int main() { a(1,2,3); } after that : gcc -S a.c that command shows our source code in assembly. now we can see in the main function, we never use "push" command to push the arguments of the a function into the stack. and it used "movel" instead of that main: pushl %ebp movl %esp, %ebp andl $-16, %esp subl $16, %esp movl $3, 8(%esp) movl $2, 4(%esp) movl $1, (%esp) call a leave why does it happen? what's difference between them?

    Read the article

  • Delphi's "Object TreeView" equivalent in Visual Studio 2010

    - by user327359
    I'm just getting started in Visual Studio 2010 and I'm coming from Delphi 7. In Visual Studio 2010, what is the equivalent to Delphi's Object TreeView? Or to ask it another way, in Visual Studio 2010, during WinForm Gui development, how do you navigate your Gui hierarchically? If I have, say, a bunch of Panels with some of them inside of others and some Docked to Client, how can I directly select a specific Panel?

    Read the article

  • How can I add imports to an "eval"ed piece of clojure code?

    - by Zubair
    I would like to evaluate some clojure code entered by users interactively, and I would like to "use" certain namespaces and "import" certain Java classes as well. I end up running the code using: (defn execute-command [string-command] let [ code-with-context (add-code-context string-command) result (eval(read-string code-with-context)) ] result ) My question is how can I program "add-code-context" to add the required context to the code in "string-command"?

    Read the article

  • MVC Display Template for Generic Type

    - by Kyle
    I am trying to use the model ListModel as a generic list model. I would like to enter on the page @Html.DisplayForModel() However the MVC is not correctly finding the templated file "ListModel.cshtml". It must work differently for generic models. What should I name the templated file in order for it to correctly be located? public class ListModel<T> { public IEnumerable<T> Models {get;set;} public string NextPage {get;set;} } I would expect it to look for "Shared/DisplayTemplates/ListModel.ascx" but it doesn't. Does anyone know?

    Read the article

  • Basic data alignment question

    - by Broken Logic
    I've been playing around to see how my computer works under the hood. What I'm interested in is seeing is what happens on the stack inside a function. To do this I've written the following toy program: #include <stdio.h> void __cdecl Test1(char a, unsigned long long b, char c) { char c1; unsigned long long b1; char a1; c1 = 'b'; b1 = 4; a1 = 'r'; printf("%d %d - %d - %d %d Total: %d\n", (long)&b1 - (long)&a1, (long)&c1 - (long)&b1, (long)&a - (long)&c1, (long)&b - (long)&a, (long)&c - (long)&b, (long)&c - (long)&a1 ); }; struct TestStruct { char a; unsigned long long b; char c; }; void __cdecl Test2(char a, unsigned long long b, char c) { TestStruct locals; locals.a = 'b'; locals.b = 4; locals.c = 'r'; printf("%d %d - %d - %d %d Total: %d\n", (long)&locals.b - (long)&locals.a, (long)&locals.c - (long)&locals.b, (long)&a - (long)&locals.c, (long)&b - (long)&a, (long)&c - (long)&b, (long)&c - (long)&locals.a ); }; int main() { Test1('f', 0, 'o'); Test2('f', 0, 'o'); return 0; } And this spits out the following: 9 19 - 13 - 4 8 Total: 53 8 8 - 24 - 4 8 Total: 52 The function args are well behaved but as the calling convention is specified, I'd expect this. But the local variables are a bit wonky. My question is, why wouldn't these be the same? The second call seems to produce a more compact and better aligned stack. Looking at the ASM is unenlightening (at least to me), as the variable addresses are still aliased there. So I guess this is really a question about the assembler itself allocates the stack to local variables. I realise that any specific answer is likely to be platform specific. I'm more interested in a general explanation unless this quirk really is platform specific. For the record though, I'm compiling with VS2010 on a 64bit Intel machine.

    Read the article

  • Is there a way for -webkit-animtion-timing-function to apply to the entire animation instead of each keyframe?

    - by Ken Sykora
    I'm a bit new to animation, so forgive me if I'm missing a huge concept here. I need to animate an arrow that is pointing to a point on a curve, let's just say it's a cubic curve for the sake of this post. The arrow moves along the curve's line, always pointing a few pixels below it. So what I did, is I setup keyframes along the curve's line using CSS3: @-webkit-keyframes ftch { 0% { opacity: 0; left: -10px; bottom: 12px; } 25% { opacity: 0.25; left: 56.5px; bottom: -7px; } 50% { opacity: 0.5; left: 143px; bottom: -20px; } 75% { opacity: 0.75; left: 209.5px; bottom: -24.5px; } 100% { opacity: 1; left: 266px; bottom: -26px; } } However, when I run this animation using -webkit-animation-timing-function: ease-in, it applies that easing to each individual keyframe, which is definitely not what I want. I want the easing to apply to the entire animation. Is there a different way that I should be doing this? Is there some property to apply the easing to the entire sequence rather than each keyframe?

    Read the article

  • WCF events in server-side

    - by Eisenrich
    Hi all, I'm working on an application in WCF and want to receive events in the server side. I have a web that upon request needs to register a fingerprint. The web page request the connection of the device and then every second for 15 seconds requests the answer. The server-side code is apparently "simple" but doesn't work. Here is it: [ServiceContract] interface IEEtest { [OperationContract] void EEDirectConnect(); } class EETest : IEEtest { public void EEDirectConnect() { CZ ee = new CZ(); // initiates the device dll ee.Connect_Net("192.168.1.200", 4011); ee.OnFinger += new _IEEEvents_OnFingerEventHandler(ee_OnFinger); } public void ee_OnFinger() { //here i have a breakpoint; } } every time I put my finger, it should fire the event. in fact if I static void Main() { EETest pp = new EETest(); pp.EEDirectConnect(); } It works fine. but from my proxy it doesn't fire the event. do you have any tips, recommendations, or can you see the error? Thanks everyone.

    Read the article

  • File Output using Gforth

    - by sheepez
    As a first project I have been writing a short program to render the Mandelbrot fractal. I have got to the point of trying to output my results to a file ( e.g. .bmp or .ppm ) and got stuck. I have not really found any examples of exactly what I am trying to do, but I have found two examples of code to copy from one file to another. The examples in the Gforth documentation ( Section 3.27 ) did not work for me ( winXP ) in fact they seemed to open and create files but not write to files properly. This is the Gforth documentation example that copies the contents of one file to another: 0 Value fd-in 0 Value fd-out : open-input ( addr u -- ) r/o open-file throw to fd-in ; : open-output ( addr u -- ) w/o create-file throw to fd-out ; s" foo.in" open-input s" foo.out" open-output : copy-file ( -- ) begin line-buffer max-line fd-in read-line throw while line-buffer swap fd-out write-line throw repeat ; I found this example ( http://rosettacode.org/wiki/File_IO#Forth ) which does work. The main problem is that I can't isolate the part that writes to a file and have it still work. The main confusion is that r doesn't seem to consume TOS as I might expect. : copy-file2 ( a1 n1 a2 n2 -- ) r/o open-file throw >r w/o create-file throw r> begin pad maxstring 2 pick read-file throw ?dup while pad swap 3 pick write-file throw repeat close-file throw close-file throw ; \ Invoke it like this: s" output.txt" s" input.txt" copy-file I would be very grateful if someone could explain exactly how the open, create read and write -file words actually work, as my investigation keeps resulting in somewhat bizarre stacks. Any clues as to why the Gforth examples do not work might help too. In summary, I want to output from Gforth to a file and so far have been thwarted. Can anyone offer any help? Thank you Vijay, I think that I understand the example that you gave. However when I try to use something like this ( which I think is similar ): 0 value test-file : write-test s" testfile.out" w/o create-file throw to test-file s" test text" test-file write-line ; I get ok but nothing is put into the file, have I made a mistake? It seems that the problem was due to not flushing the relevant buffers or explicitly closing the file. Adding something like test-file flush-file throw or test-file close-file throw between write-line and ; makes it work. Thanks again Vijay for helping.

    Read the article

  • Writing to pointer out of bounds after malloc() not causing error

    - by marr
    Hi, when I try the code below it works fine. Am I missing something? main() { int *p; p=malloc(sizeof(int)); printf("size of p=%d\n",sizeof(p)); p[500]=999999; printf("p[0]=%d",p[500]); return 0; } I tried it with malloc(0*sizeof(int)) or anything but it works just fine. The program only crashes when I don't use malloc at all. So even if I allocate 0 memory for the array p, it still stores values properly. So why am I even bothering with malloc then?

    Read the article

  • Memory Management with returning char* function

    - by RageD
    Hello all, Today, without much thought, I wrote a simple function return to a char* based on a switch statement of given enum values. This, however, made me wonder how I could release that memory. What I did was something like this: char* func() { char* retval = new char; // Switch blah blah - will always return some value other than NULL since default: return retval; } I apologize if this is a naive question, but what is the best way to release the memory seeing as I cannot delete the memory after the return and, obviously, if I delete it before, I won't have a returned value. What I was thinking as a viable solution was something like this void func(char*& in) { // blah blah switch make it do something } int main() { char* val = new char; func(val); // Do whatever with func (normally func within a data structure with specific enum set so could run multiple times to change output) val = NULL; delete val; val = NULL; return 0; } Would anyone have anymore insight on this and/or explanation on which to use? Regards, Dennis M.

    Read the article

  • How can one restrict network activity to only the VPN on a Mac and prevent unsecured internet activity?

    - by John
    I'm using Mac OS and connect to a VPN to hide my location and IP (I have the 'send all traffic over VPN connection' box checked in teh Network system pref), I wish to remain anonymous and do not wish to reveal my actual IP, hence the VPN. I have a prefpan called pearportVPN that automatically connects me to my VPN when I get online. The problem is, when I connect to the internet using Airport (or other means) I have a few seconds of unsecured internet connection before my Mac logs onto my VPN. Therefore its only a matter of time before I inadvertently expose my real IP address in the few seconds it takes between when I connect to the internet and when I log onto my VPN. Is there any way I can block any traffic to and from my Mac that does not go through my VPN, so that nothing can connect unless I'm logged onto my VPN? I suspect I would need to find a third party app that would block all traffic except through the Server Address, perhaps Intego Virus Barrier X6 or little snitch, but I'm afraid I'm not sure which is right or how to configure them. Any help would be much appreciated. Thanks!

    Read the article

  • Magento Community - Hosting :: Need Advice which sharing hosting will run magento fast

    - by user43353
    Hi, Need Advice which sharing hosting will run Magento Community fast or some other not expensive solution. This website will not have a lot of users, I only need that it will run fast for 100-20 users in same time. The problem with magento is database design that make this system very slow , also other staff not the best. I had hostmonster.com and justhost.com for previous website but it wasn't fast enough for single user that not located in USA (my customer areas: Asia, Africa). each action that involve database takes a lot of time. Thanks

    Read the article

  • Registry Cleaner, useful or not

    - by garybo
    Hi, I’m constantly seeing Ad’s about Registry Cleaning. Each time I see one of those Ad’s I remember reading an article (don’t remember who wrote it, but it was posted on one of those geek chat pages) a few years ago about it not being necessary to clean a registry, in fact, the article continued, it and said sometimes it causes more harm than good to run a registry cleaner. I would like to hear your opinion about this, and if you think it is good to use one of these programs, could you recommend a few. Thanks in advance. garybo

    Read the article

  • Cannot bind OSX to AD

    - by erotsppa
    I'm trying to get an mac mini running snow leopard server to join a windows domain here. The windows domain server is running Windows server 2008. When I go to "Accounts" in my System Preferences, and lick on "Join", I get this error: "Unable to add server. Node name wasn't found. (2000)" In my console messages I find this: 10-04-06 11:42:25 AM System Preferences1452 -[ODCAddServerSheetController handleOtherActionError: gotError: Error Domain=com.apple.OpenDirectory Code=2000 UserInfo=0x2004f2f80 "Custom call 82 to Active Directory failed.", Node name wasn't found. I specified a FQDN for the domain server, so I am totally confused as to why it would list "domain = com.apple...." in that error. I've tried firing up the Directory Utility and trying to join a domain via the Active Directory option there. Again I fill in the FQDN, and the proper administrator/password acount info. Now I get a different error: "Invalid Domain An invalid Domain and Forest combination was specified. You should enter a fully qualified DNS name for the domain and forest (e.g., ads.company.com)." If anyone has any pointers or suggestions this would be appreciated.

    Read the article

  • Looking for Ubuntu 10.10 driver for GeForce GT 425M GPU.

    - by Fantomas
    It came with my Sony VAIO® VPCF133FX/H 16.4" Notebook. Ubuntu does suggest an NVIDIA driver for me, but when I install it, I cannot boot back in normally. I have to boot into a failsafe mode, then reset graphics setting to default, and reboot again. Right now I am stuck in 800 x 600 mode, but I would like to do better, and take advantage of my 1GB graphics memory :(. Please let me know if you have questions.

    Read the article

  • HFS partition mounting read-only

    - by Sid
    Hey, I have an external Western Digital Hard drive with two HFS partitions with journaling disabled. When I connect it to a computer running Linux (Debian or Ubuntu), frequently both partitions are mounted read-only. In the past, mounting them on my Macbook and executing the command to disable the journaling often worked (even though it would tell me that journaling was already disabled) but I would love to have a solution which works every time. Thanks! Edit: In light of Chris Johnsen's comment below - my question is how to mount the filesystem read+write on Linux since it is not automatically doing so itself

    Read the article

  • iPod Nano 5th gen Album Artwork

    - by Wesley Caretto
    I am an album artwork fan. I just got all of these brand new alternate artwork covers for my albums and singles. Eventually, i got bored of them, and i wanted the original ones back. So i got on iTunes, and changed the original album covers to the primary covers. I synced my ipod, but it still showed the new covers on it, not the originals. I figured a temporary way to fix it, by deleting the new covers i got, making the originals the default. There has to be an easier way, though. p.s. this also works in vice-versa. I will add the new covers, but before i exit, i change the primary cover to the original. When i change it back to the new one, my iPod will still only show the original Thanks for helping!

    Read the article

  • Prevent Xbox users from editing Media Library

    - by Patrick
    I am trying to watch some videos stored on my desktop computer on the Xbox, but they are in a format that the Xbox cannot decode, so I have to stream them through Windows Media Center. However, as soon as I set up Media Center on the Xbox, anyone can go in and browse the directory structure on my desktop. I would like to "lock" the media library so that only I can add and delete folders from my desktop computer. Is it possible?

    Read the article

  • Tail the filename, not the file

    - by Craig Walker
    In UNIX (OS X BSD to be precise), I have a "tail -f" command on a log file. From time to time I want to delete this log file so I can more easily review it in my text editor. I delete the file, and then my program recreates it after new activity. However, my tail command (and anything else that was watching the old log file) doesn't update; it's still watching the old, deleted log file. I think I understand why this is (file names simply being pointers to blocks of file data). I'd like to know how I can work around this. Ideally, my tail command (and anything else I point to the file) would be able to read the data from the new file when the file name has been deleted and recreated. How would I do this?

    Read the article

  • Re-enabling audio on an iMac

    - by Warren Seine
    Hello guys, I know Super User is not a 'tech support' forum, so I will try to make it short: my computer's sound does not work anymore. I have asked for support on the Apple board but I feel a bit on my own. To summarize, the Sound Panel of my iMac does not display any outgoing channel (headphones or internal speakers). It does not work on Windows either. Contrary to what it may seem, I have the feeling that it is not a hardware issue (and that GarageBand is somehow interfering). If you have an idea to solve the problem, please share. Making it work again is a lost cause without sending it back to Apple, so the question I'm asking is: What is the best workaround (cheap Firewire sound card?) for getting my sound back? Thanks.

    Read the article

  • Generate or update a PDF to include an encrypted, hidden watermark?

    - by Dave Jarvis
    Background Using LaTeX to write a book. When a user purchases the book, the PDF will be generated automatically. Problem The PDF should have a watermark that includes the person's name and contact information. Question What software meets the following criteria: Applies encrypted, invisible watermarks to a PDF Open Source Platform independent (Linux, Windows) Fast (marks a 200 page PDF in under 1 second) Batch processing (exclusively command-line driven) Collusion-attack resistant Non-fragile (e.g., PDF - EPS - PDF still contains the watermark) Well documented (shows example usages) Ideas & Resources Some thoughts and findings: Natural language processing (NLP) watermarks. Apply steganography on a randomly selected image. http://openstego.sourceforge.net/cmdline.html The problem with NLP is that grammatical errors can be introduced. The problem with steganography is that the images are sourced from an image cache, and so recreating that cache with watermarked images will impart a delay when generating the PDF (I could just delete one image from the cache, but that's not an elegant solution). Thank you!

    Read the article

  • Specifying ASP.NET MVC attributes for auto-generated data models

    - by Lyubomyr Shaydariv
    Hello to everyone. I'm very new to ASP.NET MVC (as well as ASP.NET in general), and going to gain some knowledge for this technology, so I'm sorry I can ask some trivial questions. I have installed ASP.NET MVC 3 RC1 and I'm trying to do the following. Let's consider that I have a model that's completely auto-generated from a table using the "LINQ to SQL Classes" template in VS2010. The template generates 3 files (two .cs files and one .layout file respectively), and the generated partial class is expected to be used as an MVC model. Let's also consider, a single DB column, that's mapped into the model, may look like this: [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "VarChar(128)")] public string Name { get { return this._Name; } set { if ( (this._Name != value) ) { // ... generated stuff goes here } } } The ASP.NET MVC engine also provides a beautiful declarative way to specify some additional stuff, like RequiredAttribute, DisplayNameAttribute and other nice attributes. But since the mapped model is a purely auto-genereated model, I've realized that I should not change the model manually, and specify the fields like: [Required] [DisplayName("Project name")] [StringLength(128)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage = "_Name", DbType = "VarChar(128)")] public string Name { ... though this approach works perfectly... until I change the model in the DBML-designer removing the ASP.NET MVC attributes automatically. So, how do I specify ASP.NET MVC attributes for the DBML models and their fields safely? Thanks in advance, and Merry Christmas.

    Read the article

  • box stacking in graph theory

    - by mozhdeh
    Please help me find a good solution for this problem. We have n boxes with 3 dimensions. We can orient them and we want to put them on top of another to have a maximun height. We can put a box on top of an other box, if 2 dimensions (width and lenght) are lower than the dimensions of the box below. For exapmle we have 3 dimensions w*D*h, we can show it in to (h*d,d*h,w*d,d*W,h*w,w*h) please help me to solve it in graph theory.

    Read the article

  • How can i initialize an array without knowing it size?

    - by Sara
    I have a situation where i have to apply a criteria on an input array and reuturn another array as output which will have smaller size based upon the filtering criteria. Now problem is i do not know the size of filtered results, so i can not initialize the array with specific value. And i do not want it to be large size will null values because i am using array.length; later on. One way is to first loop the original input array and set a counter, and then make another loop with that counter length and initialize and fill this array[]. But is there anyway to do the job in just one loop?

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >