Daily Archives

Articles indexed Friday April 30 2010

Page 23/114 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • what is value of x for load and store

    - by Kevinniceguy
    This is some challenge On a single processor system, in which load and store are assumed to be atomic, what are all the possible values for x after both threads have completed in the following execution, assuming that x is initialised to O? Hint: you need to consider how this code might be compiled into machine language. for (int i = 0; i < 5; i++) : x = x + 1; for (int j = 0; j < 5; j++) : x = x + 1;

    Read the article

  • SQL SERVER FOR XML SYNTAX

    - by Raj73
    How can I get an output as follows using FOR XML / sql query. I am not sure how I can get the Column Values as Elements instead of the tables' column Names. I am using sql server 2005 I HAVE TABLE SCEMA AS FOLLOWS CREATE TABLE PARENT ( PID INT, PNAME VARCHAR(20) ) CREATE TABLE CHILD ( PID INT, CID INT, CNAME VARCHAR(20) ) CREATE TABLE CHILDVALUE ( CID INT, CVALUE VARCHAR(20) ) INSERT INTO PARENT VALUES (1, 'SALES1') INSERT INTO PARENT VALUES (2, 'SALES2') INSERT INTO CHILD VALUES (1, 1, 'FOR01') INSERT INTO CHILD VALUES (1, 2, 'FOR02') INSERT INTO CHILD VALUES (2, 3, 'FOR03') INSERT INTO CHILD VALUES (2, 4, 'FOR04') INSERT INTO CHILDVALUE VALUES (1, '250000') INSERT INTO CHILDVALUE VALUES (2, '400000') INSERT INTO CHILDVALUE VALUES (3, '500000') INSERT INTO CHILDVALUE VALUES (4, '800000') The Output I am looking for is as follows <SALE1> <FOR01>250000</FOR01> <FOR02>400000</FOR02> </SALE1> <SALE2> <FOR03>500000</FOR03> <FOR04>800000</FOR04> </SALE2>

    Read the article

  • AVAudioPlayer crash after playing from an AVAudioRecorder

    - by munchine
    I've got a button the user tap to start recording and tap again to stop. When it stop I want the recorded voice 'echo' back so the user can hear what was recorded. This works fine the first time. If I hit the button for the third time, it starts a new recording and when I hit stop it crashes with EXC_BAD_ACCESS. - (IBAction) readToMeTapped { if(recording) { recording = NO; [readToMeButton setTitle:@"Stop Recording" forState: UIControlStateNormal ]; NSMutableDictionary *recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithFloat: 44100.0], AVSampleRateKey, [NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, [NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey, nil]; // Create a new dated file NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0]; NSString *caldate = [now description]; recordedTmpFile = [NSURL fileURLWithPath:[[NSString stringWithFormat:@"%@/%@.caf", DOCUMENTS_FOLDER, caldate] retain]]; error = nil; recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error]; [recordSetting release]; if(!recorder){ NSLog(@"recorder: %@ %d %@", [error domain], [error code], [[error userInfo] description]); UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Warning" message: [error localizedDescription] delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; return; } NSLog(@"Using File called: %@",recordedTmpFile); //Setup the recorder to use this file and record to it. [recorder setDelegate:self]; [recorder prepareToRecord]; [recorder recordForDuration:(NSTimeInterval) 5]; //recording for a limited time } else { // it crashes the second time it gets here! recording = YES; NSLog(@"Recording YES Using File called: %@",recordedTmpFile); [readToMeButton setTitle:@"Start Recording" forState:UIControlStateNormal ]; [recorder stop]; //Stop the recorder. //playback recording AVAudioPlayer * newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:recordedTmpFile error:&error]; [recordedTmpFile release]; self.aPlayer = newPlayer; [newPlayer release]; [aPlayer setDelegate:self]; [aPlayer prepareToPlay]; [aPlayer play]; } } - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)sender successfully:(BOOL)flag { NSLog (@"audioRecorderDidFinishRecording:successfully:"); [recorder release]; recorder = nil; } Checking the debugger, it flags the error here @synthesize aPlayer, recorder; This is the part I don't understand. I thought it may have something to do with releasing memory but I've been careful. Have I missed something?

    Read the article

  • Get Properties from Member in Umbraco programmatically

    - by AyKarsi
    I thought this would be really simple but .. We've create a user and a member type with various properties When we try to access the properties via the member object we got nothing. //Member m is current User eg. Property s = m.getProperty("PreferdUserName"); is null m.getProperties has a count of Zero.. have we missed something obvious?

    Read the article

  • ActiveRecord bug? Or am I getting it wrong? (validates_presence_of if)

    - by Dmitriy Likhten
    Ok: User attr_accessible :name, :email, :email_confirmation validates_presence_of :email_confirmation if :email_changed? What happens in the following situation: u = User.find 1 u.name = 'Fonzi' u.name_changed? # => true u.email_changed? # => false u.valid? # => false : email_confirmation is required Basically, if I change if to unless the validates works as expected, won't validate if the email has not changed, will validate if the email changed. I thought the IF indicates "run this validation if the following function returns true. Seems to work backwards!? Am I just getting it wrong?

    Read the article

  • lucene index missing files

    - by Akhil
    I have _0.cfs file of a lucene index directory but segments.gen and segments_2 are missing. Can I generate the segments.gen and segments_2 files without having to regenerate the _0.cfs file. Does these "segments" files contain any index specific data, which will thus force me to regnerate the entire index again. Or can I just generate the two "segments" file by copying these from another lucen index directory gnerated with the same lucene version.

    Read the article

  • File.open with ruby on windows with a unicode filename

    - by aussiegeek
    I have a script running on Ruby 1.9.1 on Windows 7 I've distilled my script down to File.open("????.txt") and still can't get it to work. I know there are issues with Ruby 1.9 filename handling on windows (Using the Windows ANSI library), but would be happy enough with a work around that is callable from Ruby

    Read the article

  • How do i simulate IIS6/ASP.net 4 settings on IIS7?

    - by Jack
    I have a Windows2k3/IIS6 server but at home i'm using Windows7/IIS7 pc. I just installed VS2010 and trying out the new Web form. After i setup a application in IIS7, I set the Application Pool to ASP.net v4.0 Classic thinking this is the correct setting to simulate IIS6 but when I browse to the website. I got HTTP Error 404.2 Not found but if i set the application pool settings to ASP.net v4.0 then everything run fine. Does anyone know how to simulate IIS6 with ASP.net 4 on Windows7/IIS7/ASP.net 4?

    Read the article

  • Modify Emdeded String in C# compiled exe

    - by nitefrog
    I have an issue where I need to be able to have a compiled exe ( .net 3.5 c# ) that I will make copies of to distribute that will need to change a key for example before the exe is sent out. I cannot compile each time a new exe is needed. This is a thin client that will be used as part of a registration process. Is it possible to add a entry to a resource file with a blank value then when a request comes in have another application grab the blank default thin client, copy it, populate the blank value with the data needed. If yes how? If no do you have any ideas? I have been scratching my head for a few days now and the limitation as due to the boundaries I am required to work in. The other idea I has was to inject the value into a method, which I have no idea how I would even attempt that. Thanks.

    Read the article

  • How to use Datasource to fetch some value that has been filled in it.

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • OCR Web Service

    - by sdfx
    I am searching for an OCR web service (eventually open source, preferably free) that simply receives an image and returns the text of the image in writing. I've looked at tesseract, OCRopus and GOCR but the only open server I could find is WeOCR. Unfortunately the detection rates (at least during my tests) are sub-par and the speed is not much better. Does anyone have any experience with OCR web services? I guess the license of tesseract allows the operation of such a service, are there any out there?

    Read the article

  • Creating an Equation Editor 3.0 equation in a Word 2003 document using a marco (or through the API)

    - by Sambatyon
    I think the title is fully descriptive now. Anyway, I need to generate a word document from my delphi application. It needs to choose from one of four different equations (with some specific parameters for each document). So far I have manage to create the whole document programmatically except the equation. Is it possible to create equations programmatically? if so, where is de API documentation from MS? if not, which solution can be used?

    Read the article

  • How to auto-sync Header in Visual Studio ?

    - by fk2
    Do you know if there is a build-in feature or free add-in for Microsoft Visual Studio 2008 that easily generates C-Headers and keeps them in sync with their .c counterparts? I have already looked at Visual Assist X, but I'm not really willing to pay money at the moment.

    Read the article

  • Set Image Src to Local File

    - by cmessier
    I am writing a Firefox extension and would like the users to be able to change an image on a web page with a local image. Is it possible, using JavaScript, to change the image source with an image that is saved on the user's local machine? Let me know if you need more information. Thanks

    Read the article

  • SmallestDotNet as CustomAction after MSI installation

    - by Kai
    Is there anything to be said againt installing SmallestDotNet 3.5 (http://www.hanselman.com/blog/SmallestDotNetOnTheSizeOfTheNETFramework.aspx) as a CustomAction after MSI installation to ensure that .NET 3.5 is installed? I've found many more complicated ways which (partly) include .NET framework into the installer. How would you install (if necessary) the .NET 3.5 framework after msi installation automatically?

    Read the article

  • Text Gradient whith sIFR 3

    - by andreeib
    Hi, I want to use sIFR 3 to add a simple linear gradient filter to a text, I can't find this in the ducumentation hope you guys can give me some help. I found an article that show's how to do this but requiers the modification of the flash file and that's not what I want to do. I looked in the sIFR documentaion and I didn't found a Gradient filter, I hope this effect can be made simple using the sIFR filters. Thank's

    Read the article

  • Scalability of Ruby on Rails versus PHP

    - by Daniel
    Can anyone comment on which is more scalable between RoR and PHP? I have heard that RoR is less scalable than PHP since RoR has a little more overhead with its MVC framework while PHP is more low level and lighter. This is a bit vague - can anyone explain better?

    Read the article

  • How to return a dynamic value from a Mocha mock in Ruby

    - by Vivek
    The gist of my problem is as follows:- I'm writing a Mocha mock in Ruby for the method represented as "post_to_embassy" below. It is not really our concern, for the purpose of describing the problem, what the actual method does. But I need the mock to return a dynamic value. The proc '&prc' below is executing rightly in place of the actual method. But the "with" method in Mocha only allows for boolean values to be returned. So the code below outputs nil. I need it to output the value being passed through orderInfoXml. Does anyone know of an alternate method I can use? require 'rubygems' require 'mocha' include Mocha::API class EmbassyInterface def post_to_embassy(xml) puts "This is from the original class:-" puts xml return xml end end orderInfoXml = "I am THE XML" mock = EmbassyInterface.new prc = Proc.new do |orderXml| puts "This is from the mocked proc:-" puts orderXml orderXml end mock.stubs(:post_to_embassy).with(&prc) mock_result = mock.post_to_embassy(orderInfoXml) p mock_result #p prc.call("asd") output:- This is from the mocked proc:- I am THE XML nil

    Read the article

  • Monitor the Weather from Your Windows 7 Taskbar

    - by Asian Angel
    Keeping up with the weather forecast can be hard when you are extra busy with work. If you need a simple but nice looking way to integrate weather monitoring into your Taskbar then join us as we look at WeatherBar. Setting Up & Using WeatherBar To get started unzip the following files, place them in an appropriate “Program Files Folder”, and create a shortcut. When you start WeatherBar for the first time you will be presented with the following window and a random/default location. To get WeatherBar set up for your location there are only two settings to adjust (using the “Pencil & Gear Buttons”). Clicking on the “Pencil Button” will open up this small window…enter the name of your location and click “OK”. Next click on the “Gear Button” where you can choose the “Update Interval” and “Measurement Format” that best suits your needs. Click “OK” when finished and WeatherBar will be ready to go. That definitely looks nice. When you are finished viewing this window minimize it to the “Taskbar Icon” instead of clicking on the “Close Button”…otherwise the entire app will close. Left click on the “Taskbar Icon” to bring the window back up… Hovering the mouse over the “Taskbar Icon” provides a nice thumbnail of the weather forecast. Right clicking on the “Taskbar Icon” will display a nice mini forecast. Conclusion While WeatherBar may not be for everyone it does provide a nice easy way to monitor the weather from your “Taskbar” without taking up a lot of room. Links Download WeatherBar Similar Articles Productive Geek Tips Monitor the Weather for Your Location in ChromeCheck Weather Conditions in Real-time with Weather WatcherMonitor CPU, Memory, and Disk IO In Windows 7 with Taskbar MetersTaskbar Eliminator Does What the Name Implies: Hides Your Windows TaskbarBring Misplaced Off-Screen Windows Back to Your Desktop (Keyboard Trick) TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Home Networks – How do they look like & the problems they cause Check Your IMAP Mail Offline In Thunderbird Follow Finder Finds You Twitter Users To Follow Combine MP3 Files Easily QuicklyCode Provides Cheatsheets & Other Programming Stuff Download Free MP3s from Amazon

    Read the article

  • A Perspective on Database Performance Tuning

    Fundamentally, database performance tuning is done for two basic reasons, to reduce response time and to reduce resource usage, both of which can apply for any given situation. Julian Stuhler looks at database performance tuning, and why it remains one of the most important topics for any DBA, developer or systems administrator.

    Read the article

  • How to wait for ajax validation to complete before submitting a form?

    - by Jung
    Having a problem where the form submits before the validateUsername function has a chance to complete the username check on the server-side. How do I submit the form only after the validateUsername function completes? Hope this is clear... form.submit(function(){ if (validateUsername() & validateEmail() & validatePassword()) { return true; } else { return false; } }); function validateUsername(){ usernameInfo.addClass("sign_up_drill"); usernameInfo.text("checking..."); var b = username.val(); var filter = /^[a-zA-Z0-9_]+$/; $.post("../username_check.php",{su_username:username.val()},function(data) { if (data=='yes') { username.addClass("error"); usernameInfo.text("sorry, that one's taken"); usernameInfo.addClass("error"); return false; } else if (!filter.test(b)) { username.addClass("error"); usernameInfo.text("no funny characters please"); usernameInfo.addClass("error"); return false; } else { username.removeClass("error"); usernameInfo.text("ok"); usernameInfo.removeClass("error"); return true; } }); }

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >