Daily Archives

Articles indexed Monday May 3 2010

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

  • SQL to retrieve the latest records, grouping by unique foreign keys

    - by jbox
    I'm creating query to retrieve the latest posts in a forum using a SQL DB. I've got a table called "Post". Each post has a foreign key relation to a "Thread" and a "User" as well as a creation date. The trick is I don't want to show two posts by the same user or two posts in the same thread. Is it possible to create a query that contains all this logic? # Grab the last 10 posts. SELECT id, user_id, thread_id FROM posts ORDER BY created_at DESC LIMIT 10; # Grab the last 10 posts, max one post per user SELECT id, user_id, thread_id FROM post GROUP BY user_id ORDER BY date DESC LIMIT 10; # Grab the last 10 posts, max one post per user, max one post per thread???

    Read the article

  • wire colors: color vs black vs white (positive vs negative voltage)

    - by David Oneill
    I'm working on building a computer (first time for me). There are several plugs that I need to connect to the motherboard (Power LED, reset switch, etc). Of the two wires, they are either: Color and white (reset switch, power LED, HDD LED) red and black (speaker, power switch) The manual for the motherboard has a nice diagram of where to plug them in, but has them labeled + or -. Which colors are positive, and which are negative?

    Read the article

  • NX Client running on OS X 10.6.3 => NX Server Ubuntu 10.04: weird keymapping issue

    - by Mike D
    I have been using Ubuntu 9.10 at work after switching from vista. After being (expectedly) disappointed with performance over VNC (via VPN) when logging in from home, I came across the NOMACHINE suite. Last week, I upgraded from OS X 10.6.2 = 10.6.3 at home. After that, I also updated my NX Client at home to the latest version, as there were issues with recent changes in the OSX X11 setup that rendered the NX connection useless. At that point, everything worked fine. Fast forward, I upgraded from 9.10 = 10.04 on my work machine the next day, and after coming home and trying to log-in remotely, I noticed that the "s" and "m" keys, when pressed locally, acted as if the meta key was being pressed on the remote machine. That is, the "s" key opens in the Ubuntu login menu (the power icon), and the "m" key opens the messaging menu. I found some info on using xmodmap to remap keys, however, I can't even begin to fathom what keys I could remap to solve this issue. Any ideas?

    Read the article

  • Testing performance of queries in mysl

    - by Unreason
    I am trying to setup a script that would test performance of queries on a development mysql server. Here are more details: I have root access I am the only user accessing the server Mostly interested in InnoDB performance The queries I am optimizing are mostly search queries (SELECT ... LIKE '%xy%') What I want to do is to create reliable testing environment for measuring the speed of a single query, free from dependencies on other variables. Till now I have been using SQL_NO_CACHE, but sometimes the results of such tests also show caching behaviour - taking much longer to execute on the first run and taking less time on subsequent runs. If someone can explain this behaviour in full detail I might stick to using SQL_NO_CACHE; I do believe that it might be due to file system cache and/or caching of indexes used to execute the query, as this post explains. It is not clear to me when Buffer Pool and Key Buffer get invalidated or how they might interfere with testing. So, short of restarting mysql server, how would you recommend to setup an environment that would be reliable in determining if one query performs better then the other?

    Read the article

  • Overloading new, delete in C++

    - by user265260
    i came across this line is stroustrup An operator function must either be a member or take at least one argument of a user-defined type (functions redefining the new and delete operators need not). Dont operator new and operator delete take an user defined type as one of their arguments? what does it mean, am i missing something here

    Read the article

  • Dim Window when Menu opened in Android

    - by Casebash
    In Android, when an alert appears, the background is dimmed. I would like a similar effect for when the menu is opened. I tried the following code, but it didn't work: @Override public boolean onMenuOpened(int featureId, Menu m) { boolean ret=super.onMenuOpened(featureId,m); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); return ret; } Does anyone know how to achieve this?

    Read the article

  • Custom certificate as proof of transaction

    - by Andy
    I'm developing a site where a user conducts a given transaction and once completed, the user is issued with a 'secure certificate'. The certificate serves as proof of the transaction and the user is able to upload the certificate at a later stage, to view the details of the transaction. At the moment I'm using a custom XML document with encrypted fields. It works perfect, but I would like a standardized approach, such as an X.509 certificate. I'm no encryption expert, but from what I gather, X.509 is more geared towards SSL issued by a CA. Is it possible to create your own valid valid CRT file? As a test, I created a CRT file with the example provided on WikiPedia. However, when I open the file in Windows I get this warning: Invalid Public Key Security Object File - This file is invalid as the following: Security Certificate. Not having much luck here, so time to ask the experts. What direction should I be heading in? Any guidance would be greatly appreciated.

    Read the article

  • In the Mobile and Tablet World, How Much is Too Much?

    - by andrewbrust
    The week of April 26th was a huge one in the world of mobile and tablet devices,  There were so many individual developments, announcements and solidifications of strategy, it’s almost impossible to believe they occurred in the same month, let alone the same week. Things started with Apple and Gizmodo having a Law and Order moment over the latter’s procurement of what appears to be the former’s 4th gen iPhone prototype.  We found out on the 26th that Gizmodo blogger Jason Chen’s apartment was raided by police and, honestly, that was a bit much. But Apple didn’t stop there.  They also published Steve Job’s critique of Adobe Flash and his explanation of Cupertino’s embargo of Flash on iPhones, iPods and iPads.  If you ask me, this too, was a bit much. Apple finished up the week by releasing the 3G version of its iPad product to the US market. I like (iLike?) my WiFi iPad.  The idea of getting a version of it that required a second 3G service monthly subscription, is, well, a bit  much. Microsoft was in the news too.  It killed a project it hadn’t even acknowledged the existence of: the Courier tablet.  That’s a bit much too.  If a tree falls in the woods, and Microsoft says they can’t hear it anyway, could they really have chopped it down? Maybe Microsoft Research should have licensed some of Courier’s technology from other parts of Microsoft.  Then maybe they could have kept the product alive.  Ask HTC: they’re going to be licensing technology from Microsoft because Redmond insists that Google’s Android operating system infringes on certain of their patents.  And since HTC now builds a number of handsets on Android, instead of being beholden, as they once were, to Windows Mobile, that means they can keep making their products.  Why does HTC have to pay the royalties, and not Google?  Maybe Microsoft decided that going after GOOG would have been a bit much, even for them. The agreement came not a moment to soon: HTC released their “Droid Incredible” (that name’s a bit much), an Android 2.1 handset with amazing hardware and HTC’s own Sense UI, on April 30th (this past Friday). This phone is very well-reviewed.  Maybe that’s why Google basically decided to beg off introducing a version of its Nexus One phone (also manufactured by HTC) on the Verizon Wireless network.  Google backing down?  That’s incredible, if not also a bit much. And that brings us to HP.  Which this week announced its acquisition of Palm and its webOS mobile phone touch-oriented operating system.  HP also killed its own Slate initiative.  Apparently HP realized that Windows 7, even with a proprietary HP touch UI added on top, is no match for the iPad.  I’m guessing they think webOS might work a bit better,  And I’m wondering if HP even wants to use webOS for phone handsets, beyond the Pre and Pixi.  Using it just for slate devices would be a bit extreme, but maybe not too much. Honestly, this was not Microsoft’s best week.  It killed a project and a close partner did likewise.  Then that same partner bought a competing OS product, while another partner released their new product that uses yet another competing OS platform. What did Microsoft actually produce this past week? An update to its Windows Phone 7 developer tools that actually works with the version of Visual Studio 2010 released on April 12th, and the version of Silverlight released three days later. That took three weeks to get synced up, and that’s a bit much too. But at least it happened. Windows Phone 7 is Microsoft’s best hope for a comeback in the SmartPhone market and to offer a credible touch-based tablet device.  This week, two of Microsoft’s slate initiatives died, and its only mobile phone victory was around its competitor’s operating system.  I hope the new platform gets Redmond out of the PC ghetto and into the classes of device that get people really excited today.  If it can’t, that would be a bit much; probably too much.  And, as the signs at the Lonestar Cafe in NYC used to say, too much ain’t enough.

    Read the article

  • Hooking up my power switch/reset switch/LEDs

    - by David Oneill
    I'm working on building a computer (first time for me). There are several plugs that I need to connect to the motherboard (Power LED, reset switch, etc). Of the two wires, they are either: Color and white (reset switch, power LED, HDD LED) red and black (speaker, power switch) The manual for the motherboard has a nice diagram of where to plug them in, but has them labeled + or -. Which colors are positive, and which are negative?

    Read the article

  • What is the best way to implement an object cache with Entity Framework?

    - by Harshal
    Say I have a table of "BlogPosts" in a database and i want to be able to cache the ones that were retrieved already in memory, for further reads, I can just use a standard hashtable type memory cache like System.Web.Caching.Cache, but if i then need to update a property on one of these blog posts e.g. blogPost.Title and update the record in DB, i cannot do this without fetching it again from database as the Entity Framework context used to fetch this record when it was loaded into my cache is already disposed? How do I write code so that I am getting an object from my cache, updating one property and just calling the SaveChanges method without incurring an extra read.

    Read the article

  • How to fix IllegalStateException error when trying to update a listview?

    - by Michael Vetrano
    Hi guys, I am trying to get this code to run, but I get an IllegalStateException when I run this code saying that the content of the listview wasn't notified, yet I have a notification upon updating the data. This is a custom listview adapter. Here is the relevant part of my code: class LoadingThread extends Thread { public void run() { int itemsOriginallyLoaded = 0; synchronized( items ) { itemsOriginallyLoaded = items.size(); } for( int i = itemsOriginallyLoaded ; i < itemsToLoad ; ++i ) { Log.d( LOG_TAG, "Loading item #"+i ); //String item = "FAIL"; //try { String item = "FAIL"; try { item = stockGrabber.getStockString(dataSource.get(i)); } catch (ApiException e) { Log.e(LOG_TAG, "Problem making API request", e); } catch (ParseException e) { Log.e(LOG_TAG, "Problem parsing API request", e); } //} catch (ApiException e) { // Log.e(TAG, "Problem making API request", e); //} catch (ParseException e) { // Log.e(TAG, "Problem parsing API request", e); //} synchronized( items ) { items.add( item ); } itemsLoaded = i+1; uiHandler.post( updateTask ); Log.d( LOG_TAG, "Published item #"+i ); } if( itemsLoaded >= ( dataSource.size() - 1 ) ) allItemsLoaded = true; synchronized( loading ) { loading = Boolean.FALSE; } } } class UIUpdateTask implements Runnable { public void run() { Log.d( LOG_TAG, "Publishing progress" ); notifyDataSetChanged(); } }

    Read the article

  • Consecutive 'if' statements

    - by Ben Packard
    How can I check one thing AND THEN another, if the first is true? For example, say I have a shopping basket object, and I only want to do something if the basket has been created AND it isn't empty. I've tried: if (basket && [basket numberOfItems >0])... But the second condition is evaluated even if the first fails, resulting in a crash (presumably because i'm calling numberOfItems on an object that doesn't exist). I can nest them, but this seems a bit ugly, and more to the point is problematic. Say I want to do one thing if the basket exists AND isn't empty, but another if either isn't true. That doesn't really work well in nested if statements.

    Read the article

  • Pass elements of a list as arguments to a function in python

    - by Wilduck
    I'm building a simple interpreter in python and I'm having trouble handling differing numbers of arguments to my functions. My current method is to get a list of the commands/arguments as follows. args = str(raw_input('>> ')).split() com = args.pop(0) Then to execute com, I check to see if it is in my dictionary of command- code mappings and if it is I call the function I have stored there. For a command with no arguments, this would look like: commands[com]() However, if a command had multiple arguments, I would want this: commands[com](args[0],args[1]) Is there some trick where I could pass some (or all) of the elements of my arg list to the function that I'm trying to call? Or is there a better way of implementing this without having to use python's cmd class?

    Read the article

  • Objective-C scanf spaces issue

    - by Rob
    I am learning objective-C and for the life of me can't figure out why this is happening. When the user inputs when the code is: scanf("%c %lf", &operator, &number); For some reason it messes with this code: doQuit = 0; [deskCalc setAccumulator: 0]; while (doQuit == 0) { NSLog(@"Please input an operation and then a number:"); scanf("%c %lf", &operator, &number); switch (operator) { case '+': [deskCalc add: number]; NSLog (@"%lf", [deskCalc accumulator]); break; case '-': [deskCalc subtract: number]; NSLog (@"%lf", [deskCalc accumulator]); break; case '*': case 'x': [deskCalc multiply: number]; NSLog (@"%lf", [deskCalc accumulator]); break; case '/': if (number == 0) NSLog(@"You can't divide by zero."); else [deskCalc divide: number]; NSLog (@"%lf", [deskCalc accumulator]); break; case 'S': [deskCalc setAccumulator: number]; NSLog (@"%lf", [deskCalc accumulator]); break; case 'E': doQuit = 1; break; default: NSLog(@"You did not enter a valid operator."); break; } } When the user inputs for example "E 10" it will exit the loop but it will also print "You did not enter a valid operator." When I change the code to: scanf(" %c %lf", &operator, &number); It all of a sudden doesn't print this last line. What is it about the space before %c that fixes this?

    Read the article

  • Flash player inside a div is moving the whole page wrapper down in IE (why?)

    - by janoChen
    I placed the flash player using: position: absolute; top: 20; right: 40; in the div around it. css: #page { position: relative; } #flashplayer { position: absolute; top: 10px; right: 30px; } (as you can see #page is relative) html: <div id="page"> <div id="flashplayer"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="35"> <param name="movie" value="music_player/player_mini.swf" /> <param name="quality" value="high" /> <embed src="music_player/player_mini.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="300" height="35"></embed> </object> </div> <div id="formfloat"> the page: http://ada.kiexpro.com/test/

    Read the article

  • iphone app submission errors

    - by Oliver
    When I try to add my application, I get Info.plist does not contain a CFBundleResourceSpecification and Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. I don't understand! I'm so frustrated, I finished my two apps and now I can't submit them. I checked the provisioning licenses and app ids and that whole process a many times over, I dunno what I'm doing wrong here. Can anyone help? :(

    Read the article

  • Why modules link is not coming on Administrator Main page?

    - by Nitz
    I have added two modules in my drupal site called.... 1. me alias 2. Mime mail Whenever we add new modules to our site, it has links on admin page. but after activating modules, i can't see the links on admin page. but this happens only on server but on my localhost i can see the modules links on admin page. i have put screenshot of the problem, in image you can see that, i have activated both modules but on admin page....i can't see its links. why is not activated. i have tried to clear all the cache and then try again but its not coming then also. Here is the screen shot

    Read the article

  • Hibernate HQL and Grails- How do I compare collections?

    - by BurtP
    Hi everyone (my first post!), I have an HQL question (in Groovy/Grails) I was hoping someone could help me with. I have a simple Asset object with a one-to-many Tags collection. class Asset { Set tags static hasMany = [tags:Tag] } class Tag { String name } What I'm trying to do in HQL: A user passes in some tags in params.tags (ex: groovy grails rocks) and wants to return Asset(s) that have those tags, and only those exact tags. Here's my HQL that returns Assets if one or more of the tags are present in an Assets tags: SELECT DISTINCT a FROM Asset a LEFT JOIN a.tags t WHERE t IN (:tags) assetList = Asset.executeQuery( hql, [tags:tokenizedTagListFromParams] The above code works perfect, but its really like an OR. If any of the tag(s) are found, it will return that Asset. I only want to return Assets that have those exact same tags (in number as well). Every time a new tag is created, I new Tag(name:xxx).save() so I can get the Tag instances and unique ID's for each tag that was asked for. I also tried converting the passed in tags to a list of Tag instances with Tag.findByName(t1) for each tag, and also a list of (unique) Tag Id's into the HQL above with no luck. I would appreciate any help/advice. Thank you for your time, Burt

    Read the article

  • How to adjust Aspect Ratio in Windows Media Center

    - by Svish
    Is there any way of adjusting the aspect ratio of movies I view in Windows Media Center on Windows 7 RTM x64? Any hidden features? Any brilliant light weight plugins? Using Shark007 Codecs, and otherwise just default Media Center and Media Player. I know I could reprocess the videos, but that would probably ruin the already bad quality. I also know I could use VLC media player, but I really would like to find a solution that works in Media Center, since VLC media player isn't especially Remote Control and media collection friendly... Update: By the way, I know I can Ctrl+Drag an edge of the media center in window mode and change the aspect ratio of the player, but that doesn't do anything to the video.

    Read the article

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