Daily Archives

Articles indexed Sunday January 9 2011

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

  • How to set layout_span through code

    - by L4N0
    Hi, Does anyone know how to set/change the android:layout_span="" of an EditText in Android at runtime. I already have the EditText defined in my XML file. <TableRow android:paddingTop="20dip" android:gravity="center_horizontal"> <EditText android:layout_width="150dip" android:text="" android:layout_height="40dip" android:id="@+id/p" android:layout_span="2"></EditText></TableRow>

    Read the article

  • Div's visibility with javascript - problem

    - by sammville
    I am trying to use div's to display content on my page. This is controlled with an onchange element in a select menu. It works perfectly but the problem is I want one div to close when another one is opened. The div's open fine but it does not close the others. An example code is below. What am I doing wrong? JavaScript: if(document.getElementById('catgry').value == '01'){ document.getElementById('post04').style.visibility = "visible"; document.getElementById('post04').style.display = ""; document.getElementById('post07').style.visibility = "hidden"; document.getElementById('post07').style.display = "none"; }else if(document.getElementById('catgry').value == '02'){ document.getElementById('post02').style.visibility = "visible"; document.getElementById('post02').style.display = ""; document.getElementById('post04').style.visibility = "hidden"; document.getElementById('post04').style.display = "none"; document.getElementById('post07').style.visibility = "hidden"; document.getElementById('post07').style.display = "none"; } HTML: <div id="post04" style="visibility:hidden; display:none;"> <table class="posttb"><tr> <td width="30%">Author</td> <td><input type="text" name="author" size="30" class="postfd"></td> </tr> </table> </div>

    Read the article

  • Nested sql queries in rails when :has_and_belongst_to_many

    - by Godisemo
    Hello, In my application I the next task that has not already been done by a user. I have Three models, A Book that has many Tasks and then I have a User that has has and belongs to many tasks. The table tasks_users table contains all completed tasks so I need to write a complex query to find the next task to perform. I have came up with two solutions in pure SQL that works, but I cant translate them to rails, thats what I need help with SELECT * FROM `tasks` WHERE `tasks`.`book_id` = @book_id AND `tasks`.`id` NOT IN ( SELECT `tasks_users`.`task_id` FROM `tasks_users` WHERE `tasks_users`.`user_id` = @user_id) ORDER BY `task`.`date` ASC LIMIT 1; and equally without nested select SELECT * FROM tasks LEFT JOIN tasks_users ON tasks_users.tasks_id = task.id AND tasks_users.user_id = @user_id WHERE tasks_users.task_id IS NULL AND tasks.book_id = @book_id LIMIT 1; This is what I Have done in rails with the MetaWhere plugin book.tasks.joins(:users.outer).where(:users => {:id => nil}) but I cant figure out how to get the current user there too, Thanks for any help!

    Read the article

  • Trying to build the basic python extension example fails (windows)

    - by Alexandros
    Hello, I have Python 2.6 and Visual Studio 2008 running on a Win7 x64 machine. When I try to build the basic python extension example in c "example_nt" as found in the python 2.6 sources distribution, it fails: python setup.py build And this results in: running build running build_ext building 'aspell' extension Traceback (most recent call last): File "setup.py", line 7, in <module> ext_modules = [module1]) File "C:\Python26\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands self.run_command(cmd) File "C:\Python26\lib\distutils\dist.py", line 995, in run_command cmd_obj.run() File "C:\Python26\lib\distutils\command\build.py", line 134, in run self.run_command(cmd_name) File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command self.distribution.run_command(command) File "C:\Python26\lib\distutils\dist.py", line 995, in run_command cmd_obj.run() File "C:\Python26\lib\distutils\command\build_ext.py", line 343, in run self.build_extensions() File "C:\Python26\lib\distutils\command\build_ext.py", line 469, in build_extensions self.build_extension(ext) File "C:\Python26\lib\distutils\command\build_ext.py", line 534, in build_extension depends=ext.depends) File "C:\Python26\lib\distutils\msvc9compiler.py", line 448, in compile self.initialize() File "C:\Python26\lib\distutils\msvc9compiler.py", line 358, in initialize vc_env = query_vcvarsall(VERSION, plat_spec) File "C:\Python26\lib\distutils\msvc9compiler.py", line 274, in query_vcvarsall raise ValueError(str(list(result.keys()))) ValueError: [u'path'] What can I do to fix this? Any help will be appreciated

    Read the article

  • Getting the location in Android programatically

    - by steveo225
    I know this has been asked a ton, so my apologies. I have the following code, and cannot get the location, always a null response. I am trying to avoid a LocationListener in this instance because I am already using an update Service, and the location really doesn't have to be that fine, so the last known location is good enough. Thanks for the help. LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); String providers[] = {"gps", "network", "passive"}; Location loc = null; for(String x : providers) { loc = lm.getLastKnownLocation(x); if(loc != null) break; } if(loc != null) { // do something, never reached }

    Read the article

  • How can I get the element in which highlighted text is in?

    - by Koes Bong
    I am trying to learn how to write a bookmarklet where I can highlight some text, click on the bookmarklet and have it tell me what got highlighted. I can get that far, but next I want to know what element that text is in. For example: <div id="some-id">to be highlighted</div> The bookmarklet code: javascript:(function(){alert(window.getSelection();})() If I highlight the text "to be highlighted" and then click on the bookmarklet, it will alert the text. But how can I get the element in which the text is in, in this case the element after that? So the flow is: highlight text, click bookmarklet, bookmarklet tells you what you highlighted and the element it's in. Thanks!

    Read the article

  • Does a hidden UIViewController consume any resources (iPhone)?

    - by MrDatabase
    My simple iPhone game has two basic "screens": home screen (UIViewController subclass) game screen (UIWindow w/ EAGLLayer where all the OpenGL drawing happens) Currently when the user taps "Play" on the homescreen the UIViewController is just hidden and the game screen is revealed. When the game is over the homescreen UIViewController is unhidden. Does the hidden UIViewController consume any resources when it's hidden?

    Read the article

  • T-SQL Query, combine columns from multiple rows into single column

    - by Shayne
    I have seeen some examples of what I am trying to do using COALESCE and FOR XML (seems like the better solution). I just can't quite get the syntax right. Here is what I have (I will shorten the fields to only the key ones): Table Fields ------ ------------------------------- Requisition ID, Number IssuedPO ID, Number Job ID, Number Job_Activity ID, JobID (fkey) RequisitionItems ID, RequisitionID(fkey), IssuedPOID(fkey), Job_ActivityID (fkey) I need a query that will list ONE Requisition per line with its associated Jobs and IssuedPOs. (The requisition number start with "R-" and the Job Number start with "J-"). Example: R-123 | "PO1; PO2; PO3" | "J-12345; J-6780" Sure thing Adam! Here is a query that returns multiple rows. I have to use outer joins, since not all Requisitions have RequisitionItems that are assigned to Jobs and/or IssuedPOs (in that case their fkey IDs would just be null of course). SELECT DISTINCT Requisition.Number, IssuedPO.Number, Job.Number FROM Requisition INNER JOIN RequisitionItem on RequisitionItem.RequisitionID = Requisition.ID LEFT OUTER JOIN Job_Activity on RequisitionItem.JobActivityID = Job_Activity.ID LEFT OUTER JOIN Job on Job_Activity.JobID = Job.ID LEFT OUTER JOIN IssuedPO on RequisitionItem.IssuedPOID = IssuedPO.ID

    Read the article

  • WPF - Adding ContentControl to Custom Canvas

    - by Alp Hancioglu
    I have a custom DrawingCanvas which is inherited from Canvas. When I add a ContentControl to DrawingCanvas with the following code nothing shows up. GraphicsRectangle rect = new GraphicsRectangle(0, 0, 200, 200, 5, Colors.Blue); DrawingContainer host = new DrawingContainer(rect); ContentControl control = new ContentControl(); control.Width = 200; control.Height = 200; DrawingCanvas.SetLeft(control, 100); DrawingCanvas.SetTop(control, 100); control.Style = Application.Current.Resources["DesignerItemStyle"] as Style; control.Content = host; drawingCanvas.Children.Add(control); GraphicsRectangle is a DrawingVisual and the constructor above draws a Rect with (0,0) top left point and length of 200 to the drawingContext of GraphicsRectangle. DrawingContainer is a FrameworkElement and it has one child, which is rect above, given with constructor. DrawingContainer implements GetVisualChild and VisualChildrenCount override methods. At last, Content property of ContentControl is set to the DrawingContainer to be able to show the DrawingVisual's content. When I add the created ContentControl to a regular Canvas, control is showed correctly. I guess the reason is that DrawingCanvas doesn't implement ArrangeOverride method. It only implements MeasureOverride method. Also DrawingContainer doesn't implement Measure and Arrange override methods. Any ideas?

    Read the article

  • Remote logging for multiple Apache virtual hosts using syslog-ng

    - by James
    I'm running a couple Apache web servers that each have 4-8 separate virtual hosts on each of them. I'm trying to setup a dedicated log server that stores each virtual host access and errors logs in a separate directory for that virtual host. For example on the logging server, /var/log/remove/10.0.0.2/virtualhost1 contains access_log and error_log /var/log/remove/10.0.0.2/virtualhost2 contains access_log and error_log /var/log/remove/10.0.0.3/virtualhost3 contains access_log and error_log and so on... Right now I have it split up by host but I can't figure out how to do it additionally by virtual host. Here are the relevant lines from the logging server's syslog-ng.conf source r_src { tcp(ip("0.0.0.0") port(5140)); }; destination r_all { file("/opt/splunk/logs/$HOST"); }; log { source(r_src); destination(r_all); }; Any help would be appreciated. Thanks!

    Read the article

  • Windows 7 boot order and locations

    - by Russ C
    Hi, Long story short, a program that shouldn't have been run on this machine has been, and it's created a naughty .sys file that is being loaded right after pci.sys (as determined by NBTLog.txt) I've had a look a BCDEdit, EasyBCD and a number of Registry keys but I can't seem to determine where about winstart.exe actually gets the list of sys files to load from! The sys file itself is running in high elevation and appears to be defeating all attempts to remove it; I could (probably should) make a Linux USB boot disc and use it to delete the sys file, but I'd really appreciate understanding the mechanics here. ((FWIW: the problem stemmed from a sibling running a Trainer for some game; he has been suitable chastised))

    Read the article

  • Causes of sudden massive filesystem damage? ("root inode is not a directory")

    - by poolie
    I have a laptop running Maverick (very happily until yesterday), with a Patriot Torx SSD; LUKS encryption of the whole partition; one lvm physical volume on top of that; then home and root in ext4 logical volumes on top of that. When I tried to boot it yesterday, it complained that it couldn't mount the root filesystem. Running fsck, basically every inode seems to be wrong. Both home and root filesystems show similar problems. Checking a backup superblock doesn't help. e2fsck 1.41.12 (17-May-2010) lithe_root was not cleanly unmounted, check forced. Resize inode not valid. Recreate? no Pass 1: Checking inodes, blocks, and sizes Root inode is not a directory. Clear? no Root inode has dtime set (probably due to old mke2fs). Fix? no Inode 2 is in use, but has dtime set. Fix? no Inode 2 has a extra size (4730) which is invalid Fix? no Inode 2 has compression flag set on filesystem without compression support. Clear? no Inode 2 has INDEX_FL flag set but is not a directory. Clear HTree index? no HTREE directory inode 2 has an invalid root node. Clear HTree index? no Inode 2, i_size is 9581392125871137995, should be 0. Fix? no Inode 2, i_blocks is 40456527802719, should be 0. Fix? no Reserved inode 3 (<The ACL index inode>) has invalid mode. Clear? no Inode 3 has compression flag set on filesystem without compression support. Clear? no Inode 3 has INDEX_FL flag set but is not a directory. Clear HTree index? no .... Running strings across the filesystems, I can see there are what look like filenames and user data there. I do have sufficiently good backups (touch wood) that it's not worth grovelling around to pull back individual files, though I might save an image of the unencrypted disk before I rebuild, just in case. smartctl doesn't show any errors, neither does the kernel log. Running a write-mode badblocks across the swap lv doesn't find problems either. So the disk may be failing, but not in an obvious way. At this point I'm basically, as they say, fscked? Back to reinstalling, perhaps running badblocks over the disk, then restoring from backup? There doesn't even seem to be enough data to file a meaningful bug... I don't recall that this machine crashed last time I used it. At this point I suspect a bug or memory corruption caused it to write garbage across the disks when it was last running, or some kind of subtle failure mode for the SSD. What do you think would have caused this? Is there anything else you'd try?

    Read the article

  • I want to play one podcast only on iTouch, but they play in series one after the other.

    - by Eddy
    I download multiple podcasts from one source, eg, five episodes of Naked Scientists. I want to listen to one only, but when the first finishes it automatically goes to the second, and third etc. I want to listen to just one episode at a time and have the iTouch turn off when it is finished (this is a sleep-aid for my insomnia...I don't want it playing all night !) A "Genius" suggested making playlists, but although you can make a podcast playlist, it does NOT sync. Please help. thanks, Ed3339

    Read the article

  • clean reinstall of windows on dell xps 1530 using bundled software from dell?

    - by kacalapy
    i wanted to delete my laptop hard drive and reinstall the os that came on the media with the laptop originally. i booted from the windows disk and reinstalled windows but this did not delete my hard drive and even worse it made a windows.old folder with all my old junk on my c drive how do i get a clean/ deleted c drive with new install of my os? i have a small 120 Gig solid state hard drive with just one partition. i would like to create two partitions on the new install. my main issue is not being able to get a clean install such that the result is a pure windows laptop with no junk files that have accumulated over time. please advise.

    Read the article

  • How to "drag and drop" folders or multiple HTML files into a browser and have them open in multiple tabs

    - by PoorLuzer
    I save pages that I browse on the net and find interesting into a folder called C:\PageSaves Later, during the commute, I open these pages to see what they are and move them into a neatly categorized folder tree. For example, Perl related pages goto C:\Pages\Perl, MySQL related pages goto C:\Pages\MySQL and so on. I was wondering if there is any way I could open any number of HTML files on disc / inside a folder (C:\PageSaves in my case) into Mozilla/FF/K-Meleon etc For example, I would like to just "drag and drop" the folder C:\PageSaves into FireFox and have it open all the .html pages in the folder in a separate tab Right now, if I "drag and drop" multiple HTML files, it just opens the last file in the selection. Have a set of toolbar buttons, basically, a (the) plugin that should allow me to nuke the page (if I don't want to keep the page anymore) from disc or move the file (and its corresponding folder) into a predefined / new folder I am familiar with coding full blown FireFox plugins, so even if something very basic/almost similar exists, I can take it forward. Hints/clues/other methods of achieving the same result are all welcome!

    Read the article

  • SQL SERVER – master Database Log File Grew Too Big

    - by pinaldave
    Couple of the days ago, I received following email and I find this email very interesting and I feel like sharing with all of you. Note: Please read the whole email before providing your suggestions. “Hi Pinal, If you can share these details on your blog, it will help many. We understand the value of the master database and we take its regular back up (everyday midnight). Yesterday we noticed that our master database log file has grown very large. This is very first time that we have encountered such an issue. The master database is in simple recovery mode; so we assumed that it will never grow big; however, we now have a big log file. We ran the following command USE [master] GO DBCC SHRINKFILE (N'mastlog' , 0, TRUNCATEONLY) GO We know this command will break the chains of LSN but as per our understanding; it should not matter as we are in simple recovery model.     After running this, the log file becomes very small. Just to be cautious, we took full backup of the master database right away. We totally understand that this is not the normal practice; so if you are going to tell us the same, we are aware of it. However, here is the question for you? What operation in master database would have caused our log file to grow too large? Thanks, [name and company name removed as per request]“ Here was my response to them: “Hi [name removed], It is great that you are aware of all the right steps and method. Taking full backup when you are not sure is always a good practice. Regarding your question what could have caused your master database log to grow larger, let me try to guess what could have happened. Do you have any user table in the master database? If yes, this is not recommended and also NOT a good practice. If have user tables in master database and you are doing any long operation (may be lots of insert, update, delete or rebuilding them), then it can cause this situation. You have made me curious about your scenario; do revert back. Kind Regards, Pinal” Within few minutes I received reply: “That was it Pinal. We had one of the maintenance task log tables created in the master table, which had many long transactions during the night. We moved it to newly created database named ‘maintenance’, and we will keep you updated.” I was very glad to receive the email. I do not suggest that any user table should be created in the master database. It should be left alone from user objects. Now here is the question for you – can you think of any other reason for master log file growth? Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Backup and Restore, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Eclipse vs. Aptana

    - by RPK
    I know that Eclipse is a universal IDE and variety of plugins are available to scale it. What is the difference between: The original Eclipse IDE, Aptana and NetBeans. I looked into Wikipedia and came to know that the latter two originate from the main Eclipse. For Aptana specially, what was the need to reproduce a new variant that resembles too much with its base IDE? If your preferred choice is Eclipse itself, what makes it unique as compared to the other two.

    Read the article

  • Unable to sync files not located in the Ubuntu One folder

    - by pst007x
    I have the option to sync files in nautilus, however when the option is selected nothing happens. I am able to SLOWLY sync files in the Ubuntu One folder (unless in sub-folders), but only there. Why give the option if it does not work? This really is still beta, so to charge for this service is terrible. I am a little frustrated at the moment, I have tried all sorts; removing accounts to a fresh Ubuntu install! I am at a loss :-( Can anyone else sync files outside the Ubuntu One folder, if so how? Thanks

    Read the article

  • Groovy htmlunit getFirstByXPath returning null

    - by StartingGroovy
    I have had a few issues with HtmlUnit returning nulls lately and am looking for guidance. each of my results for grabbing the first row of a website have returned null. I am wondering if someone can A) explain why they might be returning null B) explain better ways (if there are some) to go about getting the information Here is my current code (URL is in the source): client = new WebClient(BrowserVersion.FIREFOX_3) client.javaScriptEnabled = false def url = "http://www.hidemyass.com/proxy-list/" page = client.getPage(url) IpAddress = page.getFirstByXPath("//html/body/div/div/form/table/tbody/tr/td[2]").getValue() println "IP Address is: $data" //returns null //Port_Number is an Image Country = page.getFirstByXPath("//html/body/div/div/form/table/tbody/tr/td[4][@class='country']/@rel").getValue() println "Country abbreviation is: $Country" //differentiate speed and connection by name of gif? Type = page.getFirstByXPath("//html/body/div/div/form/table/tbody/tr/td[7]").getValue() println "Proxy type is: $Type" Anonymity = page.getFirstByXPath("//html/body/div/div/form/table/tbody/tr/td[8]").getValue() println "Anonymity Level is: $Anonymity" client.closeAllWindows() Right now all of my XPaths return null and .getValue() obviously doesn't work on null. I also have questions as to what I should do about the PORT since it is an image? Is there a better alternative than downloading it and attempting to solve it by OCR? Side Note There is no significance in this site, I was just looking for a site that I could practice scraping on (the last one I ran into issues of fragment identities and couldn't get an answer to: HtmlUnit getByXpath returns null and HtmlUnit and Fragment Identities )

    Read the article

  • Extension method return using generics

    - by Steven de Salas
    Is it possible to return a generic type using extension methods? For example, I have the following method: // Convenience method to obtain a field within a row (as a double type) public static double GetDouble(this DataRow row, string field) { if (row != null && row.Table.Columns.Contains(field)) { object value = row[field]; if (value != null && value != DBNull.Value) return Convert.ToDouble(value); } return 0; } This is currently used as follows: double value = row.GetDouble("tangible-equity"); but I would like to use the following code: double value = row.Get<double>("tangible-equity"); Is this possible and if so, what would the method look like?

    Read the article

  • Out-Of-Memory while doing Core Data migration

    - by Kamchatka
    Hello, I'm migrating a CoreData model between two versions of an application. I was storing binary data as blobs in the previous version and I want to take them out of the blobs for performance. My issue is that during the migration it seems that Core Data loads everything into memory which leads to Low Memory Warnings and then to my app being killed. Apple documentation suggests the following : http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmCustomizingTheProcess.html#//apple_ref/doc/uid/TP40005510-SW9 However, it seems to rely on the fact that the large objects are applied different mapping. In my case, all the objects are basically the same and the same mapping has to be applied to each of them. I don't see in this case how I could apply their technique. How should I handle a migration with very large objects ?

    Read the article

  • How do you enable block folding for Python comments in TextMate?

    - by Dave Gallagher
    In TextMate 1.5.10 r1623, you get little arrows that allow you to fold method blocks: Unfortunately, if you have a multi-lined Python comment, it doesn't recognize it, so you can't fold it: def foo(): """ How do I fold these comments? """ print "bar" TextMate has this on their site on how to customize folding: http://manual.macromates.com/en/navigation_overview#customizing_foldings ...but I'm not skilled in regex enough to do anything about it. TextMate uses the Oniguruma regex API, and I'm using the default Python.tmbundle updated to the newest version via GetBundles. Does anyone have an idea of how to do this? Thanks in advance for your help! :)

    Read the article

  • What is the best way to add attributes to auto-generated entities (using VS2010 and EF4)

    - by Dani
    ASP.NET MVC2 has strong support for using attributes on entities (validation, and extending Html helper class and more). If I generated my Model from the Database using VS2010 EF4 Entity Data Model (edmx and it's cs class), And I want to add attributes on some of the entities. what would be the best practice ? how should I cope with updating the model (adding more fields / tables to the database and merging them into the edmx) - will it keep my attributes or generate a new cs file erasing everything ? (Manual changes to this file may cause unexpected behavior in your application.) (Manual changes to this file will be overwritten if the code is regenerated.)

    Read the article

  • Communication via internet in Java

    - by Stuart
    What I mean is like servers on video games. You can run an application and it will set up a server on your computer with an IP and a port. For example, how would you make an application where one host application sets up a thing where it has an IP and a port, and another computer that has access to the internet as well can type in the IP and port and it would be able to communicate with the host? I mean simple communication, like sending a boolean or String. And would there be any security problems that would be needed to fix?

    Read the article

  • Some questions about setting up Amazon S3 with Ruby on Rails

    - by ben
    I'm trying to setup Amazon S3 hosting with my Ruby on Rails 3 app, which is hosted on Heroku. After reading these instructions in the Heroku docs, I'm trying to use the aws-s3 gem. The instructions say to put the S3 account details in config/amazon_s3.yml, but the aws-s3 Github page says you create a connection like this: AWS::S3::Base.establish_connection!( :access_key_id => 'abc', :secret_access_key => '123' ) Why is the connection created by providing the details if they're already provided in the config file? Is that not the correct way to establish a connection? Do I have to establish a connection for each user everytime an upload is about to occur, or is a connection established for the application as a whole? Thanks for reading.

    Read the article

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