Daily Archives

Articles indexed Friday April 16 2010

Page 1/120 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • jquery animate question

    - by user313271
    jquery code $(function(){ $('#switcher1').click(function(){ $(this).stop().animate({left:'35px'},800); }); }); Hey everybody, this code slides #switcher1 at 35px to the right. I have question, how i can make that #switcher1 on one more click slides back to the original position ?

    Read the article

  • asp.net Impersonate User for network resource access

    - by lonelycoder
    code: System.Security.Principal.WindowsImpersonationContext impersonationContext; impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate(); //access network resources. impersonationContext.Undo(); web.config: <authentication mode="Windows"> </authentication> <identity impersonate="true" userName="user" password="password"></identity> As clear from web.config file, the app runs in an impersonated mode. I need to impersonate temporarily on top of that to access a network resource. I do that as shown above. This works fine on server if I browse to the website on the local IE installed on the server but when I access the app from my PC or any other PC, I get a access denied. Btw, this is all within an enterprise domain environment. so IE in both cases is passing a valid authenticated token. Any ideas what is going on. thanks.

    Read the article

  • Help improving a simple assembly function

    - by MPelletier
    I just handed in this function in an assignment. It is done (hence no homework tag). But I would like to see how this can be improved. Essentially, the function sums the squares of all the integers between 1 and the given number, using the following formula: n(n+1)(2n+1)/6 Where n is the maximum number. The function below is made to catch any overflow and return 0 should any occur. UInt32 sumSquares(const UInt32 number) { int result = 0; __asm { mov eax, number //move number in eax mov edx, 2 //move 2 in edx mul edx //multiply (2n) jo end //jump to end if overflow add eax, 1 //addition (2n+1) jo end //jump to end if overflow mov ecx, eax //move (2n+1) in ecx mov ebx, number //move number in ebx add ebx, 1 //addition (n+1) jo end //jump to end if overflow mov eax, number //move number in eax for multiplication mul ebx //multiply n(n+1) jo end //jump to end if overflow mul ecx //multiply n(n+1)(2n+1) jo end //jump to end if overflow mov ebx, 6 //move 6 in ebx div ebx //divide by 6, the result will be in eax mov result, eax //move eax in result end: } return result; } Basically, I want to know what I can improve in there. In terms of best-practices mostly. One thing sounds obvious: smarter overflow check (with a single check for whatever maximum input would cause an overflow).

    Read the article

  • Multiplying char and int together in C

    - by teehoo
    Today I found the following: #include <stdio.h> int main(){ char x = 255; int z = ((int)x)*2; printf("%d\n", z); //prints -2 return 0; } So basically I'm getting an overflow because the size limit is determined by the operands on the right side of the = sign?? Why doesn't casting it to int before multiplying work? In this case I'm using a char and int, but if I use "long" and "long long int" (c99), then I get similar behaviour. Is it generally advised against doing arithmetic with operands of different sizes?

    Read the article

  • Sharepoint and its template/master pages

    - by jhuang
    I'm trying to learn how to customize a sharepoint site. I've seen a lot of examples and they all seem to have one thing in common, the navigation are all the same. Ie the left nav with the different pages and docs. top nav with mostly links to sub-sites or other sites. Does anyone know of a good tutorial or example i can grab that has a horizontal layout of the left nav? i haven't found any.

    Read the article

  • Writing an efficient cron job script utilizing Zend_Mail_Storage_Imap.

    - by fireeyedboy
    I'm new to the IMAP protocol and Zend_Mail_Storage and I'm writing a small php script for a cron job that should regularly poll an IMAP account and check for new messages, and send an e-mail if new messages have arrived. As you can imagine, I want to only poll the IMAP account for relevant messages, and I only want to send a new e-mail if new messages have arrived since the last polled new message. So I thought of keeping track of the last message I polled with some unique identifier for a message. But I'm a bit uncertain about whether the methods I want to utilize for this do what I expect them to do though. So my questions are: Does the iterator position of Zend_Mail_Storage_Imap actually resemble some IMAP unique identifier for messages, or is it simply only and internal position of Zend_Mail_Storage_Abstract? For instance, if I tell it to seek() to message 5 (which I stored from an earlier session) will it indeed seek to the appropriate message on the IMAP server, even if for instance messages have been deleted since last session? Would keeping track of this latest polled message id in a file suffice for a cron job that, say, polls the account every 5 or 10 minutes? Or is this too naive, and should I be using a database for instance. Or is there maybe a much easier way to keep track of such state with Zend_Mail_Storage_Abstract? Also, do I need to poll every IMAP folder? Or is everything accumulated when I poll INBOX? If you could shed some light on any of these matters, I'ld appreciate it. Thanks in advance.

    Read the article

  • Model Not Valid Even With No [Required] Attribute

    - by griegs
    I have a model which is validating as False even though I have no validation rules attached to it what so ever. So this is my model; public class QuickQuote { public Enumerations.AUSTRALIA_STATES state { get; set; } public Enumerations.FAMILY_TYPE familyType { get; set; } public Enumerations.CoverLevel hospitalCover { get; set; } public Enumerations.CoverLevel extrasCover { get; set; } public Enumerations.YesNo pregnancy { get; set; } } And in my controller I have; [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(IndexFormViewModel fvm) { if (!ModelState.IsValid) return View(fvm); The problem is that unless I put a value into each field it's validating as false even though it shouldn't care. Can anyone see what the problem is here?

    Read the article

  • Setting up SQL Server 2005 to use all available memory in 32bit Windows Server 2003 - and verifying

    - by Rizwan Kassim
    There are a number of questions along this line - but they either sometimes contradict each other, or don't show how to properly verify that everything is actually working - hopefully this can be comprehensive... I'm running SQL Server 2005 SP3 Standard on Windows Server 2003 R2 Standard. My server has 8GB of memory installed - my system is almost entirely used as a Database Server - there are some services running on them, but the OS + services can run within 1Gb of RAM. What I've done (please tell me if I'm doing something wrong): /3GB in the boot.ini. (To increase the amount of user-space memory available - info) /PAE in the boot.ini. (Windows claimed to be doing PAE even without this switch, somethow.) Enabled AWE in SQL Server. Enabled Lock Pages in Memory Option for users SYSTEM and Local Service. (info). SQL Server Standard doesn't seem to use this until Cumulative Update 4, which isn't installed on my server. (info) Set Min/Max Memory to : 1024Mb/5112Mb After doing all the above, we definately saw a level of improvement - but I'd like now to verify my settings, make sure that I'm making full use of the memory available. (There appeared to be a slowdown when max = 7Gb, so I edged off from that value, but it might have been just perceptual.) To verify, I checked the following levels in PerfMon : Process(sqlserv):Working Set : 76386304 SQL Server(Memory Manager) : Total Server Memory : 3538944 (I saw a doc that noted that this wasn't the full memory used by SQL Server, so I'm not sure whether to trust it) So -- my questions... Should my max be around 7Gb? If not, what should it be? Why is total server memory at 3.5G, when it's been allocated 5G? What is the proper metric for the amount of memory allocated to SQL Server? The Working Set seems a bit large... Am I possibly missing any steps in the setup? Any recommended resources on starting to tune the caching system now? Thanks

    Read the article

  • how to run an ActiveX that must be visible and topmost on a server without a desktop?

    - by DanJ
    We're writing a server application that needs to use an ActiveX object that must be visible and Top-Most otherwise it doesn't render correctly. The challenge is that servers typically don't have an active desktop, and therefore the applications should not require one. Ours does. I must use this ActiveX, and I don't have access to the source code. When running from within remote-desktop everything works fine as long as the session is open. As soon as the session closes it stops working. I'm guessing this is because there is no desktop. Any ideas how I can work this out in a secure and robust way?

    Read the article

  • Cloning and renaming form elements with jQuery

    - by Micor
    I am looking for an effective way to either clone/rename or re-create address fields to offer ability to submit multiple addresses on the same page. So with form example like this: <div id="addresses"> <div class="address"> <input type="text" name="address[0].street"> <input type="text" name="address[0].city"> <input type="text" name="address[0].zip"> <input type="text" name="address[0].state"> </div> </div> <a href="" id="add_address">Add address form</a> From what I can understand there are two options to do that: Recreate the form field by field and increment the index which is kind of verbose: var index = $(".address").length; $('<`input`>').attr({ name: 'address[' + index + '].street', type: 'text' }).appendTo(...); $('<`input`>').attr({ name: 'address[' + index + '].city', type: 'text' }).appendTo(...); $('<`input`>').attr({ name: 'address[' + index + '].zip', type: 'text' }).appendTo(...); $('<`input`>').attr({ name: 'address[' + index + '].state', type: 'text' }).appendTo(...); Clone Existing layer and replace the name in the clone: $("div.address").clone().appendTo($("#addresses")); Which one do you recommend using in terms of being more efficient and if its #2 can you please suggest how I would go about search and replacing all occurrences of [0] with [1] ([n]). Thank you.

    Read the article

  • Ant build from Android-generated build file fails - how to fix?

    - by Eno
    Building our Android app from Ant fails with this error: [apply] [apply] UNEXPECTED TOP-LEVEL ERROR: [apply] java.lang.OutOfMemoryError: Java heap space [apply] at java.util.HashMap.<init>(HashMap.java:209) [apply] at java.util.HashSet.<init>(HashSet.java:86) [apply] at com.android.dx.ssa.Dominators.compress(Dominators.java:96) [apply] at com.android.dx.ssa.Dominators.eval(Dominators.java:132) [apply] at com.android.dx.ssa.Dominators.run(Dominators.java:213) [apply] at com.android.dx.ssa.DomFront.run(DomFront.java:84) [apply] at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:265) [apply] at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:51) [apply] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:100) [apply] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:74) [apply] at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:269) [apply] at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:131) [apply] at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85) [apply] at com.android.dx.command.dexer.Main.processClass(Main.java:297) [apply] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276) [apply] at com.android.dx.command.dexer.Main.access$100(Main.java:56) [apply] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:228) [apply] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245) [apply] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130) [apply] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108) [apply] at com.android.dx.command.dexer.Main.processOne(Main.java:245) [apply] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183) [apply] at com.android.dx.command.dexer.Main.run(Main.java:139) [apply] at com.android.dx.command.dexer.Main.main(Main.java:120) [apply] at com.android.dx.command.Main.main(Main.java:87) BUILD FAILED Ive tried giving Ant more memory by setting ANT_OPTS="-Xms256m -Xmx512m". (This build machine has 1Gb RAM). Do I just need more memory or is there anything else I can try?

    Read the article

  • What does transaction.commit() do when the flushmode is set manual in Hibernate?

    - by wei
    Here is a block of code in the Java Persistence with Hibernate book by Christian and Gavin, Session session = getSessionFactory().openSession(); session.setFlushMode(FlushMode.MANUAL); // First step in the conversation session.beginTransaction(); Item item = (Item) session.get(Item.class, new Long(123) ); session.getTransaction().commit(); // Second step in the conversation session.beginTransaction(); Item newItem = new Item(); Long newId = (Long) session.save(newItem); // Triggers INSERT! session.getTransaction().commit(); // Roll back the conversation! session.close();//enter code here I am confused that why the first step and second step need to be wrapped into two separate transactions? Since the flushmode is set manual here, no operations (suppose we ignore the insert here) will hit the database anyway. So why bother with transactions here? thanks

    Read the article

  • Excel tab sheet names vs. Visual Basic sheet names

    - by SteveNeedsSheetNames
    It seems that Visual Basic can not reference sheets according to user-modified sheet names. The worksheet tabs can have their names changed, but it seems that Visual Basic still thinks of the worksheet names as Sheet1, etc., despite the workbook tab having been changed to something useful. I have this: TABname = rng.Worksheet.Name ' Excel sheet TAB name, not VSB Sheetx name. Thanks, Bill Gates. but I would like to use sheet names in Visual Basic routines. The best I could come up so far is to Select Case the Worksheet Tab vs. Visual Basic names, which doesn't make my day. Visual Basic must know the Sheet1, Sheet2, etc., names. How can I get these associated with the Excel tab names so that I don't have to maintain a look-up table which changes with each new sheet or sheet tab re-naming? Thanks in advance for your replies.

    Read the article

  • Modification of a template has resulted in confusion...

    - by Dixon Crews
    Hello, I'm working on a site right now that has a short picture slideshow for the homepage. I purchased a template and I am modifying it to work for this situation. On modification, the thumbnail row under the slideshow is now separated from the slideshow and the thumbs are not centered. I can't seem to understand how to get this to get right under the slideshow and have them centered in the row. Any help for me? http://cormanroofinginc.com/ Thanks.

    Read the article

  • Graphviz DOT arrange Nodes in circles

    - by Ivo Wetzel
    OK here's my problem, I'm generating a graph of a python module, including all the files with their functions/methods/classes. I want to arrange it so, that nodes gather in circles around their parent nodes, currently everything is on one gargantuan horizontal row, which makes the thing 50k pixels wide and also let's the svg converter fail(only renders about the half of the graph). I went trough the docs(http://www.graphviz.org/doc/info/attrs.html) but couldn't find anything that seems to do the trick. So the question is: Is there a simple way to do this or do I have to layout the whole thing by myself? :/

    Read the article

  • REST tools support for development and testing

    - by nzpcmad
    There is a similar question here but it only covers some of the issues below. We have a client who requires web services using REST. We have tons of experience using SOAP and over time have gathered together a really good set of tools for SOAP development and testing e.g. soapUI Eclipse plugins wsdl2java WSStudio By "tools" I mean a product "out of the box" that we can start using. I'm not talking about cutting code to "roll our own" using Ajax or whatever. The tool set for REST doesn't seem to be nearly as mature? What tools are out there (we use C# and Java mainly) ? Do the tools handle GET, POST, PUT, and DELETE? Is there a decent Eclipse plugin? Is there a decent client testing application like WSStudio where you point the tool to the WSDL and it generates a proxy on the fly with the appropriate methods and inputs and you simple type the data in? Are there any good package monitoring tools that allow you to look at the data? (I'm not thinking about sniffers like Wireshark here but rather things like soapUI that allow you to see the request / response) ?

    Read the article

  • How to programmatically migrate Sharepoint Team Discussion Item

    - by BeraCim
    Hi all: I was wondering how can I programmatically copy all the discussion items from one Sharepoint team discussion to another? I have tried retrieving the team discussion items from an existing site as SPListItem. Although I could find the Team Discussion list, but I could not red the retrieved items by assigning them as SPListItems. Moreover, team discussion looked like it has a lot of fields that requires a lot of other information to be available e.g. users, threads, topics, etc. It certainly looks different than other ordinary lists. Would a simple copying of all the fields be sufficient, or there is more to it? Thanks.

    Read the article

  • Handling multiple column data with Java

    - by Ender
    I am writing an application that reads in a large number of basic user details in the following format; once read in it then allows the user to search for a user's details using their email: NAME ROLE EMAIL --------------------------------------------------- Joe Bloggs Manager [email protected] John Smith Consultant [email protected] Alan Wright Tester [email protected] ... The problem I am suffering is that I need to store a large number of details of all people that have worked at the company. The file containing these details will be written on a yearly basis simply for reporting purposes, but the program will need to be able to access these details quickly. The way I aim to access these files is to have a program that asks the user for the name of the unique email of the member of staff and for the program to then return the name and the role from that line of the file. I've played around with text files, but am struggling with how I would handle multiple columns of data when it comes to searching this large file. What is the best format to store such data in? A text file? XML? The size doesn't bother me, but I'd like to be able to search it as quickly as possible. The file will need to contain a lot of entries, probably over the 10K mark over time.

    Read the article

  • What happens to C# 4 optional parameters when compiling against 3.5?

    - by Bertrand Le Roy
    Here’s a method declaration that uses optional parameters: public Path Copy( Path destination, bool overwrite = false, bool recursive = false) Something you may not know is that Visual Studio 2010 will let you compile this against .NET 3.5, with no error or warning. You may be wondering (as I was) how it does that. Well, it takes the easy and rather obvious way of not trying to be too smart and just ignores the optional parameters. So if you’re compiling against 3.5 from Visual Studio 2010, the above code is equivalent to: public Path Copy( Path destination, bool overwrite, bool recursive) The parameters are not optional (no such thing in C# 3), and no overload gets magically created for you. If you’re building a library that is going to have both 3.5 and 4.0 versions, and you want 3.5 users to have reasonable overloads of your methods, you’ll have to provide those yourself, which means that providing a version with optional parameters for the benefit of 4.0 users is not going to provide that much value, except for the ability to provide named parameters out of order. I guess that’s not so bad… Providing all of the following overloads will compile against both 3.5 and 4.0: public Path Copy(Path destination)public Path Copy(Path destination, bool overwrite)public Path Copy( Path destination, bool overwrite = false, bool recursive = false)

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >