Daily Archives

Articles indexed Sunday March 21 2010

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

  • x86 opcode alignment references and guidelines

    - by mrjoltcola
    I'm generating some opcodes dynamically in a JIT compiler and I'm looking for guidelines for opcode alignment. 1) I've read comments that briefly "recommend" alignment by adding nops after calls 2) I've also read about using nop for optimizing sequences for parallelism. 3) I've read that alignment of ops is good for "cache" performance Usually these comments don't give any supporting references. Its one thing to read a blog or a comment that says, "its a good idea to do such and such", but its another to actually write a compiler that implements specific op sequences and realize most material online, especially blogs, are not useful for practical application. So I'm a believer in finding things out myself (disassembly, etc. to see what real world apps do). This is one case where I need some outside info. I notice compilers will usually start an odd byte instruction immediately after whatever previous instruction sequence there was. So the compiler is not taking any special care in most cases. I see "nop" here or there, but usually it seems nop is used sparingly, if at all. How critical is opcode alignment? Can you provide references for cases that I can actually use for implementation? Thanks.

    Read the article

  • PROLOG all different

    - by inspectorG4dget
    Hello SO, I have a very weird problem with PROLOG. I have used it before, but it's been a while and I'm rusty. I have a list of variables and I need to ensure that none of them are the same. I have tried: use_module(library(bounds)). all_different(A, B, C, D, 6, 8). However, when I try this, I get an error saying that all_different/6 is undefined. How can I go about solving this issue? Is there any library function that I can call directly for this? I am VERY stuck and would greatly appreciate any help. Thanks in advance.

    Read the article

  • very quickly getting total size of folder

    - by freakazo
    I want to quickly find the total size of any folder using python. def GetFolderSize(path): TotalSize = 0 for item in os.walk(path): for file in item[2]: try: TotalSize = TotalSize + getsize(join(item[0], file)) except: print("error with file: " + join(item[0], file)) return TotalSize That's the simple script I wrote to get the total size of the folder, it took around 60 seconds (+-5 seconds). By using multiprocessing I got it down to 23 seconds on a quad core machine. Using the Windows file explorer it takes only ~3 seconds (Right click- properties to see for yourself). So is there a faster way of finding the total size of a folder close to the speed that windows can do it? Windows 7, python 2.6 (Did searches but most of the time people used a very similar method to my own) Thanks in advance.

    Read the article

  • Why don't I have a "Web Service References" menu item in excel/VBA?

    - by Draemon
    I'm trying to consume a SOAP web service from excel. Now according to This article (and confirmed by other articles and MSDN) if I do the following: Install the web services toolkit (I've installed v2.01) Install SOAP Toolkit 3.0 Add a reference to Microsoft Soap Type Library (I've tried v3.0 and an older one) I should get a "Web Service References" menu item in the Tools menu but I don't. I've also tried adding every reference that seemed to have anything to do with SOAP or XML, but it hasn't helped. Any ideas?

    Read the article

  • Delphi : Sorted List

    - by Sethu
    I need to sort close to a 1,00,000 floating point entries in delphi. I am new to delphi and would like to know if there are any readymade solutions available. I tried a few language provided constructs and they take an inordinate amount of time to run to completion.(a 5-10 sec execution time is fine for the application)

    Read the article

  • Can't call animated png script from external js file

    - by Tomas
    Hello, I'm trying to put an animated PNG dinamicaly from external .js file. First I found a simple animated png solution, which draws an animation wherever you put the code within tags, but now it looks like I don't know how to call the function properly from external file. The script is from www.squaregoldfish.co.uk/software/animatedpng, and it looks something like this: <script type="text/javascript" src="animatedpng.js"></script> <div id="pnganim" align="center"> <script> fishAnim = new AnimatedPNG('fish', 't01.png', 3, 100); fishAnim.draw(false); </script> </div> Now, I'm trying to call this from external.js file and jquery: function addFish(){ $('#pnganim').html('<script type="text/javascript" src="animatedpng.js" />'); fishAnim = new AnimatedPNG('fish', 'fish01.png', 3, 100); myFish = fishAnim.draw(false); $('#pnganim').append(myFish); } ... and it's not working. After I click a button that calls the addFish function, it opens only the first frame on a blank page. What am I doing wrong here? Thanks

    Read the article

  • Tutorials for .NET database app

    - by ChrisC
    My earlier question and comments are at "What is ADO.NET". This shows my level of knowledge about c# database apps. Can someone point me to tutorials and/or primers that can help me proceed from where I am (also stated in other question)? I've looked and all I've found are tutorials that talk about general db basics (ie, not helping with VS/C#), or talk about connecting to existing SQL db's. I need help setting one up and configuring it, as well as help on how to create and use queries to test the db schema.

    Read the article

  • How best to embed multiple Flash Player instances using swfobject via a usercontrol?

    - by panamack
    I have a ListView on a Page within a MasterPage and some very ugly ugly autogenerated IDs. Such as..."ctl00_workbenchPlaceHolder_ListView1_ctrl1_LibItem2One" Using swfobject.embedSWF(...) requires me to hand over the id of a div on my page that can be replaced with object/embed markup depending on the browser context. My aim is to show the user a collection of video's they have uploaded to their website so they can review them and change some related data if desired. Hence the ListView which is populated via a SQLDataSource which currently provides a number of URLs pointing to .flv files. But it ain't gonna work if I put a <div id="replaceme"></div>' in my user control because I may then have more than one id="replaceme" and poor swfobject won't like it. So my evil solution is to put an <asp:Literal> in my usercontrol and build the script, function name and div tag id as a string. ApplyVideoConfiguration is called if the library object retreived from the database is a video and switches to the relevant View of a MultiView control. protected void ApplyVideoConfiguration() { MultiViewLibItem.ActiveViewIndex = 3; string functionName = "MakeFlashFor_" + this.ClientID; string divId = "fp" + this.ClientID; VideoScriptLiteral.Text = "<script type=\"text/javascript\">" + "Sys.Application.add_load(" + functionName + ");" + "function " + functionName + "(){" + "swfobject.embedSWF('PanamaVideoThumbnail.swf', '" + divId + "', '140', '127', '10');" + "};" + "</script>" + "<div id=\"" + divId + "\" ></div>" ; } I was wondering, just how bad a solution is this, I'm really completely inexperienced when it comes to best practices but my instincts are telling me this is bad, although it does succeed in the aim of embedding some Flash Player instances. Can anyone help me make it beautiful?

    Read the article

  • Deploying a SharePoint 2007 theme using Features

    - by Kelly Jones
    I recently had a requirement to update the branding on an existing Windows SharePoint Services (WSS version 3.0) site.  I needed to update the theme, along with the master page.  An additional requirement is that my client likes to have all changes bundled up in SharePoint solutions.  This makes it much easier to move code from dev to test to prod and more importantly, makes it easier to undo code migrations if any issues would arise (I agree with this approach). Updating the theme was easy enough.  I created a new theme, along with a two new features.  The first feature, scoped at the farm level, deploys the theme, adding it to the spthemes.xml file (in the 12 hive –> \Template\layouts\1033 folder).  Here’s the method that I call from the feature activated event: private static void AddThemeToSpThemes(string id, string name, string description, string thumbnail, string preview, SPFeatureReceiverProperties properties) { XmlDocument spThemes = new XmlDocument(); //use GetGenericSetupPath to find the 12 hive folder string spThemesPath = SPUtility.GetGenericSetupPath(@"TEMPLATE\LAYOUTS\1033\spThemes.xml"); //load the spthemes file into our xmldocument, since it is just xml spThemes.Load(spThemesPath); XmlNode root = spThemes.DocumentElement; //search the themes file to see if our theme is already added bool found = false; foreach (XmlNode node in root.ChildNodes) { foreach (XmlNode prop in node.ChildNodes) { if (prop.Name.Equals("TemplateID")) { if (prop.InnerText.Equals(id)) { found = true; break; } } } if (found) { break; } } if (!found) //theme not found, so add it { //This is what we need to add: // <Templates> // <TemplateID>ThemeName</TemplateID> // <DisplayName>Theme Display Name</DisplayName> // <Description>My theme description</Description> // <Thumbnail>images/mythemethumb.gif</Thumbnail> // <Preview>images/mythemepreview.gif</Preview> // </Templates> StringBuilder sb = new StringBuilder(); sb.Append("<Templates><TemplateID>"); sb.Append(id); sb.Append("</TemplateID><DisplayName>"); sb.Append(name); sb.Append("</DisplayName><Description>"); sb.Append(description); sb.Append("</Description><Thumbnail>"); sb.Append(thumbnail); sb.Append("</Thumbnail><Preview>"); sb.Append(preview); sb.Append("</Preview></Templates>"); root.CreateNavigator().AppendChild(sb.ToString()); spThemes.Save(spThemesPath); } } Just as important, is the code that removes the theme when the feature is deactivated: private static void RemoveThemeFromSpThemes(string id) { XmlDocument spThemes = new XmlDocument(); string spThemesPath = HostingEnvironment.MapPath("/_layouts/") + @"1033\spThemes.xml"; spThemes.Load(spThemesPath); XmlNode root = spThemes.DocumentElement; foreach (XmlNode node in root.ChildNodes) { foreach (XmlNode prop in node.ChildNodes) { if (prop.Name.Equals("TemplateID")) { if (prop.InnerText.Equals(id)) { root.RemoveChild(node); spThemes.Save(spThemesPath); break; } } } } } So, that takes care of deploying the theme.  In order to apply the theme to the web, my activate feature method looks like this: public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { using (SPWeb curweb = (SPWeb)properties.Feature.Parent) { curweb.ApplyTheme("myThemeName"); curweb.Update(); } } Deactivating is just as simple: public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { using (SPWeb curweb = (SPWeb)properties.Feature.Parent) { curweb.ApplyTheme("none"); curweb.Update(); } } Ok, that’s the code necessary to deploy, apply, un-apply, and retract the theme.  Also, the solution (WSP file) contains the actual theme files. SO, next is the master page, which I’ll cover in my next blog post.

    Read the article

  • Windows Backup (2008 R2) recovery and timezone

    - by GrZeCh
    Hello, does difference between timezones on Windows Server 2008 where backup was made and reovery console makes difference? Recovery console (wbadmin from command line too) is not finding any backup on local hard drive connected to server. Thanks EDIT: I'm working on Windows Server 2008 R2 EDIT2: This is not related to timezone. When I connected backup hard drive from Windows 2008 R2 Release Candidate recovery console runned from RTM system version DVD found stored backups from it without problems.

    Read the article

  • Enable anonymous access to report builder in reporting services 2008

    - by ilivewithian
    I have a 2008 reporting services server installed on windows 2003 server. I am trying to allow anonymous access to the report builder folder so that my users do not have to select the remember password option when they login, if they are wanting to use the report builder. All I have found so far is that I should be able to do this with the IIS manager, but that only seems to work for reporting services 2005. Reporting services 2008 does not show up in the IIS manager, enabling anonymous access seems to be hidden somewhere else. How do I enable anonymous access to report builder in reporting services 2008?

    Read the article

  • Foreign key problem linking tables in phpMyAdmin

    - by alan
    I'm using phpMyAdmin (PHP & MySQL) and I'm having a lot of trouble linking the tables using foreign keys. I'm getting negative values for the field countyId (which is the foriegn key). However, it is linking to my other table and cascading fine. When I go to add data there will be a drop selection for the CountyId and the values will look something like this: " -1 1- " Here is my alter statement: ALTER TABLE Baronies ADD FOREIGN KEY (CountyId) REFERENCES Counties (CountyId) ON DELETE CASCADE

    Read the article

  • Django model: Reference foreign key table in __unicode__ function for admin

    - by pa
    Example models: class Parent(models.Model): name = models.CharField() def __unicode__(self): return self.name class Child(models.Model): parent = models.ForeignKey(Parent) def __unicode__(self): return self.parent.name # Would reference name above I'm wanting the Child.unicode to refer to Parent.name, mostly for the admin section so I don't end up with "Child object" or similar, I'd prefer to display it more like "Child of ". Is this possible? Most of what I've tried hasn't worked unfortunately.

    Read the article

  • CMS Preventing Bad HTML Insertion by Client?

    - by Jascha
    I'm building a small CMS in PHP for a client and something I've noticed that comes up fairly often is a client will enter a bit of HTML in a field without closing his/her tag. I'm wondering if there is some parsing technique to prevent bad HTML from rendering my whole output page in italics because the user forgot to add a closing </i> tag. I'm not worried about XSS or malicious html, just a forgotten tag here and there as it's the client who is managing the content. Forgive me if this is a duplicate question, I did some searching, but could not find an appropriate answer. -J

    Read the article

  • TortoiseSVN commit shortcut

    - by Patrick
    I find it tedious when everytime I need to commit a file.The process goto windows explorer window, right click directory, then click 'Commit'... and then the tortoisesvn commit window. Anyone know of any shortcut to do this? Maybe press a keyboard shortcut to commit instead of having to right click directory then click commit? Thank you for saving my productivity!

    Read the article

  • iPhone SDK / Facebook Connect: Using a custom login dialog

    - by boliva
    Exactly what the title says. Is it possible to use Facebook Connect (or any other means of FB integration) in a native iPhone app without resorting to the built in login dialog (which looks awful)? Something where I could create my own custom login screen asking for the facebook login username and password and then using the fbconnect native methods to validate that info and retrieve a valid session?

    Read the article

  • Populating DataGrid with SQLResult Air Flex

    - by Deyon
    I been beating my self up all day on this...I'm about to call it quits and get some Chinese food -=\ I'm selecting data from a local SQL DB. [Bindable] public var ac:ArrayCollection; public function select():void { statement.sqlConnection=conn; statement.text="SELECT * FROM PROJECT"; statement.execute(); var res : SQLResult = statement.getResult(); ac = new ArrayCollection(res.data); //So this traces out [Object][object] So it works trace(ac); } If I do var myObj:Object=res.data[0]; I can trace myObj and view the data. But I don't know how to insert the data into a datagrid. mygrid.dataProvider=ac; dose not work. I'm using Flash Builder 4 Help please....

    Read the article

  • How to display a QGraphicsScene?

    - by Chris
    I've got the following code and I'm not sure how to add the QGraphicsScene to my layout.. class MainForm(QDialog): def __init__(self, parent=None): super(MainForm, self).__init__(parent) self.scene = QGraphicsScene(self) self.scene.setSceneRect(0, 0, 500, 500) self.view = QGraphicsView() self.view.setRenderHint(QPainter.Antialiasing) self.view.setScene(self.scene) self.view.setFocusPolicy(Qt.NoFocus) zoomSlider = QSlider(Qt.Horizontal) zoomSlider.setRange(5, 200) zoomSlider.setValue(100) self.pauseButton = QPushButton("Pause") quitButton = QPushButton("Quit") layout = QVBoxLayout() layout.addWidget(zoomSlider) self.setLayout(layout) self.startTimer(10) How can I get my QGraphicsScene running? I'm new to Qt. Am I even supposed to be adding a QGraphicsScene to a layout/

    Read the article

  • How do I avoid an infinite loop when overriding a virtual property?

    - by cbsch
    Is it possible to ignore set and get when I'm assigning to or retrieving a value? In specific, I'm inheriting from a class that has a property declared like this: virtual public Int32 Value { get; set; } What I'd like to do is to override it and do something useful in those set and get's. The problem appears when I override it, I also have to manually assign, or return the value from the property. If I do something like this: override public Int32 Value { get { return this.Value; } set { this.Value = value; // do something useful } Then I'm creating an infinite loop. Is there a way to set or get the value without invoking the code in set and get, or do I have to make a separate name for the actual variable?

    Read the article

  • How to use drag and drop within a UIScrollView

    - by user249488
    I am trying to drag and drop UIViews within a UIScrollView. I'd like the UIScrollView to scroll if I drag a UIView so that it intersects the top or bottom of the ScrollView. If it touches the top, it should scroll up. If it touches the bottom, it should scroll down. Once the UIView is moved such that it is no longer intersecting the top or bottom, the scrolling should stop. The first approach I tried was to start an NSTimer whenever I detected that the UIView intersected with the top or bottom of the scrollview. The timer would scroll the UIScrollView bit by bit until it was invalidated. This resulted in very jerky scrolling, since there is no way to predict when the timers will fire. My current approach is to simply scroll all the way to the top or bottom of the ScrollView, like this: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0]; [self.parentScrollview setContentOffset:newOffset animated:NO]; [UIView commitAnimations]; In order to stop scrolling, I try to determine the position of the touch in the touchesMoved: delegate, and use that to calculate the contentOffset to use for the scrollView. The problem is, when I try to get the location in the view via [[touches anyObject] locationInView:self], I get the final end location, rather than the current location. I'm guessing that's because the contentOffset on the scrollView is set immediately. Is there a way to get the actual location of a touch in a situation like this? Or any other way to set the contentOffset when I interrupt the scrolling animation?

    Read the article

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