Daily Archives

Articles indexed Tuesday March 16 2010

Page 13/130 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Get a JQuery function to execute after and independently of onLoad

    - by lewicki
    Is is possible to execute a JQuery function by injecting it into the page? IT CAN'T be attached to the .ready function. The reason is that the user will be uploading an image via iframe. I need JCrop to execute after I display the uploaded image. echo "<script>$('#pictures_step1_right_bottom1', window.parent.document).html('<img id=\"cropbox\" src=\"../../box/" . 'THM' . $filenameAlt . '.jpg' . "\">');</script>"; echo "<script>jQuery(function(){jQuery('#cropbox').Jcrop();});</script>"; This is executed in the iframe that is processing the image. it then sends it to the main page. This does not work however. EDIT: Ended up running a timer: function checkPic() { if($('#cropbox1').length != 0) { jQuery(function() { jQuery('#cropbox1').Jcrop(); }); } timer(); // Check size again after 1 second } function timer(){ var myTimer = setTimeout('checkPic()', 3000); // Check size every 1 second}

    Read the article

  • How Have You Implemented Open Source Contributions At Your Company?

    - by Travis
    Ok guys, I know others have asked this question in a similar manner in the past, but I want to go beyond the theoretical and find out answers from people who have worked in an environment that relied heavily upon open source technology and never contributed anything back to the open source community, and was able to convince the boss / owner to contribute back to the open source community. I know alot of the standard answers, but I'm looking for some more practical information? What was the key argument, that changed the culture in your company, and how has it changed?

    Read the article

  • Memory management in ObjC/iPhone

    - by Manu
    Hi, I have question in memory management (objective C). There are two ideal scenario. ============================= scenario 1 ======================================== (void) funcA { MyObj *c = [otherObj getMyObject]; [c release]; } -(MyObj *) getMyObject //(this method is available in other OtherObj.m file) { MyObj *temp = [[MyObj alloc] init]; // do smothing here return temp; } ============================= scenario 2 ======================================== (void) funcA { MyObj *c = [otherObj getMyObject]; } -(MyObj *) getMyObject //(this method is available in other OtherObj.m file) { MyObj *temp = [[myObj alloc] init]; // do smothing here return [temp autorelease]; } myObj is holding huge chunk of data. In first scenario I am getting myObj(allocated) from other file so I have to release in my own method. (as per any C/C++ language library ,like strdup will return string duplicate which will realase later by developer not by strdup method). In second scenario I am getting myObj(allocated) from otherObj.m file so otherObj.m file is responsible to release that allocated memory(mean autorelease)? Is it right? Please let me know Which scenario is more efficient and valid as per apple memory guidelines. Please Please don't show me any document link. Thanks Manu

    Read the article

  • Problem with waveOutWrite and waveOutGetPosition deadlock

    - by MusiGenesis
    I'm working on an app that plays audio continuously using the waveOut... API from winmm.dll. The app uses "leapfrog" buffers, which are basically a bunch of arrays of samples that you dump into the audio queue. Windows plays them seamlessly in sequence, and as each buffer completes Windows calls a callback function. Inside this function, I load the next set of samples into the buffer, process them however, and then dump the buffer back into the audio queue. In this way, the audio plays indefinitely. For animation purposes, I'm trying to incorporate waveOutGetPosition into the application (since the "buffer done" callbacks are irregular enough to cause jerky animation). waveOutGetPosition returns the current position of playback, so it's hyper-precise. The problem is that in my application, making calls to waveOutGetPosition eventually causes the application to lock up - the sound stops and the call never returns. I've boiled things down to a simple app that demonstrates the problem. You can run the app here: http://www.musigenesis.com/SO/waveOut%20demo.exe If you just hear a tiny bit of piano over and over, it's working. It's just meant to demonstrate the problem. The source code for this project is here: http://www.musigenesis.com/SO/WaveOutDemo.zip The first button runs the app in leapfrog mode without making the calls to waveOutGetPosition. If you click this, the app will play forever without breaking (the X button will close it and shut it off). The second button starts the leapfrogger and also starts a forms timer that calls the waveOutGetPosition and displays the current position. Click this and the app will run for a short while and then lock up. On my laptop, it usually locks up in 15-30 seconds; at most it's taken a minute. I have no idea how to fix this, so any help or suggestions would be most welcome. I've found very few posts on this issue, but it seems that there is a potential deadlock, either from multiple calls to waveOutGetPosition or from calls to that and waveOutWrite that occur at the same time. It's possible that I'm calling this too frequently for the system to handle.

    Read the article

  • WCF Async callback setup for polled device

    - by Mark Pim
    I have a WCF service setup to control a USB fingerprint reader from our .Net applications. This works fine and I can ask it to enroll users and so on. The reader allows identification (it tells you that a particular user has presented their finger, as opposed to asking it to verify that a particular user's finger is present), but the device must be constantly polled while in identification mode for its status - when a user is detected the status changes. What I want is for an interested application to notify the service that it wants to know when a user is identified, and provide a callback that gets triggered when this happens. The WCF service will return immediately and spawn a thread in the background to continuously poll the device. This polling could go on for hours at a time if no one tries to log in. What's the best way to acheive this? My service contract is currently defined as follows: [ServiceContract (CallbackContract=typeof(IBiometricCallback))] public interface IBiometricWcfService { ... [OperationContract (IsOneWay = true)] void BeginIdentification(); ... } public interface IBiometricCallback { ... [OperationContract(IsOneWay = true)] void IdentificationFinished(int aUserId, string aMessage, bool aSuccess); ... } In my BeginIdentification() method can I easily spawn a worker thread to poll the device, or is it easier to make the WCF service asynchronous?

    Read the article

  • C++ cin questions

    - by Kim
    This seems to be weird: int main(int argc, char* argv[]) { cout << "function main() .." << '\n'; char ch = 0; double number_value=1.1; cin >> ch; cin.putback(ch); cin >> number_value; cout << "1 .. " << " " << cin.good() << " " << number_value << '\n'; cin >> number_value; cout << "2 .. " << " " << cin.good() << " " << number_value << '\n'; return 0; } If I input the following: 7a 1 I get the following: function main() .. 7a 1 1 .. 1 7 2 .. 0 0 I understand the: 1 .. 1 7 but why the variable number_value is 0. cin.good() shows failure so nothing would have read and the value in number_value from the previous assignment would remain. I expect the value of 7.

    Read the article

  • What are the suggested alternatives for Class<T>.isAssignableFrom(Class<?> cls)?

    - by Wing C. Chen
    Currently I am doing the profiling to a piece of code. During the profiling, I discovered that this very method call, Class<T>.isAssignableFrom(Class<?> cls) takes up to quite amount of the entire time. Because this is a method from reflection, it takes a lot of time compared to normal keywords or method calls. I am wondering if there are some good alternatives for this method calls?

    Read the article

  • Is it better to alloc/dealloc new UIBarButtonItems when toggling Edit/Done? Why?

    - by cambria
    Apple's documentation implies that for a UITableView editable with an "Edit/Done" button, you should create and destroy the button each time it's toggled. Here's a snippet of code "BonjourWeb" sample code project that does this: if (editing) { // Add the "done" button to the navigation bar UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAction:)]; self.navigationItem.leftBarButtonItem = doneButton; [doneButton release]; [self addAddButton:YES]; } else { if ([self.customs count]) { // Add the "edit" button to the navigation bar UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editAction:)]; self.navigationItem.leftBarButtonItem = editButton; [editButton release]; } Is this really better than just editing the title of the button? Is there some performance optimisation that I'm not seeing? Or is this just bad example source?

    Read the article

  • What is the equivalent of OnRender in Silverlight?

    - by John Weldon
    I'm working on porting an app from WPF to Silverlight. The app uses custom types derived from FrameworkElement (in WPF) to describe shapes, and text to be rendered on a Canvas. The WPF app root node overrides OnRender() to iterate through a collection of 'child' nodes, calling Render on each child node to build the Visual Tree. Silverlight doesn't expose OnRender, but there are hints that the same effect can be achieved using ControlTemplate. Is this the way to go, and are there any good examples of using this method available? I've done some googling (binging?) and found nothing really conclusive.

    Read the article

  • How to turn off project mirroring from SourcForge to launchpad?

    - by C.W.Holeman II
    I have project Emle in Launchpad. I set it to import from emle.svn.sourceforge.net. My intention was to do a single import of the files from SourceForge. EmleBranches2.0 shows that what I actually did was set it to mirror the SourceForge project. Import details Import Status: Reviewed This branch is an import of the Subversion branch from https://emle.svn.sourceforge.net/svnroot/emle/trunk. The next import is scheduled to run in 35 minutes. Last successful import was 5 hours ago. Import started 5 hours ago on russkaya and finished 5 hours ago taking 30 seconds — see the log Import started 12 hours ago on neumayer and finished 12 hours ago taking 30 seconds — see the log Import started 20 hours ago on russkaya and finished 20 hours ago taking 30 seconds — see the log How can I turn off the mirroring?

    Read the article

  • appexchange, facebook, google app store platform architecture

    - by ktasy
    how does appexchange or facebook build their app store architecture? I work for a company that is Saas based and we would like to start building an app store ourselves. We would like to have third party developers develop apps on top of our Saas application similar to appexchange and facebook's applications. If people could led me in the right direction on architecting an app store on the web that would be great.

    Read the article

  • Does it ever make sense to make a fundamental (non-pointer) parameter const?

    - by Scott Smith
    I recently had an exchange with another C++ developer about the following use of const: void Foo(const int bar); He felt that using const in this way was good practice. I argued that it does nothing for the caller of the function (since a copy of the argument was going to be passed, there is no additional guarantee of safety with regard to overwrite). In addition, doing this prevents the implementer of Foo from modifying their private copy of the argument. So, it both mandates and advertises an implementation detail. Not the end of the world, but certainly not something to be recommended as good practice. I'm curious as to what others think on this issue. Edit: OK, I didn't realize that const-ness of the arguments didn't factor into the signature of the function. So, it is possible to mark the arguments as const in the implementation (.cpp), and not in the header (.h) - and the compiler is fine with that. That being the case, I guess the policy should be the same for making local variables const. One could make the argument that having different looking signatures in the header and source file would confuse others (as it would have confused me). While I try to follow the Principle of Least Astonishment with whatever I write, I guess it's reasonable to expect developers to recognize this as legal and useful.

    Read the article

  • setOpaque(true/false); Java

    - by Trizicus
    In Java2D when you use setOpaque I am a little confused on what the true and false does. For example I know that in Swing Opaque means that when painting Swing wont paint what is behind the component. Or is this backwards? Which one is it? Thanks

    Read the article

  • How to vertically align images in <td>

    - by Ricky
    I got a <td> where two images () reside shown as follows. One is much higher than the other. How do I let the shorter one align to the top of <td />? <td style="padding-left: 0px; cursor: pointer; vertical-align: top;"> <img width="85px" src=".../xyz.png"/> <img src=".../icon_live.gif" /> // shorter one </td>

    Read the article

  • Delphi 2009 - Strip non alpha numeric from string

    - by Brad
    I've got the following code, and need to strip all non alpha numeric characters. It's not working in delphi 2009 ` unit Unit2; //Used information from // http://stackoverflow.com/questions/574603/what-is-the-fastest-way-of-stripping-non-alphanumeric-characters-from-a-string-in interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; Type TExplodeArray = Array Of String; TForm2 = class(TForm) Memo1: TMemo; ListBox1: TListBox; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } Function Explode ( Const cSeparator, vString : String ) : TExplodeArray; Function Implode ( Const cSeparator : String; Const cArray : TExplodeArray ) : String; Function StripHTML ( S : String ) : String; function allwords(data:string):integer; end; var Form2: TForm2; allword, allphrase: TExplodeArray; implementation {$R *.dfm} Function TForm2.StripHTML ( S : String ) : String; Var TagBegin, TagEnd, TagLength : Integer; Begin TagBegin := Pos ( '<', S ); // search position of first < While ( TagBegin > 0 ) Do Begin // while there is a < in S TagEnd := Pos ( '>', S ); // find the matching > TagLength := TagEnd - TagBegin + 1; Delete ( S, TagBegin, TagLength ); // delete the tag TagBegin := Pos ( '<', S ); // search for next < End; Result := S; // give the result End; Function TForm2.Implode ( Const cSeparator : String; Const cArray : TExplodeArray ) : String; Var i : Integer; Begin Result := ''; For i := 0 To Length ( cArray ) - 1 Do Begin Result := Result + cSeparator + cArray [i]; End; System.Delete ( Result, 1, Length ( cSeparator ) ); End; Function TForm2.Explode ( Const cSeparator, vString : String ) : TExplodeArray; Var i : Integer; S : String; Begin S := vString; SetLength ( Result, 0 ); i := 0; While Pos ( cSeparator, S ) 0 Do Begin SetLength ( Result, Length ( Result ) + 1 ); Result[i] := Copy ( S, 1, Pos ( cSeparator, S ) - 1 ); Inc ( i ); S := Copy ( S, Pos ( cSeparator, S ) + Length ( cSeparator ), Length ( S ) ); End; SetLength ( Result, Length ( Result ) + 1 ); Result[i] := Copy ( S, 1, Length ( S ) ); End; //Copied from JclStrings function StrKeepChars(const S: AnsiString; const Chars: TSysCharSet): AnsiString; var Source, Dest: PChar; begin SetLength(Result, Length(S)); UniqueString(Result); Source := PChar(S); Dest := PChar(Result); while (Source < nil) and (Source^ < #0) do begin if Source^ in Chars then begin Dest^ := Source^; Inc(Dest); end; Inc(Source); end; SetLength(Result, (Longint(Dest) - Longint(PChar(Result))) div SizeOf(AnsiChar)); end; function ReplaceNewlines(const AValue: string): string; var SrcPtr, DestPtr: PChar; begin SrcPtr := PChar(AValue); SetLength(Result, Length(AValue)); DestPtr := PChar(Result); while SrcPtr < {greater than less than} #0 do begin if (SrcPtr[0] = #13) and (SrcPtr[1] = #10) then begin DestPtr[0] := '\'; DestPtr[1] := 't'; Inc(SrcPtr); Inc(DestPtr); end else DestPtr[0] := SrcPtr[0]; Inc(SrcPtr); Inc(DestPtr); end; SetLength(Result, DestPtr - PChar(Result)); end; function StripNonAlphaNumeric(const AValue: string): string; var SrcPtr, DestPtr: PChar; begin SrcPtr := PChar(AValue); SetLength(Result, Length(AValue)); DestPtr := PChar(Result); while SrcPtr < #0 do begin if SrcPtr[0] in ['a'..'z', 'A'..'Z', '0'..'9'] then begin DestPtr[0] := SrcPtr[0]; Inc(DestPtr); end; Inc(SrcPtr); end; SetLength(Result, DestPtr - PChar(Result)); end; function TForm2.allwords(data:string):integer; var i:integer; begin listbox1.Items.add(data); data:= StripHTML ( data ); listbox1.Items.add(data); ////////////////////////////////////////////////////////////// data := StrKeepChars(data, ['A'..'Z', 'a'..'z', '0'..'9']); // Strips out everything data comes back blank in Delphi 2009 ////////////////////////////////////////////////////////////// listbox1.Items.add(data); data := stringreplace(data,' ',' ', [rfReplaceAll, rfIgnoreCase] ); //Replace two spaces with one. listbox1.Items.add(data); allword:= explode(' ',data); { // Converting the following PHP code to Delphi $text = ereg_replace("[^[:alnum:]]", " ", $text); while(strpos($text,' ')!==false) $text = ereg_replace(" ", " ", $text); $text=$string=strtolower($text); $text=explode(" ",$text); return count($text); } for I := 0 to Length(allword) - 1 do listbox1.Items.Add(allword[i]); end; procedure TForm2.Button1Click(Sender: TObject); begin //[^[:alnum:]] allwords(memo1.Text); end; end. ` How else would I go about doing this? Thanks

    Read the article

  • How to make movable type to use relative path

    - by haohaolee
    Commonly movable type will publish HTML files which contains absolute path, but if I want to host the site under different domain(e.g., both HTTP and HTTPS), it is very inconvenient. So is there a way to change all the paths to resource of my site to absolute ones? Thanks

    Read the article

  • can we have one attribute with multiple values in an eav design?

    - by Shekhar
    i am doing a database design using EAV. I am facing an issue when i try to model an entity with attribute having multiple values? For example Entity id | name | description 1 | configuration1 | configuration1 Attribute id | entityId | name | type 1 | 1 |att1 | string 2 | 1 |att2 | int 3 |1 | att3 | List (How will i model this?) Value id | attributeId | value 1 | 1 | a 2 | 2 | 1 3 | 3 | b 4 | 3 | c 5 | 3 |d Is this the correct way to handle list of values? Please provide any helpful link to model this? Thanks Shekhar

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >