Daily Archives

Articles indexed Saturday January 15 2011

Page 15/28 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • how to deal with the position in a c# stream

    - by CapsicumDreams
    The (entire) documentation for the position property on a stream says: When overridden in a derived class, gets or sets the position within the current stream. The Position property does not keep track of the number of bytes from the stream that have been consumed, skipped, or both. That's it. OK, so we're fairly clear on what it doesn't tell us, but I'd really like to know what it in fact does stand for. What is 'the position' for? Why would we want to alter or read it? If we change it - what happens? In a pratical example, I have a a stream that periodically gets written to, and I have a thread that attempts to read from it (ideally ASAP). From reading many SO issues, I reset the position field to zero to start my reading. Once this is done: Does this affect where the writer to this stream is going to attempt to put the data? Do I need to keep track of the last write position myself? (ie if I set the position to zero to read, does the writer begin to overwrite everything from the first byte?) If so, do I need a semaphore/lock around this 'position' field (subclassing, perhaps?) due to my two threads accessing it? If I don't handle this property, does the writer just overflow the buffer? Perhaps I don't understand the Stream itself - I'm regarding it as a FIFO pipe: shove data in at one end, and suck it out at the other. If it's not like this, then do I have to keep copying the data past my last read (ie from position 0x84 on) back to the start of my buffer? I've seriously tried to research all of this for quite some time - but I'm new to .NET. Perhaps the Streams have a long, proud (undocumented) history that everyone else implicitly understands. But for a newcomer, it's like reading the manual to your car, and finding out: The accelerator pedal affects the volume of fuel and air sent to the fuel injectors. It does not affect the volume of the entertainment system, or the air pressure in any of the tires, if fitted. Technically true, but seriously, what we want to know is that if we mash it to the floor you go faster..

    Read the article

  • How to undo SQL changes using installer

    - by Sunil Agarwal
    I have installer to install procedures, scripts, views, etc in SQL server 2005/2008. Now I want to add a condition in the installer like if there is any error while installing, I want to undo all the changes done in SQL server. I tried to store the procedures, views, etc which I am changing while installing and reverting them back if I get any error. But am not able to do it the way I want. Can someone guide me if he had done the same thing? To specify I am using WIX installer. Also if someone has tried SMO, it will be of great help.

    Read the article

  • cmd.exe Command Line Parsing of Environment Variables

    - by Artefacto
    I can't figure how to have cmd.exe not interpret something like %PATH% as an environment variable. Given this program: #include<stdio.h> #include<windows.h> int main(int argc, char *argv[]) { int i; printf("cmd line: %s\n", GetCommandLine()); for (i = 0; i < argc; i++) { printf("%d: %s\n", i, argv[i]); } return 0; } I have these different outputs according to the position of the arguments: >args "k\" o" "^%PATH^%" cmd line: args "k\" o" "%PATH%" 0: args 1: k" o 2: %PATH% >args "^%PATH^%" "k\" o" cmd line: args "^%PATH^%" "k\" o" 0: args 1: ^%PATH^% 2: k" o I guess it's because cmd.exe doesn't recognize the escaped \" and sees the escaped double quote as closing the first, leaving in the first case %PATH% unquoted. I say this, because if I don't quote the argument, it always works: >args ^%PATH^% "k\" o" cmd line: args %PATH% "k\" o" 0: args 1: %PATH% 2: k" o but then I can have no spaces...

    Read the article

  • Filling in a multi-choice field in a Sharepoint Doc-Lib using SetDocsMetaInfo Frontpage Server Extentions RPC method

    - by notnot
    I've been given a big chunk of code which eventually calls upon the SetDocsMetaInfo method from Frontpage Server Extension RPC. This is easy enough for most document uploading and property updating, except when dealing with multichoice fields. I've been scouring through MSDN and I can't find anything on how to fill in multiple values for such a field. The general syntax for properties is something like this: [SR|default], with the type (string in this case) followed by a pipe and then the value to be written. Does anyone know the syntax for multichoice fields? references: MSDN: SetDocsMetaInfo

    Read the article

  • python getelementbyid from string

    - by matthewgall
    Hey, I have the following program, that is trying to upload a file (or files) to an image upload site, however I am struggling to find out how to parse the returned HTML to grab the direct link (contained in a ). I have the code below: #!/usr/bin/python # -*- coding: utf-8 -*- import pycurl import urllib import urlparse import xml.dom.minidom import StringIO import sys import gtk import os import imghdr import locale import gettext try: import pynotify except: print "Please install pynotify." APP="Uploadir Uploader" DIR="locale" locale.setlocale(locale.LC_ALL, '') gettext.bindtextdomain(APP, DIR) gettext.textdomain(APP) _ = gettext.gettext ##STRINGS uploading = _("Uploading image to Uploadir.") oneimage = _("1 image has been successfully uploaded.") multimages = _("images have been successfully uploaded.") uploadfailed = _("Unable to upload to Uploadir.") class Uploadir: def __init__(self, args): self.images = [] self.urls = [] self.broadcasts = [] self.username="" self.password="" if len(args) == 1: return else: for file in args: if file == args[0] or file == "": continue if file.startswith("-u"): self.username = file.split("-u")[1] #print self.username continue if file.startswith("-p"): self.password = file.split("-p")[1] #print self.password continue self.type = imghdr.what(file) self.images.append(file) for file in self.images: self.upload(file) self.setClipBoard() self.broadcast(self.broadcasts) def broadcast(self, l): try: str = '\n'.join(l) n = pynotify.Notification(str) n.set_urgency(pynotify.URGENCY_LOW) n.show() except: for line in l: print line def upload(self, file): #Try to login cookie_file_name = "/tmp/uploadircookie" if ( self.username!="" and self.password!=""): print "Uploadir authentication in progress" l=pycurl.Curl() loginData = [ ("username",self.username),("password", self.password), ("login", "Login") ] l.setopt(l.URL, "http://uploadir.com/user/login") l.setopt(l.HTTPPOST, loginData) l.setopt(l.USERAGENT,"User-Agent: Uploadir (Python Image Uploader)") l.setopt(l.FOLLOWLOCATION,1) l.setopt(l.COOKIEFILE,cookie_file_name) l.setopt(l.COOKIEJAR,cookie_file_name) l.setopt(l.HEADER,1) loginDataReturnedBuffer = StringIO.StringIO() l.setopt( l.WRITEFUNCTION, loginDataReturnedBuffer.write ) if l.perform(): self.broadcasts.append("Login failed. Please check connection.") l.close() return loginDataReturned = loginDataReturnedBuffer.getvalue() l.close() #print loginDataReturned if loginDataReturned.find("<li>Your supplied username or password is invalid.</li>")!=-1: self.broadcasts.append("Uploadir authentication failed. Username/password invalid.") return else: self.broadcasts.append("Uploadir authentication successful.") #cookie = loginDataReturned.split("Set-Cookie: ")[1] #cookie = cookie.split(";",0) #print cookie c = pycurl.Curl() values = [ ("file", (c.FORM_FILE, file)) ] buf = StringIO.StringIO() c.setopt(c.URL, "http://uploadir.com/file/upload") c.setopt(c.HTTPPOST, values) c.setopt(c.COOKIEFILE, cookie_file_name) c.setopt(c.COOKIEJAR, cookie_file_name) c.setopt(c.WRITEFUNCTION, buf.write) if c.perform(): self.broadcasts.append(uploadfailed+" "+file+".") c.close() return self.result = buf.getvalue() #print self.result c.close() doc = urlparse.urlparse(self.result) self.urls.append(doc.getElementsByTagName("download")[0].childNodes[0].nodeValue) def setClipBoard(self): c = gtk.Clipboard() c.set_text('\n'.join(self.urls)) c.store() if len(self.urls) == 1: self.broadcasts.append(oneimage) elif len(self.urls) != 0: self.broadcasts.append(str(len(self.urls))+" "+multimages) if __name__ == '__main__': uploadir = Uploadir(sys.argv) Any help would be gratefully appreciated. Warm regards,

    Read the article

  • Android GridView - How to change a bitmap dynamically?

    - by Alborz
    Hello I have a gridView which I use to show some pictures on (small thumb of diffrent levels). When the user finishes one level, I would like to change the thumb for that level. (Somehow show that it has been completed). I created two thumbs for each level. One is the original and one that shows that the level is completed. But how can i change the source of the images? The code which I use to draw the images looks like this. The main activity: /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maps); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { //Open the map which was clicked on, if there is one if(position+1 > 1){ Toast.makeText(maps.this, "Level " + (position+1) + " is not yet available!", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(maps.this, "Opening Level " + (position+1), Toast.LENGTH_SHORT).show(); Intent myIntent = new Intent(v.getContext(), Tutorial2D.class); startActivity(myIntent); } } }); } The ImageAdapter Class: public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } //Changing imageView.setImageResource(mThumbIds[position]); return imageView; } // references to our images private Integer[] mThumbIds = { R.drawable.map1, R.drawable.map2, R.drawable.map3, R.drawable.map4, R.drawable.map5, R.drawable.map6, R.drawable.map7, R.drawable.map8, R.drawable.map9, R.drawable.map10, R.drawable.map11, R.drawable.map12, R.drawable.map13, R.drawable.map14, R.drawable.map15, R.drawable.map16, R.drawable.map17, R.drawable.map18, R.drawable.map19 }; }

    Read the article

  • Processing XML comments in order using SAX & Cyberneko

    - by Joel
    I'm using cyberneko to clean and process html documents. I need to be able to process all the comments that occur in the original html documents. I've configured the cyberneko sax parser to process comments like so: parser.setProperty("http://xml.org/sax/properties/lexical-handler", consumer); ...using the same consumer as I am for DOM events. I get a callback for each of the comments: @Override public void comment(char[] arg0, int arg1, int arg2) throws SAXException { System.out.println("COMMENT::: "+new String(arg0, arg1, arg2)); } The problem I have is that all the comments are processed first, out of context of the DOM. i.e. I get a callback for all the comments before the document head, body etc.... What I'd like is for the comment callbacks to occur in the order they occur in the DOM. Edit: what I'm actually trying to do is parse the instructions for IE in the original html, such as: <!--[if lte IE 6]><body class="news ie"><![endif]--> At the moment they are all dropped, I need to include them in the cleaned HTML document.

    Read the article

  • Web Matrix released

    - by TATWORTH
    Microsoft have now released Web Matrix (and ASP.NET MVC3 if you so inclined!) One signifcant utility is IIS Express which will replace Cassini It is worth noting that SP1 for VS2010 should be out in Q1. Links: http://www.hanselman.com/blog/ASPNETMVC3WebMatrixNuGetIISExpressAndOrchardReleasedTheMicrosoftJanuaryWebReleaseInContext.aspx http://www.hanselman.com/blog/LinkRollupNewDocumentationAndTutorialsFromWebPlatformAndTools.aspx http://arstechnica.com/microsoft/news/2011/01/microsoft-releases-free-webmatrix-web-development-tool.ars I am impressed by the copious tutorials on MVC, which I include below: Intro to ASP.NET MVC 3 onboarding series. Scott Hanselman and Rick Anderson collaboration and Mike Pope (Editor) Both C# and VB versions: Intro to ASP.NET MVC 3 Adding a Controller Adding a View Entity Framework Code-First Development Accessing your Model's Data from a Controller Adding a Create Method and Create View Adding Validation to the Model Adding a New Field to the Movie Model and Table Implementing Edit, Details and Delete Source code for this series MVC 3 Updated and new tutorials/ API Reference on MSDN Rick Anderson (Lead Programming Writer), Keith Newman and Mike Pope (Editor) ASP.NET MVC 3 Content Map ASP.NET MVC Overview MVC Framework and Application Structure Understanding MVC Application Execution Compatibility of ASP.NET Web Forms and MVC Walkthrough: Creating a Basic ASP.NET MVC Project Walkthrough: Using Forms Authentication in ASP.NET MVC Controllers and Action Methods in ASP.NET MVC Applications Using an Asynchronous Controller in ASP.NET MVC Views and UI Rendering in ASP.NET MVC Applications Rendering a Form Using HTML Helpers Passing Data in an ASP.NET MVC Application Walkthrough: Using Templated Helpers to Display Data in ASP.NET MVC Creating an ASP.NET MVC View by Calling Multiple Actions Models and Validation in ASP.NET MVC How to: Validate Model Data Using DataAnnotations Attributes Walkthrough: Using MVC View Templates How to: Implement Remote Validation in ASP.NET MVC Walkthrough: Adding AJAX Scripting Walkthrough: Organizing an Application using Areas Filtering in ASP.NET MVC Creating Custom Action Filters How to: Create a Custom Action Filter Unit Testing in ASP.NET MVC Applications Walkthrough: Using TDD with ASP.NET MVC How to: Add a Custom ASP.NET MVC Test Framework in Visual Studio ASP.NET MVC 3 Reference System.Web.Mvc System.Web.Mvc.Ajax System.Web.Mvc.Async System.Web.Mvc.Html System.Web.Mvc.Razor

    Read the article

  • RDP locks up login, doesn't unlock on Windows

    - by private_meta
    From time to time, my system, when I try to login TRHOUGH or AFTER a remote connection, locks up the login session. I can't login anymore, the screen turns black (the monitor is still active, the image is black). Especially in the recent case, the system did not come back from the lock-up, and I had to reset the computer. Any idea what might be the issue here? More information: Both Computers are Windows 7, The RDP Server has a wired connection, the Client has either Wireless or Wired. The network card involved on the server is a "Realtek RTL8168C(P)/8111C(P) Family PCI-E Gigabit Ethernet NIC (NDIS 6.20)" card built-in on an ASRock Mainboard. I'm using either local LAN or internet connection through NAT/Router.

    Read the article

  • VPN server on Windows Server 2008 for a small office

    - by cmbrnt
    I'm going to refurbish the IT-infrastructure for a small organization with one single office, and I'm not sure what VPN server to use. In your opinion, would the built-in Windows Server 2008 VPN server suffice or are there any specific problems with it as opposed to, for example, OpenVPN? I'd rather run a Windows native VPN server, but if there are few (preferably free) good alternatives, I could install VMware ESXi and virtualize both Windows and an OpenVPN-server. By the way, because of a low budget this office runs a solution with only one physical server. Any advice would be great to help me grasp this field of which I'm quite a novice. Thank you!

    Read the article

  • Why has Google toolbar has stopped working in Firefox 3.6.8?

    - by DanM
    Yesterday, I noticed that my Google Toolbar has stopped working. The toolbar is still there, but it is completely blank (no buttons or input fields, just a gray strip of nothing). In addition to this, tooltips have stopped working. If I disable the toolbar, the tooltips return to normal, so that particular problem definitely seems to be a side effect of the toolbar. I tried disabling all my other add-ons, but that made no difference. I also tried uninstalling and reinstalling Google Toolbar. That made no difference. I haven't tried reinstalling the browser, but I'm reluctant to do that unless absolutely necessary. Am I the only one having this problem? Any ideas how to fix? Note: I'm running Windows XP SP3. I'm using Google Toolbar version 7.1.20100723W.

    Read the article

  • How to stay connected on remote desktop even if different user tires to connect

    - by Darqer
    I'm logging through Remote Desktop to windows 7. Some other users sometimes tries to connect to the same computer, then a message box pops up with information that I have 30 to break this trial or I will be logged off. Sometimes I'm away and then I'm being logged off and when I come back I have to log on again. Is there a way to turn off this functionality for single user. Is there some application that always break this login process ?

    Read the article

  • Image annotation with Inkscape, Pointer and explanation for objects in picture

    - by None
    I need straight paths with end markers for associating text to parts of the image. For better readability, it needs to be high-contrast, i.e. a white line with black outline. Stroke to path will create a group of a box and a circle from the line with end marker. This makes placement of the markers more difficult, as with the node tool it is just a matter of dragging the end nodes of a line segment. I will try to place the markers as line for now and only finally converting them to an outline.

    Read the article

  • Desktop Fun: Triple Monitor Wallpaper Collection Series 1

    - by Asian Angel
    Triple monitor setups provide spacious amounts of screen real-estate but can be extremely frustrating to find good wallpapers for. Today we present the first in a series of wallpaper collections to help decorate your triple monitor setup with lots of wallpaper goodness. Note: Click on the picture to see the full-size image—these wallpapers vary in size so you may need to crop, stretch, or place them on a colored background in order to best match them to your screen’s resolution. Special Note: The screen resolution sizes available for each of these wallpapers has been included to help you match them up to your individual settings as easily as possible. All images shown here are thumbnail screenshots of the largest size available for download. Available in the following resolutions: 3840*1024, 4096*1024, 4320*900, 4800*1200, 5040*1050, and 5760*1200. Available in the following resolutions: 4800*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, and 4800*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, and 4800*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, 5040*1050, and 5760*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, and 4800*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, and 5040*1050. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, and 5040*1050. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, and 4800*1200. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, and 5040*1050. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4800*1200, and 5040*1050. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, 5040*1050, 5760*1200, and 7680*1600. Available in the following resolutions: 3840*960, 3840*1024, 4096*1024, 4320*900, 4800*1200, 5040*1050, and 5760*1200. Available in the following resolutions: 5760*1200. Available in the following resolutions: 5760*1200. More Triple Monitor Goodness Beautiful 3 Screen Multi-Monitor Space Wallpaper Span the same wallpaper across multiple monitors or use a different wallpaper for each. Dual Monitors: Use a Different Wallpaper on Each Desktop in Windows 7, Vista or XP For more wallpapers be certain to see our great collections in the Desktop Fun section. Latest Features How-To Geek ETC How to Upgrade Windows 7 Easily (And Understand Whether You Should) The How-To Geek Guide to Audio Editing: Basic Noise Removal Install a Wii Game Loader for Easy Backups and Fast Load Times The Best of CES (Consumer Electronics Show) in 2011 The Worst of CES (Consumer Electronics Show) in 2011 HTG Projects: How to Create Your Own Custom Papercraft Toy Firefox 4.0 Beta 9 Available for Download – Get Your Copy Now The Frustrations of a Computer Literate Watching a Newbie Use a Computer [Humorous Video] Season0nPass Jailbreaks Current Gen Apple TVs IBM’s Jeopardy Playing Computer Watson Shows The Pros How It’s Done [Video] Tranquil Juice Drop Abstract Wallpaper Pulse Is a Sleek Newsreader for iOS and Android Devices

    Read the article

  • Can turning off drm_kms_helper polling affect screen brightness control?

    - by dodecaphonic
    I have a Samsung R430 notebook that has been running Ubuntu for close to a year, now. Since I've upgrated to Maverick, I've been dealing with little, but increasingly annoying issues, that put my faith to question. The first one, a CPU-intensive set of drm_kms_helper, made me compile my own kernel and set polling to off just so I could move my mouse without frequent stuttering. That led me to dealing with a screen that gets dimmer and dimmer after each sleep/wake-up cycle, which eventually leads me to reboot. Since I have seen some KMS and brightness related bugs around, I was wondering if it is a definite cause for my problem. If so, has there been any advance on the excessive polling issue for those of us plagued by it?

    Read the article

  • How to connect two files and use the radio button?

    - by Stupefy101
    I have here a set of form from the index.php to upload a zip file, select an option then perform a converter process. <form action="" method="post" accept-charset="utf-8"> <p class="buttons"><input type="file" value="" name="zip_file"/></p> </form> <form action="index.php" method="post" accept-charset="utf-8" name="form1"> <h3><input type="radio" name="option" value="option1"/> Option1 </h3> <h3><input type="radio" name="option" value="option2"/> Option2 </h3> <h3><input type="radio" name="option" value="option3"/> Option3 </h3> <p class="buttons"><input type="submit" value="Convert"/></p> </form> In the other hand, this is my code for the upload.php that will extract the Zip file. <?php if($_FILES["zip_file"]["name"]) { $filename = $_FILES["zip_file"]["name"]; $source = $_FILES["zip_file"]["tmp_name"]; $type = $_FILES["zip_file"]["type"]; $name = explode(".", $filename); $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); foreach($accepted_types as $mime_type) { if($mime_type == $type) { $okay = true; break; } } $continue = strtolower($name[1]) == 'zip' ? true : false; if(!$continue) { $message = "The file you are trying to upload is not a .zip file. Please try again."; } $target_path = "C:xampp/htdocs/themer/".$filename; // change this to the correct site path if(move_uploaded_file($source, $target_path)) { $zip = new ZipArchive(); $x = $zip->open($target_path); if ($x === true) { $zip->extractTo("C:xampp/htdocs/themer/"); // change this to the correct site path $zip->close(); unlink($target_path); } $message = "Your .zip file was uploaded and unpacked."; } else { $message = "There was a problem with the upload. Please try again."; } } ?> How can i connect both files that will perform the extracting process? And how to include the codes for radio button after submission? Please Help.

    Read the article

  • Switch gettext translated language with original language

    - by Ruben
    Hi everyone, I started my PHP application with all text in German, then used gettext to extract all strings and translate them to English. So, now I have a .po file with all msgids in German and msgstrs in English. I want to switch them, so that my source code contains the English as msgids. There are numerous reasons for this: More translators will know English, so it is only appropriate to serve them up a file with msgids in English. I could always switch the file before I give it out and after I receive it It would help me to write English object & function names and comments if the content text was also English. I'd like to do that, so the project is more open to other Open Source collaborators (more likely to know English than German). I could do this manually and this is the sort of task where I anticipate it will take me more time to write an automated routine for it (because I'm very bad with shell scripts) than do it by hand. But I also anticipate despising every minute of manual computer labour (feels like a oxymoron, right?) like I always do. Has someone done this before? I figured this would be a common problem, but couldn't find anything. Many thanks ahead. Sample Problem: <title><?=_('Routinen')?></title> #: /users/ruben/sites/v/routinen.php:43 msgid "Routinen" msgstr "Routines"

    Read the article

  • How do I get a remote tracking branch to stay up to date with remote origin in a bare Git repository?

    - by Beau Simensen
    I am trying to maintain a bare copy of a Git repository and having some issues keeping the remote tracking branches up to date. I create the remote tracking branches like this: git branch -t 0.1 origin/0.1 This seems to do what I need to do for that point in time. However, if I make changes to origin and then fetch with the bare repo, things start to fall apart. My workflow looks like this: git fetch origin It looks like all of the commits come in at that point, but my local copy of 0.1 is not being updated. I can see that the changes have been brought into the repository by doing the following: git diff 0.1 refs/remotes/origin/0.1 What do I need to do to get my tracking branch updated with the remote's updates? I feel like I must be missing a step or a flag somewhere.

    Read the article

  • Why is Python 3.1.3 in the header listed as a syntax error?

    - by squashua
    Hi, I'm a newbie programmer so I'll do my best to clearly ask my question. I'm running Python scripts in Mac 10.6.5 and now trying to write and save to a text file (following instructions in HeadsUp Python book). Whenever I hit function+F5 (as instructed) I get the same "invalid syntax" error and Idle highlights the "1" in "Python 3.1.3" of the header. Here's the header to which I'm referring: Python 3.1.3 (r313:86882M, Nov 30 2010, 09:55:56) [GCC 4.0.1 (Apple Inc. build 5494)] on darwin Type "copyright", "credits" or "license()" for more information. Extremely frustrating. I've checked and rechecked the code but this doesn't seem to be code related because the "syntax error" is in regards to the header text that posts in every Idle/Python session. Help anyone? Thanks, Squash

    Read the article

  • Floating images with multiple sizes in CSS

    - by Jamie Chapman
    I'm wanting to be able to create a banner of floating images based on what are uploaded via users. The tool needs to have images of 50x50 and 100x100. At the moment, I just want to randomly display the images and tried to apply float:left. However, as you can see below - it leaves gaps. Is there an easy way to do this without programatically positioning the images? If you want the code so far, it's here: .wall { width: 300px; background-color: red; display: table; } .wall img { float: left; } and <div class="wall"> <img src="man1.png" alt=""/> <!-- ETC... !--> </div>

    Read the article

  • Java method keyword "final" and its use

    - by Lukas Eder
    When I create complex type hierarchies (several levels, several types per level), I like to use the final keyword on methods implementing some interface declaration. An example: interface Garble { int zork(); } interface Gnarf extends Garble { /** * This is the same as calling {@link #zblah(0)} */ int zblah(); int zblah(int defaultZblah); } And then abstract class AbstractGarble implements Garble { @Override public final int zork() { ... } } abstract class AbstractGnarf extends AbstractGarble implements Gnarf { // Here I absolutely want to fix the default behaviour of zblah // No Gnarf shouldn't be allowed to set 1 as the default, for instance @Override public final int zblah() { return zblah(0); } // This method is not implemented here, but in a subclass @Override public abstract int zblah(int defaultZblah); } I do this for several reasons: It helps me develop the type hierarchy. When I add a class to the hierarchy, it is very clear, what methods I have to implement, and what methods I may not override (in case I forgot the details about the hierarchy) I think overriding concrete stuff is bad according to design principles and patterns, such as the template method pattern. I don't want other developers or my users do it. So the final keyword works perfectly for me. My question is: Why is it used so rarely in the wild? Can you show me some examples / reasons where final (in a similar case to mine) would be very bad?

    Read the article

  • Android repeating alarm not working

    - by erdomester
    This works fine: Intent intent = new Intent(HelloAndroid2.this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(HelloAndroid2.this, 0, intent, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (12 * 1000), pendingIntent); This doesn't work. I hear the alarm only time. alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (12 * 1000), 3 * 1000, pendingIntent); I have also tried this, no luck: Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.SECOND, 5); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 7000, pendingIntent); What is the problem?

    Read the article

  • jquery: iterating through various ul's list-items?

    - by user239831
    hey guys, someone already helped me solving the following problem: i wanted to iterate with my up and down arrows through list-items. http://jsfiddle.net/zBjrS/1/ in this example i only had one UL and wanted to navigate through its list-items. meannwhile i have multiple ul's underneath each other and want to navigate seemlessly through all of them as if there were only one UL. http://jsfiddle.net/zBjrS/2/ any idea how i could do that? thank you

    Read the article

  • Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse

    - by James Lawruk
    I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was hoping to get the actual numbers (200, 301,302, 404, etc.) rather than the text description. ("Ok", "MovedPermanently", etc.) Is the number buried in a property somewhere in the response object? Any ideas other than creating a big switch function? Thanks. HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://www.gooogle.com/"); webRequest.AllowAutoRedirect = false; HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse(); //Returns "MovedPermanently", not 301 which is what I want. Console.Write(response.StatusCode.ToString());

    Read the article

  • AS3/AIR: Managing Run-Time Image Data

    - by grey
    I'm developing a game with AS3 and AIR. I will have a large-ish quantity of images that I need to load for display elements. It would be nice not to embed all of the images that the game needs, thereby avoiding having them all in memory at once. That's okay in smaller projects, but doesn't make sense here. I'm curious about strategies for loading images during run time. Since all of the files are quite small and local ( in my current project ) loading them on request might be the best solution, but I'd like to hear what ideas people have for managing this. For bonus points, I'm also curious about solutions for loading images on-demand server-side as well.

    Read the article

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