Daily Archives

Articles indexed Saturday May 29 2010

Page 6/76 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Limit Output in C

    - by Tech163
    In C, I would like to limit the string to the first 8 characters. For example, I have: char out = printf("%c", str); How can I make it so it only returns the first 8 characters?

    Read the article

  • NSPredicate error/behaving differently on 10.5 vs 10.6

    - by Tristan
    I am using a NSPredicate to determine if an entered email address is valid. On 10.6 it works perfectly as expected. I recently decided to get my app going on 10.5 and this is the only thing that doesn't work. The error i get is as follows: "Can't do regex matching, reason: Can't open pattern U_MALFORMED_SET (string [email protected], pattern ([\w-+]+(?:\.[\w-+]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}), case 0, canon 0)" The code im using is as follows: NSString *regex = @"([\\w-+]+(?:\\.[\\w-+]+)*@(?:[\\w-]+\\.)+[a-zA-Z]{2,7})"; NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; if ([regextest evaluateWithObject:[userEmail objectValue]] == YES) Does anyone know why this isn't working on 10.5? And how I might get it working or be able to do this test in a way compatible for both 10.5 and 10.6?

    Read the article

  • A Laymans Explanation of The Derivatives Market and Crash

      This was passed on to me by a good friend, and I found the analogy so compelling that I decided to share it: Heidi is the proprietor of a bar in Detroit . She realizes that virtually all of her customers  are unemployed alcoholics and, as such, can no longer afford to patronize her bar. To solve this problem, she comes up with new marketing plan that allows her customers to drink now, but pay later. She keeps track of the drinks consumed on a ledger (thereby granting the customers...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Understanding ESXi and Memory Usage

    - by John
    Hi, I am currently testing VMWare ESXi on a test machine. My host machine has 4gigs of ram. I have three guests and each is assigned a memory limit of 1 GB (and only 512 MB reserved). The host summary screen shows a memory capacity of 4082.55 MB and a usage of 2828 MB with two guests running. This seems to make sense, two gigs for each VM plus an overhead for the host. 800MB seems high but that is still reasonable. But on the Resource Allocation Screen I see a memory capacity of 2356 MB and an available capacity of 596 MB. Under the configuration tab, memory link I see a physical total of 4082.5 MB, System of 531.5 MB and VM of 3551.0 MB. I have only allocated my VMs for a gig each, and with two VMs running they are taking up almost two times the amount of ram allocated. Why is this, and why does the Resource Allocation screen short change me so much?

    Read the article

  • Darwin Streaming Server VOD playlist?

    - by StackedCrooked
    I have a large MPEG4 file split up into a number of smaller files. I would like to make these files available as one movie. So I need something like a playlist. It seems the playlist option for live streaming is not available for VOD. Is there a way to get this functionality somehow?

    Read the article

  • How to configure a Linux kernel based on the modules currently in use?

    - by Carla
    Hello, I'm willing to build a minimal kernel with only the needed things for my machine; so I started by compiling the kernel from the ground up, using the default configuration and adding things that I know for sure I have (i.e.: Ethernet card, WiFi card, ...). But there are several other things not so easy to know about (i.e.: the watchdog timer) so I came across AutoKernConf which supposedly detects the hardware of the machine and generates a kernel configuration file with the settings for the found devices. The problem is it contained several settings repeated and even some which I don't have (I'm using a Dell laptop and one of the things it "found" was something of a Toshiba one). So I ended up building a kernel with the configuration that came out of the make allmodconfig command, which is a kernel with most of the things compiled as modules. Booting into that kernel and running lsmod I can see all of the kernel modules in use (the ones really needed) and I would like to know if there is a tool or some way for me to parse that list and convert it to the corresponding kernel configuration file. Or how to map each one with the appropriate options in the kernel so that I can manually set them. Thank you very much for your time.

    Read the article

  • Simulating aspects of static-typing in a duck-typed language

    - by Mike
    In my current job I'm building a suite of Perl scripts that depend heavily on objects. (using Perl's bless() on a Hash to get as close to OO as possible) Now, for lack of a better way of putting this, most programmers at my company aren't very smart. Worse, they don't like reading documentation and seem to have a problem understanding other people's code. Cowboy coding is the game here. Whenever they encounter a problem and try to fix it, they come up with a horrendous solution that actually solves nothing and usually makes it worse. This results in me, frankly, not trusting them with code written in duck typed language. As an example, I see too many problems with them not getting an explicit error for misusing objects. For instance, if type A has member foo, and they do something like, instance->goo, they aren't going to see the problem immediately. It will return a null/undefined value, and they will probably waste an hour finding the cause. Then end up changing something else because they didn't properly identify the original problem. So I'm brainstorming for a way to keep my scripting language (its rapid development is an advantage) but give an explicit error message when an an object isn't used properly. I realize that since there isn't a compile stage or static typing, the error will have to be at run time. I'm fine with this, so long as the user gets a very explicit notice saying "this object doesn't have X" As part of my solution, I don't want it to be required that they check if a method/variable exists before trying to use it. Even though my work is in Perl, I think this can be language agnostic.

    Read the article

  • using php and java script in a form

    - by Gal Miller
    I am a little bit lost. What I want to achieve is: my own custom button change onMouseOver etc' keep it's size post the information to a php server side code What I'm missing is: The post - I couldn't figure out how to combine js & php The Button size - my code sets a size for the original button but after the rollover it changes The code: <html> <head> </head> <body> <script> function form_on_click(frm) { document.buttonMore.src='bottom_more_click.JPG'; frm.submit(); } </script> <div style="position: absolute; left: 120px; top: 90px; background-image: url(myBackgroundPicture.jpg); background-repeat:no-repeat; width: 800px; height: 280px; padding: 15px;"> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="whatever" size= "55" height="100" lang="en" dir="ltr" style="margin-top: 188px; margin-left: 95px; height: 20px; background-color: transparent; border:none; color: #FFFFFF; font-family: Verdana; font-weight: none; font-size: 18px;"> <a onmouseover="document.buttonMore.src='bottom_more_hover.JPG'" onmouseout="document.buttonMore.src='bottom_more_reg.JPG'" onmousedown= "form_on_click(this.form) this.form.submit()" onmouseup="document.buttonMore.src='bottom_more_hover.JPG'"> <img src="bottom_more_reg.jpg" name="buttonMore" height="30" width="173" border="0" alt="MORE!" style="margin-bottom:-10px; margin-left: 15px; height: 30px; width: 100px;"> </a> </form> </div> </body>

    Read the article

  • Strengths and weaknesses of JIT compilers for Python

    - by Az
    Hi there, I'm currently aware of the following Python JIT compilers: Psyco, PyPy and Unladen Swallow. Basically, I'd like to ask for your personal experiences on the strengths and weaknesses of these compilers - and if there are any others worth looking into. Thanks in advance, Az

    Read the article

  • use AMF instead of JSON on iPhone?

    - by Henry
    Although iPhone support JSON natively, AMF is a binary protocol and it supposes to use much less bandwidth. Do you think using AMF is a good idea? Just found this AMF library in cocoa (Objective-C): http://github.com/nesium/cocoa-amf/

    Read the article

  • Access one database from multiple ORMs :: Caching issue

    - by kaptan
    I know this is not a good idea and the best would be to let the applications talk Web Services. But I have a situation where the legacy application is accessing a database with an ORM and I need to access the same database from the new .net application using Fluent nHibernate. So the question is what problems this will make and how to solve them? I guess the main issue is the caching. I need to disable the caching on one of the applications (which would be the new app). So how can I disable caching in nHibernate? Is there anything else that should be careful about?

    Read the article

  • how subsonic SP should return a value

    - by android.sm
    Hi all, I'm very much new to SubSonic and need a little guidance. Here, I want to know how my SP should return a value. Currently, when I execute it I simply pass an Int and it returns me a string value. Here is code: SubSonic SP: public static StoredProcedure GetQuote(int? CategoryId) { StoredProcedure sp = new StoredProcedure("GetQuote", DataService.GetInstance("Quotes Provider"), "dbo"); sp.Command.AddParameter("@CategoryId", CategoryId, DbType.Int32, 0, 10); return sp; } My Code: public bool GetQuote(int category, out string quote) { bool val = false; quote = ""; try { StoredProcedure sp = SPs.GetQuote(category); if (sp != null) { sp.Execute(); val = true; } } catch (Exception err) { throw err; } return val; } Thanks all

    Read the article

  • prevent _doPostBack getting rendered in button markup

    - by Christo Fur
    Hi Is it possible to prevent the _doPostBack() call getting rendered on a button? I would like add some custom logic prior to calling the postback. I have added an onClick event to the button e.g. <button id="manualSubmit" runat="server" class="manual-submit" onclick="$('#jeweller-form').hide();" /> However, this just gets rendered inline before the _doPostBack() But the postback gets fired before the jQueryHide takes place I would like to call my own JS function then manually trigger the postback any ideas?

    Read the article

  • Embedding Facebook Connect In A Facebook Page

    - by Russell C.
    Our site allows users to register using Facebook Connect. We also have a Facebook page. We'd like to include the "Connect with Facebook" button in our page so a user could instantly connect (aka register) and then be forwarded on to their account on our site. I was hoping to use the Static FBML page application and the FBML iFrame tag to simply embed the button but it looks like the iFrame tag isn't allowed in Facebook pages. Facebook Connect uses JavaScript so I'm wondering if there is some kind of trick I could use like popping up a page in a new window that would automatically display the connect dialog box. Any ideas on how I would include a Facebook Connect button on our Facebook page would awesome! Thanks in advance for your help.

    Read the article

  • Apache HttpClient 4.0. Weird behavior.

    - by Mikhail T
    Hello. I'm using Apache HttpClient 4.0 for my web crawler. The behavior i found strange is: i'm trying to get page via HTTP GET method and getting response about 404 HTTP error. But if i try to get that page using browser it's done successfully. Details: 1. I upload multipart form to server this way: HttpPost httpPost = new HttpPost("http://[host here]/in.php"); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("method", new StringBody("post")); entity.addPart("key", new StringBody("223fwe0923fjf23")); FileBody fileBody = new FileBody(new File("photo.jpg"), "image/jpeg"); entity.addPart("file", fileBody); httpPost.setEntity(entity); HttpResponse response = httpClient.execute(httpPost); HttpEntity result = response.getEntity(); String responseString = ""; if (result != null) { InputStream inputStream = result.getContent(); byte[] buffer = new byte[1024]; while(inputStream.read(buffer) > 0) responseString += new String(buffer); result.consumeContent(); } Uppload succefully ends. I'm getting some results from web server: HttpGet httpGet = new HttpGet("http://[host here]/res.php?key="+myKey+"&action=get&id="+id); HttpResponse response = httpClient.execute(httpGet); HttpEntity entity = response.getEntity(); I'm getting ClientProtocolException while execute method run. I was debugging this situation with log4j. Server answers "404 Not Found". But my browser loads me that page with no problem. Can anybody help me? Thank you.

    Read the article

  • question about class derivation in c++?

    - by jack22
    hi, i want to know some things about class derivation in c++ so i have super class x and an inherited class y and i did this class x{ public:a; private:b; protected:c; } class y:public x{ public:d; } in this case how y can access a,b,and c and by how i mean(public,protected,private) the second case: class x{ public:a; private:b; protected:c; } class y:private x{ public:d; } the same question? the third case: class x{ public:a; private:b; protected:c; } class y:private x{ public:d; } again the same question? sorry i think i wrote too much bye

    Read the article

  • who wrote 250k unit tests for webkit?

    - by amwinter
    assuming a yield of 3 per hour, that's 83000 hours. 8 hours a day makes 10,500 days, divide by thirty to get 342 mythical man months. I call them mythical because writing 125 tests per person per week is unreal. can any wise soul out there on SO shed some light on what sort of mythical men write unreal quantities of tests for large software projects? thank you.

    Read the article

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