Search Results

Search found 1972 results on 79 pages for 'trick'.

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

  • Too Clever for My Own Good

    - by AjarnMark
    Yesterday I caught myself being a little too clever for my own good with some ASP.NET code.  It seems that I have forgotten some of my good old classic HTML and JavaScript skills, and become too dependent on the .NET Framework and WebControls to do the work for me.  Here’s the scenario… In order to improve the User Interface and better communicate to the user when something is happening that they need to wait for, we have started to modify some of our larger (slower) pages to display messages like Processing… or Reloading… while they are cycling through a postback.  (Yes, I understand this could be improved by using AJAX / Callbacks and so on, but even then, you need to let your user know that they need to wait for that section to be re-rendered, so for the moment these pages will continue to use good ol’ Postbacks.)  It’s a very simple trick, really.  All I want to do is when some control triggers a postback, first run a little client-side JavaScript to hide the main contents of the page (such as a GridView) and display the appropriate message.  This lets the user know, “Hey, we’re doing something, don’t click another link or scroll and try to take action right now.” The first places I hooked this up were easy.  Most common cause of a postback:  Buttons.  And when you’re writing the markup or declarative code for an ASP:Button control, there is the handy OnClientClick property which is designed for just this purpose…to run client-side JavaScript before the postback occurs.  This is distinguished from the OnClick property which tells the control what Server-side code to run.  Great!  Done!  Easy! But then there are other controls like DropDownLists and CheckBoxes that we use on our pages with the AutoPostback=True setting which cause postbacks.  And these don’t have OnClientClick or OnClientSelectedIndexChanged events.  So I started getting creative, using an ASP:CustomValidator control in conjunction with setting the CausesValidation and ValidationGroup settings on these controls, which basically caused the action on the control to fire the Custom Validator, which was defined with a Client Side validation function which then did the hide content/show message code (and return a meaningless IsValid setting).  This also caused me to define a different ValidationGroup setting for my real data entry validator controls so that I could control them separately and only have them fire when I really wanted validation, and not just my show/hide trick. For a little while I was pretty proud of myself for coming up with this clever approach to get around what I considered to be a serious oversight on the DropDownList and CheckBox controls declarative syntax.  Then, in the midst of my smugness, just as I was about to commit my changes to the source code repository, it dawned on me that there is a much simpler and much more appropriate way to accomplish this.  All that I really needed to do was to put in my server-side code (I used the Page_Init section) a call to MyControl.Attributes.Add(“onClick”, “myJavaScriptFunctionName()”) for the checkboxes, and for the DropDownLists (which become select tags) use “onChange” instead of “onClick”.  This is exactly the type of thing that the Attributes collection is there for…so you can add attributes to be rendered with the control that you would have otherwise stuck right into the HTML markup if you had been doing this by hand in the first place. Ugh!  A few hours wasted on clever tricks that I ended up completely removing, but I did learn a lot more about custom validators and validation groups in the process.  And got a good reminder that all that stuff (HTML, JavaScript, and CSS) I learned back when I wrote classic ASP pages is still valuable today.  Oh, and one more thing…don’t get lulled into too much reliance on the the whiz-bang tool to do it for you.  After all, WebControls are just another layer of abstraction, and sometimes you need to dig down through the layers and get a little closer to the native language.

    Read the article

  • Ask HTG: How Can I Check the Age of My Windows Installation?

    - by Jason Fitzpatrick
    Curious about when you installed Windows and how long you’ve been chugging along without a system refresh? Read on as we show you a simple way to see how long-in-the-tooth your Windows installation is. Dear How-To Geek, It feels like it has been forever since I installed Windows 7 and I’m starting to wonder if some of the performance issues I’m experiencing have something to do with how long ago it was installed. It isn’t crashing or anything horrible, mind you, it just feels slower than it used to and I’m wondering if I should reinstall it to wipe the slate clean. Is there a simple way to determine the original installation date of Windows on its host machine? Sincerely, Worried in Windows Although you only intended to ask one question, you actually asked two. Your direct question is an easy one to answer (how to check the Windows installation date). The indirect question is, however, a little trickier (if you need to reinstall Windows to get a performance boost). Let’s start off with the easy one: how to check your installation date. Windows includes a handy little application just for the purposes of pulling up system information like the installation date, among other things. Open the Start Menu and type cmd in the run box (or, alternatively, press WinKey+R to pull up the run dialog and enter the same command). At the command prompt, type systeminfo.exe Give the application a moment to run; it takes around 15-20 seconds to gather all the data. You’ll most likely need to scroll back up in the console window to find the section at the top that lists operating system stats. What you care about is Original Install Date: We’ve been running the machine we tested the command on since August 23 2009. For the curious, that’s one month and a day after the initial public release of Windows 7 (after we were done playing with early test releases and spent a month mucking around in the guts of Windows 7 to report on features and flaws, we ran a new clean installation and kept on trucking). Now, you might be asking yourself: Why haven’t they reinstalled Windows in all that time? Haven’t things slowed down? Haven’t they upgraded hardware? The truth of the matter is, in most cases there’s no need to completely wipe your computer and start from scratch to resolve issues with Windows and, if you don’t bog your system down with unnecessary and poorly written software, things keep humming along. In fact, we even migrated this machine from a traditional mechanical hard drive to a newer solid-state drive back in 2011. Even though we’ve tested piles of software since then, the machine is still rather clean because 99% of that testing happened in a virtual machine. That’s not just a trick for technology bloggers, either, virtualizing is a handy trick for anyone who wants to run a rock solid base OS and avoid the bog-down-and-then-refresh cycle that can plague a heavily used machine. So while it might be the case that you’ve been running Windows 7 for years and heavy software installation and use has bogged your system down to the point a refresh is in order, we’d strongly suggest reading over the following How-To Geek guides to see if you can’t wrangle the machine into shape without a total wipe (and, if you can’t, at least you’ll be in a better position to keep the refreshed machine light and zippy): HTG Explains: Do You Really Need to Regularly Reinstall Windows? PC Cleaning Apps are a Scam: Here’s Why (and How to Speed Up Your PC) The Best Tips for Speeding Up Your Windows PC Beginner Geek: How to Reinstall Windows on Your Computer Everything You Need to Know About Refreshing and Resetting Your Windows 8 PC Armed with a little knowledge, you too can keep a computer humming along until the next iteration of Windows comes along (and beyond) without the hassle of reinstalling Windows and all your apps.         

    Read the article

  • Sitting Pretty

    - by Phil Factor
    Guest Editorial for Simple-Talk IT Pro newsletter'DBAs and SysAdmins generally prefer an expression of calmness under adversity. It is a subtle trick, and requires practice in front of a mirror to get it just right. Too much adversity and they think you're not coping; too much calmness and they think you're under-employed' I dislike the term 'avatar', when used to describe a portrait photograph. An avatar, in the sense of a picture, is merely the depiction of one's role-play alter-ego, often a ridiculous bronze-age deity. However, professional image is important. The choice and creation of online photos has an effect on the way your message is received and it is important to get that right. It is fine to use that photo of you after ten lagers on holiday in an Ibiza nightclub, but what works on Facebook looks hilarious on LinkedIn. My splendid photograph that I use online was done by a professional photographer at great expense and I've never had the slightest twinge of regret when I remember how much I paid for it. It is me, but a more pensive and dignified edition, oozing trust and wisdom. One gasps at the magical skill that a professional photographer can conjure up, without digital manipulation, to make the best of a derisory noggin (ed: slang for a head). Even if he had offered to depict me as a semi-naked, muscle-bound, sword-wielding hero, I'd have demurred. No, any professional person needs a carefully cultivated image that looks right. I'd never thought of using that profile shot, though I couldn't help noticing the photographer flinch slightly when he first caught sight of my face. There is a problem with using an avatar. The use of a single image doesn't express the appropriate emotion. At the moment, it is weird to see someone with a laughing portrait writing something solemn. A neutral cast to the face, somewhat like a passport photo, is probably the best compromise. Actually, the same is true of a working life in IT. One of the first skills I learned was not to laugh at managers, but, instead, to develop a facial expression that promoted a sense of keenness, energy and respect. Every profession has its own preferred facial cast. A neighbour of mine has the natural gift of a face that displays barely repressed grief. Though he is characteristically cheerful, he earns a remarkable income as a pallbearer. DBAs and SysAdmins generally prefer an expression of calmness under adversity. It is a subtle trick, and requires practice in front of a mirror to get it just right. Too much adversity and they think you're not coping; too much calmness and they think you're under-employed. With an appropriate avatar, you could do away with a lot of the need for 'smilies' to give clues as to the meaning of what you've written on forums and blogs. If you had a set of avatars, showing the full gamut of human emotions expressible in writing: Rage, fear, reproach, joy, ebullience, apprehension, exasperation, dissembly, irony, pathos, euphoria, remorse and so on. It would be quite a drop-down list on forums, but given the vast prairies of space on the average hard drive, who cares? It would cut down on the number of spats in Forums just as long as one picks the right avatar. As an unreconstructed geek, I find it hard to admit to the value of image in the workplace, but it is true. Just as we use professionals to tidy up and order our CVs and job applications, we should employ experts to enhance our professional image. After all you don't perform surgery or dentistry on yourself do you?

    Read the article

  • View all ntext column text in SQL Server Management Studio for SQL CE database

    - by Dave
    I often want to do a "quick check" of the value of a large text column in SQL Server Management Studio (SSMS). The maximum number of characters that SSMS will let you view, in grid results mode, is 65535. (It is even less in text results mode.) Sometimes I need to see something beyond that range. Using SQL Server 2005 databases, I often used the trick of converting it to XML, because SSMS lets you view much larger amounts of text that way: SELECT CONVERT(xml, MyCol) FROM MyTable WHERE ... But now I am using SQL CE, and there is no Xml data type. There is still a "Maximum Characters Retreived XML" value under Options; I suppose this is useful when connecting to other data sources. I know I can just get the full value by running a little console app or something, but is there a way within SSMS to see the entire ntext column value? [Edit] OK, this didn't get much attention the first time around (18 views?!). It's not a huge concern, but maybe I'm just obsessed with it. There has to be some good way around this, doesn't there? So a modest bounty is active. What I am willing to accept as answers, in order from best-to-worst: A solution that works just as easy as the XML trick in SQL CE. That is, a single function (convert, cast, etc.) that does the job. A not-too-invasive way to hack SSMS to get it to display more text in the results. An equivalent SQL query (perhaps something that creatively uses SUBSTRING and generates multiple ad-hoc columns??) to see the results. The solution should work with nvarchar and ntext columns of any length in SQL CE from SSMS. Any ideas?

    Read the article

  • Programmatically set the DPI from a .net 2.0 WinForms application

    - by Stef
    I want to run my application on 96dpi, no matter what the dpi size from Windows is set to. It is possible ? ' Edit ' I found that using the Scale() method and resizing the font will almost do the trick. public class MyForm : Form { private static bool ScaleDetected = false; const float DPI = 80F; protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (!ScaleDetected) { Graphics g = e.Graphics; float factorX = DPI / g.DpiX; float factorY = DPI / g.DpiY; SizeF newSize = new SizeF(factorX, factorY); AutoScaleDimensions = newSize; AutoScaleMode = AutoScaleMode.Dpi; Scale(newSize); Font = new Font(Font.FontFamily, Font.Size * factorX); ScaleDetected = true; } } } However when using this 'trick' in a MDI application using Janus Controls, the main form is resized, but for some other forms, the scaling + changed font are not applied.

    Read the article

  • how to handle base tag target attribute in iphone uiwebview to open new window

    - by user217428
    When the links are supposed to open a new window, iphone uiwebview won't trigger an event when user click these links. We had to use javascript to do some trick to the target attribute of the links. I can handle 'a' tag to open in the '_self' window with the trick without problem. But when I do it the same way with the 'base' tag. it doesn't work. I believe the base target is set by the javascript. But the base tag is in the head, which may be handled by the uiwebview before my javascript executed, so the target change may not reflected in the webkit engine. Could someone please give some suggestion, so I can open the link in the same uiwebview? The following is the sample HTML opened in the uiwebview <html> <head> <base target='_blank'> </head> <body> <a href='http://google.ca'>google</a> </body> </html> The following is the code to be executed in the (void) webViewDidFinishLoad: (UIWebView*)webView static NSString* js = @"" "function bkModifyBaseTargets()" "{" "var allBases = window.document.getElementsByTagName('base');" "if (allBases)" "{" "for (var i = 0; i < allBases.length; i++)" "{" "base = allBases[i];" "target = base.getAttribute('target');" "if (target)" "{" "base.setAttribute('target', '_self');" "}" "}" "}" "}"; [webView stringByEvaluatingJavaScriptFromString: js]; [webView stringByEvaluatingJavaScriptFromString: @"bkModifyBaseTargets()"];

    Read the article

  • how to know location of return address on stack c/c++

    - by Dr Deo
    i have been reading about a function that can overwrite its return address. void foo(const char* input) { char buf[10]; //What? No extra arguments supplied to printf? //It's a cheap trick to view the stack 8-) //We'll see this trick again when we look at format strings. printf("My stack looks like:\n%p\n%p\n%p\n%p\n%p\n% p\n\n"); //%p ie expect pointers //Pass the user input straight to secure code public enemy #1. strcpy(buf, input); printf("%s\n", buf); printf("Now the stack looks like:\n%p\n%p\n%p\n%p\n%p\n%p\n\n"); } It was sugggested that this is how the stack would look like Address of foo = 00401000 My stack looks like: 00000000 00000000 7FFDF000 0012FF80 0040108A <-- We want to overwrite the return address for foo. 00410EDE Question: -. Why did the author arbitrarily choose the second last value as the return address of foo()? -. Are values added to the stack from the bottom or from the top? apart from the function return address, what are the other values i apparently see on the stack? ie why isn't it filled with zeros Thanks.

    Read the article

  • how to atomically claim a row or resource using UPDATE in mysql

    - by Igor
    i have a table of resources (lets say cars) which i want to claim atomically. if there's a limit of one resource per one user, i can do the following trick: UPDATE cars SET user = 'bob' WHERE user IS NULL LIMIT 1 SELECT * FROM cars WHERE user IS bob that way, i claim the resource atomically and then i can see which row i just claimed. this doesn't work when 'bob' can claim multiple cars. i realize i can get a list of cars already claimed by bob, claim another one, and then SELECT again to see what's changed, but that feels hackish. What I'm wondering is, is there some way to see which rows i just updated with my last UPDATE? failing that, is there some other trick to atomically claiming a row? i really want to avoid using SERIALIZABLE isolation level. If I do something like this: 1 SELECT id FROM cars WHERE user IS NULL 2 <here, my PHP or whatever picks a car id> 3 UPDATE cars SET user = 'bob' WHERE id = <the one i picked> would REPEATABLE READ be sufficient here? in other words, could i be guaranteed that some other transactions won't claim the row my software has picked during step 2?

    Read the article

  • Cross-domain data access in JavaScript

    - by vit
    We have an ASP.Net application hosted on our network and exposed to a specific client. This client wants to be able to import data from their own server into our application. The data is retrieved with an HTTP request and is CSV formatted. The problem is that they do not want to expose their server to our network and are requesting the import to be done on the client side (all clients are from the same network as their server). So, what needs to be done is: They request an import page from our server The client script on the page issues a request to their server to get CSV formatted data The data is sent back to our application This is not a challenge when both servers are on the same domain: a simple hidden iframe or something similar will do the trick, but here what I'm getting is a cross-domain "access denied" error. They also refuse to change the data format to return JSON or XML formatted data. What I tried and learned so far is: Hidden iframe -- "access denied" XMLHttpRequest -- behaviour depends on the browser security settings: may work, may work while nagging a user with security warnings, or may not work at all Dynamic script tags -- would have worked if they could have returned data in JSON format IE client data binding -- the same "access denied" error Is there anything else I can try before giving up and saying that it will not be possible without exposing their server to our application, changing their data format or changing their browser security settings? (DNS trick is not an option, by the way).

    Read the article

  • BASH: How to count all the human readable files?

    - by user1687406
    I'm taking an intro course to UNIX and have a homework question that follows: How many files in the previous question are text files? A text file is any file containing human-readable content. (TRICK QUESTION. Run the file command on a file to see whether the file is a text file or a binary data file! If you simply count the number of files with the ".txt" extension you will get no points for this question.) The previous question simply asked how many regular files there were, which was easy to figure out by doing find . -type f | wc -l I'm just having trouble determining what "human readable content" is, since I'm assuming it means anything besides binary/assembly, but I thought that's what -type f displays. Maybe that's what the professor meant by saying "trick question"? This question has a follow up later that also asks "What text files contain the string "csc" in any mix of upper and lower case?". Obviously "text" is referring to more than just .txt files, but I need to figure out the first question to determine this!

    Read the article

  • Backquote on iPhone keyboard

    - by lc
    Is there a backquote (backtick) on the iPhone keyboard, and if so, where is it? When I'm writing a post here or on any of the sister sites (especially SO), I want to use the backquote for inline code blocks. Under the single quote key, I've found two curly/angled quotes, but those (’ and ‘) don't seem to do the trick...

    Read the article

  • Deleting a single file from the trash in Mac OS X Snow Leopard

    - by SteveTheOcean
    In earlier versions of Mac OS X one could delete a file from the trash by opening a terminal window and typing rm ~/.Trash/file_i_want_to_delete. See this previous post. Unlike earlier versions in Mac OS X Snow Leopard one can "put back" a file from the trash into its original directory. Will the rm trick still work? Testing shows it does delete the file but what happens to the "put back" information that specifies the directory from which the file was deleted?

    Read the article

  • Huawei E170 doesn't work with Windows 7

    - by torbengb
    I've got a "Huawei E170" (HSDPA broadband modem USB stick) with a driver CD for Windows XP & Vista, but now I got a netbook with Windows 7, and the driver installer won't run. I've called the telecom, but they just offered to sell me a new stick :-( Is there really no Win7 driver available for the E170 stick? Or can I trick it into installing anyway?

    Read the article

  • Macports Apache not starting at Mac OS X snow leopard boot [closed]

    - by greg
    I've done the launchctl load command, the symlinks point to my /opt/local/etc/LaunchDaemeons/org.macports.apache2/org.macports.apache2.plist, but it never starts. I can start it manually, works fine after that. Just won't load on startup. My server is named in my /opt/local/apache2/conf/httd.conf, I had read that sometimes makes a difference. I've done the launchctl unload and load trick, all with no results. I'm out of ideas.

    Read the article

  • Cyberlink PowerDVD 9 on netbook

    - by marc_s
    I tried to install CyberLink's PowerDVD 9 on a friend's netbook. The installation went OK (even though the install screen is too big to fit and you can't see the "Next " buttons etc.), but once installed, PowerDVD 9 refuses to launch. It claims it requires at least 1024x768 resolution - the Acer netbook has 1024x600 :-( Any way / hack / trick to get PowerDVD9 to work anyway?? Couldn't it scale down to e.g. 800x600?

    Read the article

  • How do I configure the number of worker threads used by SqlServer 2005 Agent

    - by Decker
    How can I increase the limit of worker threads from the default 10 for SQL Server 2005 SqlAgent? I have 9 jobs that run almost continuously and that leaves only one available thread for the rest of the scheduled jobs. Oftentimes, when no thread is available, I will see the jobs in "Waiting for worker thread" state. I'd like to increase the number to about 12 (which should do the trick for me). Any idea where this is set?

    Read the article

  • Can I use LGA775 heatsink on LGA1156 CPU?

    - by Ghostrider
    Will cooler that is designed to LGA775 CPUs install on LGA1156 CPU or are they mechanically incompatible? I'm building my first 1U server and surprise-surprise - Intel stock cooler doesn't fit (unless I'm willing to keep the case open). Places that I prefer to buy stuff from are currently out of stock on 1U 1156 heatsinks so I'm wondering if LGA775 would do the trick.

    Read the article

  • Make backup image (.tib/.vhd) as my main operating system?

    - by Joann
    My old hard drive is dying so I want to move my Windows 7 operating system to another hard drive. They say cloning using Acronis would do the trick, but for some reason it refuses to work. I also tried EASEUS Todo Backup, but it doesn't work either. Can you recommend some suggestions on how to transfer my operating system? I heard about converting .tib to .vhd and then booting from it, but does that achieve the same effect as cloning?

    Read the article

  • Dynamic Disk Start on Boot

    - by Xiuhtecuhtli
    Is there a way to make a Dynamic Disc Automatically Come on line after a reboot. at the moment i must manually Bring the disk "online". I was thinking a Startup Script would do the trick. does anyone know of a URL HOWTO or a Premade script to do this?

    Read the article

  • Search containing "-"

    - by Gage
    It seems like whenever I go to search for a phrase containing "-" it(google) ignores it. Earlier today for example I was searching for vss -y but once I hit search it would show that it was really searching for "vss y". I know most of the tricks when searching like using +, "", etc. But I'm wondering if theres some other trick to make it not ignore these characters. Thanks in advance.

    Read the article

  • What is the best error monitoring tool for Ruby on Rails applications?

    - by marcgg
    I'm looking for something to track the errors being raised across our multiple rails applications on our multiple servers. Ideally: the application failings sends an email to [email protected] and the email is processed in another application. This application will then show us some stats and give us some kinds of auditing tools. A service like Hoptoad might do the trick, but I'm trying to see what's available these days. Ideally free or cheap, of course...

    Read the article

  • How do you make the Windows Components option appear in Setup Manager?

    - by Adam Brand
    Supposedly there is a "Windows Components" option under Advanced Settings when you run the Setup Manager (included in the \Tools\Deploy.cab from a Windows 2003 CD). I can't get this to show up. Is there a special trick? Here is a screenshot of what it is supposed to look like: http://tinypic.com/r/2rm2gau/7 When I run it, it looks exactly the same except there is no "Windows Components" option above Telephony.

    Read the article

  • How to make a 100% UNIQUE dvd? [closed]

    - by sajawikio
    Is it possible to make a DVD which would be next to impossible to replicate exactly even with special equipment? To be clear, not in the sense of making the data itself resistant to piracy - nothing like that. More like as an analogy to antiques - a reproduction of a furniture would be able to be spotted to a trained eye, that it is not the original. Is it possible to do this for a dvd? Like, say a dvd is copied, even by someone who is trying to use even special equipment and is hypothetically dying to copy the dvd exactly for whatever reason - even such copied dvd would be detectable that it is not exactly the original dvd somehow (as if it were a reproduction of an original antique, but not the original), and would be almost or even preferably impossible to actually copy 100% exact the dvd ever again. Just some ideas below on the sort of thing i might go about doing to do this, but really am not sure how or what programs, media, hardware, etc. would do the trick Not sure what would do the trick -- but for instance do there exist any blank dvd's that already come pre-recorded with some sort of serial number or bar code, or other metadata, or an encrypted hash, or something like that? Maybe any blank dvd will do but i should get a special software to extract hardcoded metadata? If so which software? Or special hardware even maybe? Such dvd which the "secret" can be: Well, to know what the "secret" is and if it is present on the disk, it probably should be readable by some software or maybe a particular hardware (i guess preferably only if some sort of key is known and input into the software, even better, only then such secret data on disk can be read, otherwise nothing shows up and it looks like just a regular disk with no secret on it), and Would be impossible to actually replicate, especially not with regular burning hardware and preferably not at all. Other idea: Is there any special software that can direct the write head of laser to physically "mar" the dvd in such a way that, when played in dvd player, makes a particular visual pattern or something like that, also say the mar itself shows up as faint scratch on disk, but would be impossible for someone to do themselves exactly? EDIT: Also to clarify suppose the dvd contains video and music that should be playable on dvd players, maybe a menu too (i.e not a dvd containing software), and also to clarify the question is about how to make dvd 100% unique, not how to make the actual content of dvd protected from "piracy".

    Read the article

  • JDBCRealm can't find sqlite file

    - by Tom A
    My authentication fails with java.sql.SQLException: no such table: credentials where credentials is the name of the user/password table. I have checked the db file and the table is there. I think you also get this error when sqlite jdbc can't even find the file. I am specifying my realm in a META-INF/context.xml file. Is there any trick to getting the path right? I have tried just about everything I can think of.

    Read the article

  • Apache SSL configuration testing

    - by jldugger
    When I run configtest on our Apache server, I get the following: `Syntax error on line 1023 of /www/conf/httpd.conf: Invalid command 'SSLEnable', perhaps mis-spelled or defined by a module not included in the server configuration` I know this part of the configuration works. Is there a trick to make configtest mod_ssl aware?

    Read the article

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