Daily Archives

Articles indexed Thursday June 3 2010

Page 7/111 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • List<T>.RemoveAll Doesn't Exist in Silverlight?

    - by ashes999
    I'm working on a Silverlight 2/3 application. I would like to use List.RemoveAll (or maybe it's IList.RemoveAll?) and specify a predicate so that I can remove a bunch of elements from a list in one sweep. It seems like this function doesn't exist in Silverlight, though. Am I missing something here? Is there an alternative approach that's equally easy? Right now, I'm manually iterating over my elements in a foreach and keeping a second list (because you can't delete while iterating), and it's quite ... cumbersome.

    Read the article

  • Out of Memory When Loading Java Entities

    - by Hugh Buchanan
    I have a terrible problem that hopefully has a very simple answer. I am running out of memory when I perform a basic If I have code like this: MyEntity myEntity; for (Object id: someIdList) { myEntity = find(id); // do something basic with myEntity } And the find() method is a standard EntityManager related method: public MyEntity find(Object id) { return em.find(mycorp.ejb.entity.MyEntity.class, id); } This code worked a couple of weeks ago, and works fine if there are fewer items in the database. The resulting error I am facing is: java.lang.OutOfMemoryError: GC overhead limit exceeded The exception is coming from oracle toplink calling some oracle jdbc methods. The loop exists because an EJBQL such as "select object(o) from MyEntity as o" will overload the application server when there are lots of records.

    Read the article

  • How can I skip some block content while reading in Perl.

    - by Nano HE
    Hello. I plan to skip the block content which include the start line of "MaterializeU4()" with the subroutin() read_block below. But failed. # Read a constant definition block from a file handle. # void return when there is no data left in the file. # Otherwise return an array ref containing lines to in the block. sub read_block { my $fh = shift; my @lines; my $block_started = 0; while( my $line = <$fh> ) { # how to correct my code below? I don't need the 2nd block content. $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 0) ) ; if( $block_started ) { last if $line =~ /^\s*$/; push @lines, $line; } } return \@lines if @lines; return; } Data as below: __DATA__ status DynTest = <dynamic 100> vid = 10002 name = "DynTest" units = "" status VIDNAME9000 = <U4 MaterializeU4()> vid = 9000 name = "VIDNAME9000" units = "degC" status DynTest = <U1 100> vid = 100 name = "Hello" units = "" Output: <StatusVariables> <SVID logicalName="DynTest" type="L" value="100" vid="10002" name="DynTest" units=""></SVID> <SVID logicalName="VIDNAME9000" type="L" value="MaterializeU4()" vid="9000" name="VIDNAME9000" units="degC"></SVID> <SVID logicalName="DynTest" type="L" value="100" vid="100" name="Hello" units=""></SVID> </StatusVariables> [Updated] I print the value of index($line, "MaterializeU4"), it output 25. Then I updated the code as below $block_started++ if ( ($line =~ /^(status)/) && (index($line, "MaterializeU4") != 25) Now it works. Any comments are welcome about my practice. Thank you.

    Read the article

  • Gnome Desktop Icons Alignment

    - by Gabriel L. Oliveira
    Hi all. It has been a long time since I started to compare the gnome desktop to the windows desktop. But since I began to use linux, I realized that the "gnome way" to align the icons on Desktop is not that nice for me. And comparing to Windows's way, windows is better for me. (remember, for me). I'd like to know if anyone has some tip to make "gnome desktop icon alignment" more like windows do. I tried to reduce the icon's size, did something, but was not that all. So, could anyone tell another tip? I like when I put something on windows desktop, and wherever I put the file, Windows organize the file and put the icon right after the last icon (in a cascade style) (and automatically). Any tips?

    Read the article

  • Best way to change the background color for an NSView

    - by outtru.mp
    I'm looking for the best way to change the background color of an NSView. I'd also like to be able to set the appropriate alpha mask for the NSView. Something like: myView.backgroundColor = [NSColor colorWithCalibratedRed:0.227f green:0.251f blue:0.337 alpha:0.8]; I notice that NSWindow has this method, and I'm not a big fan of the NSColorWheel, or NSImage background options, but if they are the best, willing to use.

    Read the article

  • What Windows editor has CORRECT EOL whitespace handling?

    - by blueshift
    I'm looking for a Windows text editor for programming that handles EOL whitespace CORRECTLY, which for my idea of correct means: Strip all EOL whitespace on save, EXCEPT on lines that I haven't edited. This is to minimise the amount of EOL whitespace evil in my world, but not pollute SCM diff/blame with whitespace-only fixes (I have to deal with old / other people's code). I have played with TextPad, Notepad++, Kodomo Edit and Programmer's Notepad 2, and found all of them lacking. Also: I don't get along with vi, and I am unsure about Emacs on Windows. @Matti Virkkunen: I could mess with diff, but I want to fix the problem, not the symptoms. Fixing diff means all my, others, and server side diff tools need to be fixed, and doesn't fix space/noise/hash change issues in SCM. Example pet hate using that system: "update" tells me a file has changed. Diff shows no changes.

    Read the article

  • C: using clock() to measure time in multi-threaded programs

    - by Shinka
    I've always used clock() to measure how much time my application took from start to finish, as; int main(int argc, char *argv[]) { const clock_t START = clock(); // ... const double T_ELAPSED = (double)(clock() - START) / CLOCKS_PER_SEC; } Since I've started using POSIX threads this seem to fail. It looks like clock() increases N times faster with N threads. As I don't know how many threads are going to be running simultaneously, this approach fails. So how can I measure how much time has passed ?

    Read the article

  • Linksys WiFi usb dongle and linux woes

    - by MrStatic
    I have a Linksys WUSB54GC usb dongle and I have exhausted every thing I know about making this thing work in linux. I am using Fedora 13. Since it is not ready I can not view any networks. Any ideas would be great. tail of the system log Jun 2 20:14:35 localhost kernel: usb 1-7: new high speed USB device using ehci_hcd and address 8 Jun 2 20:14:35 localhost kernel: usb 1-7: New USB device found, idVendor=1737, idProduct=0077 Jun 2 20:14:35 localhost kernel: usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Jun 2 20:14:35 localhost kernel: usb 1-7: Product: 802.11 g WLAN Jun 2 20:14:35 localhost kernel: usb 1-7: Manufacturer: Ralink Jun 2 20:14:35 localhost kernel: usb 1-7: SerialNumber: 1.0 Jun 2 20:14:35 localhost kernel: Registered led device: rt2800usb-phy3::radio Jun 2 20:14:35 localhost kernel: Registered led device: rt2800usb-phy3::assoc Jun 2 20:14:35 localhost kernel: Registered led device: rt2800usb-phy3::quality Jun 2 20:14:35 localhost NetworkManager[1367]: <info> found WiFi radio killswitch rfkill3 (at /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-7/1-7:1.0/ieee80211/phy3/rfkill3) (driver <unknown>) Jun 2 20:14:35 localhost kernel: rt2800usb 1-7:1.0: firmware: requesting rt2870.bin Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): driver supports SSID scans (scan_capa 0x01). Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): new 802.11 WiFi device (driver: 'rt2800usb' ifindex: 6) Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): exported as /org/freedesktop/NetworkManager/Devices/4 Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): now managed Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): device state change: 1 -> 2 (reason 2) Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): bringing up device. Jun 2 20:14:35 localhost kernel: ADDRCONF(NETDEV_UP): wlan0: link is not ready Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): preparing device. Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): deactivating device (reason: 2). Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): supplicant interface state: starting -> ready Jun 2 20:14:35 localhost NetworkManager[1367]: <info> (wlan0): device state change: 2 -> 3 (reason 42) [root@localhost log]# iwconfig lo no wireless extensions. eth0 no wireless extensions. wlan0 IEEE 802.11bg Mode:Managed Access Point: Not-Associated Tx-Power=8 dBm Retry long limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on

    Read the article

  • SQLAuthority News – Training and Consultancy and Travel – Story of 30 Last 30 Days

    - by pinaldave
    Today’s blog post is not technical as usual. Here, I present a real story, and I also invite you all to share your thoughts or opinions on this post. I am a professional SQL Server Trainer; I also do consultation in the area of the Performance Tuning and Query Optimizations. In any month, I like the mix of both in my schedule. I prefer to do training for one week, and then commit the next week for some consultation work. Due to the advancement in technology, for most of the consultation works, there is no client location visit or first time visit for understanding the project. Usually, I conduct high-end training sessions or 400 level training, and these training sessions are very intensive most of the time. Always after completing the training for 5 days straight away at 400 level, I make sure to take out some time to cool down and relax. During this time, I prefer to work on optimization projects. Consultancy is great as it keeps me updated regarding what is going on in the real world. As we all know, all those trainers who have real world experience are always considered to be the best trainers. My learning is immense during my consultations with the real client and while resolving real problems. I share the same with my students the very next week when I go for training sessions. For the same reason, every class is different from the previous ones. An experience trainer would tell you that the class is best if it is driven by Students the way instructor wants! The best scenario is as described above; but you won’t get the best scenario all the time. I was on road for nearly 25 days out of the last 30 days and involved in doing various SQL Server-related trainings. Here is what I have done in the last 30 days. I have gathered the following details from my expenditure reports, which are maintained by my wife. There are few points related to my personal expenses and few other related to business. I maintain a separate list for each of these expenses, but here I have aggregated them. Last 30 days - Training 23 days - 4 – two days training classes – 8 days of training 3 – five days training classes – 15 days of training 1 – one day training classes – 2 days of training Flights 18 flights - 8 – Kingfisher 6 – Spicejet 2 – Jet light 2 – Jet connect Stay in different cities Hyderabad – 16 days Chennai – 6 days Bangalore – 2 days Ahmedabad – 6 days (Hometown) Meals – 54 (Averaging less than 2 per day) Room Services – 16 times Training Campuses – 20 times Restaurants – 6 times Home – 12 times Taxi/Cabs – 64 times (Averaging more than 2 per day) Hotel Cab – 34 times Meru Cab – 8 times Easy Cabs – 10 times Auto Rickshaw – 2 times Looking at the above statistics, I can see that I have eaten less than what I should have, which is not good, and traveled in taxi more than what I should have. Also the temperatures in different cities were very different, not to mention the humidity as well. I missed my family, especially my little girl (9 months). When I was at home, I used to have a proper healthy meal every single day; however, when I was traveling, the food was something I had to compromise on. I have previously written about my travel experience with different airlines, my opinion is still same about them. Well, I have question to all of you road warriors, how do you manage your health and enthusiasm during situations I am going through. I have couple of time stomach upset as well sour throat. I drink lots of water and do my best to keep up. Any idea? Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: About Me, Pinal Dave, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Read/Write/Find/Replace huge csv file

    - by notapipe
    I have a huge (4,5 GB) csv file.. I need to perform basic cut and paste, replace operations for some columns.. the data is pretty well organized.. the only problem is I cannot play with it with Excel because of the size (2000 rows, 550000 columns). here is some part of the data: ID,Affection,Sex,DRB1_1,DRB1_2,SENum,SEStatus,AntiCCP,RFUW,rs3094315,rs12562034,rs3934834,rs9442372,rs3737728 D0024949,0,F,0101,0401,SS,yes,?,?,A_A,A_A,G_G,G_G D0024302,0,F,0101,7,SN,yes,?,?,A_A,G_G,A_G,?_? D0023151,0,F,0101,11,SN,yes,?,?,A_A,G_G,G_G,G_G I need to remove 4th, 5th, 6th, 7th, 8th and 9th columns; I need to find every _ character from column 10 onwards and replace it with a space ( ) character; I need to replace every ? with zero (0); I need to replace every comma with a tab; I need to remove first row (that has column names; I need to replace every 0 with 1, every 1 with 2 and every ? with 0 in 2nd column; I need to replace F with 2, M with 1 and ? with 0 in 3rd column; so that in the resulting file the output reads: D0024949 1 2 A A A A G G G G D0024302 1 2 A A G G A G 0 0 D0023151 1 2 A A G G G G G G (both input and output should read one line per row, ne extra blank row) Is there a memory efficient way of doing that with java(and I need a code to do that) or a usable tool for playing with this large data so that I can easily apply Excel functionality..

    Read the article

  • problem with Doctrine i18n in Symfony

    - by fayer
    i have table data i want to internationalize. i added this code in my schema.yml: I18n: fields: [name] and another table with a suffix "_translation" was created. the problem is that this table's id column is not auto-incremented. so when adding fixture data there will be a problem. i wonder if there is a way to make this column auto-incremented, or else i have to manually correct this for a lot of tables everytime i want to add fixture data. thanks.

    Read the article

  • How do you set a "Document class" from an SWC in Flash CS4?

    - by Flash Challenge
    I have an SWC with a class called Content. I want to set it as the "Document Class" in Flash. However, after setting up the SWC in the .fla, I am receiving an error message saying that "A definition for the document class could not be found in the classpath,..." Setting up the direct class folder works fine, but I need to distribute this SWC and do not want to include the sources. Is it possible to use a class as the Document Class if it resides in an SWC? I've found some links that seem to indicate no, but I need to find out definitively. http://balazs.sebesteny.com/document-class-from-swc/ forums.adobe.com/thread/452045

    Read the article

  • jQuery find text and replace (or BBcode hack)

    - by Harvengure
    Basically I am attempting to use jQuery so that it will search out text on the page and replace it with something else. For example [x]text[/x] will be converted to text which then gets converted from text to the actual html...a round about way of it I am sure but it seems to be the best way to do it given that the forum seems to understand html as plain texst anyway...but ultimately the goal is to use this jQuery to in a way create new bbcode on the forum.

    Read the article

  • Creating Outlook 2010 Add in for 64bit

    - by Grant
    Hi, does anyone know if there is a guide to creating an outlook add in for office 2010 that runs in 64bit mode? I have an add in that DOES work on in Outlook 2010 32bit but it doesn't appear in 64bit - in the add in section its set to disabled. I have tried to compile under different target CPU's but that hasn't helped..

    Read the article

  • basic JSON pulling data help..

    - by Webby
    New to json data and struggling i guess the answer is real easy but been bugging me for the last hour.. Sample data { "data": { "userid": "17", "dates": { "timestame": "1275528578", }, "username": "harino54", } } Ok I can pull userid or username easy enough with echo "$t->userid" or echo "$t->username " but how do I pull data from the brackets within ? in this case timestame? cant seem to figure it out.. any ideas?

    Read the article

  • AVD properties for Motorola Flipout?

    - by kefs
    I'm looking to create AVDs to test my apps on, and i'm trying to figure out the correct settings for a square screen such as the new Motorola Flip Out. I don't see a wikipedia article for it, or many specs... On a related note, what about tablets? Actually.. Why aren't there a set of AVD instances with params from popular devices.. or at least a site that lists them for each of the 60+ devices. Thanks in advance :)

    Read the article

  • In Ant, copy all files from a tree of folders into a single folder?

    - by Sam Washburn
    Is it possible to use Ant to copy all the files (not folders) from a hierarchy of folders into one destination folder? For instance, I have a tree like this: res |-images | |-fg.png | +-bg.png +-sounds +-music.mp3 And I would like a result like this: data |-fg.png |-bg.png +-music.mp3 The way things are named, filename conflicts are not an issue. Is this possible to do with Ant?

    Read the article

  • ASMX Still slow after 'Generate serialization assembly'

    - by Buzzer
    This question is related to: http://stackoverflow.com/questions/784918/asmx-web-service-slow-first-request. I inherited a proxy to a legacy ASMX Service. Basically as the post above states, the first call performance is literally 10 times slower than the subsequent calls. I went ahead and turned on ‘Generate serialization assembly' on the project that contains the proxy. The 'serializers' assembly is actually generated. However, I haven't seen any performance increase at all. Do I need to do anything else other than make sure the 'serializers' assembly is in the client's bin directory? Do I have to 'link' the proxy to the 'serializers' assembly during proxy generation (wsdl.exe)? I guess I'm stuck at this point. J Saunders where u at? :)

    Read the article

  • Creating records using RJS in rails

    - by Elliot
    Hey Everyone, so I've watched http://railscasts.com/episodes/43-ajax-with-rjs but I have a question: In my view I have the following: <div id="testly"> <%= render :partial => "test" %> </div> This works. Using create.rjs to change the content in this div, I have the following in my create.rjs file: page.replace_html :testly, :partial = 'test' Simply put, this should just refresh the partial right? But its not working... Would love any suggestions!

    Read the article

  • Custom WPF TreeView

    - by Robert
    I have a custom class that I would like to bind a WPF TreeView that has three tiers. Each tier needs to be bound like this: Monitor --> LCD --> Samsung 1445 LCD --> CRT --> Sony 125 CRT Here is the example code: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); SystemInventory sysInventory = new SystemInventory(); //Possibly do something like this. _myTreeView.DataContext = sysInventory.DeviceGroupInstances; } public class SystemInventory { public ObservableCollection<DeviceGroup> DeviceGroupInstances { get; set; } public SystemInventory() { DeviceGroupInstances = new ObservableCollection<DeviceGroup>(); DeviceGroupInstances.Add(new DeviceGroup("Monitor")); } } public class DeviceGroup { public string DeviceGroupName { get; set; } public ObservableCollection<DeviceType> DeviceTypeInstances { get; set; } public DeviceGroup(string deviceGroupName) { DeviceTypeInstances = new ObservableCollection<DeviceType>(); DeviceGroupName = deviceGroupName; if (deviceGroupName == "Monitor") { DeviceTypeInstances.Add(new DeviceType("LCD")); DeviceTypeInstances.Add(new DeviceType("CRT")); } } } public class DeviceType { public string DeviceTypeName { get; set; } public ObservableCollection<DeviceInstance> DeviceInstances { get; set; } public DeviceType(string deviceGroupName) { DeviceInstances = new ObservableCollection<DeviceInstance>(); DeviceTypeName = deviceGroupName; if (deviceGroupName == "Monitor") { DeviceInstances.Add(new DeviceInstance("Samsung 1445 LCD")); } else { DeviceInstances.Add(new DeviceInstance("Sony 125 CRT")); } } } public class DeviceInstance { public string DeviceInstanceName { get; set; } public DeviceInstance(string instanceName) { DeviceInstanceName = instanceName; } } }

    Read the article

  • Using Doctrine to abstract CRUD operations

    - by TomWilsonFL
    This has bothered me for quite a while, but now it is necessity that I find the answer. We are working on quite a large project using CodeIgniter plus Doctrine. Our application has a front end and also an admin area for the company to check/change/delete data. When we designed the front end, we simply consumed most of the Doctrine code right in the controller: //In semi-pseudocode function register() { $data = get_post_data(); if (count($data) && isValid($data)) { $U = new User(); $U->fromArray($data); $U->save(); $C = new Customer(); $C->fromArray($data); $C->user_id = $U->id; $C->save(); redirect_to_next_step(); } } Obviously when we went to do the admin views code duplication began and considering we were in a "get it DONE" mode so it now stinks with code bloat. I have moved a lot of functionality (business logic) into the model using model methods, but the basic CRUD does not fit there. I was going to attempt to place the CRUD into static methods, i.e. Customer::save($array) [would perform both insert and update depending on if prikey is present in array], Customer::delete($id), Customer::getObj($id = false) [if false, get all data]. This is going to become painful though for 32 model objects (and growing). Also, at times models need to interact (as the interaction above between user data and customer data), which can't be done in a static method without breaking encapsulation. I envision adding another layer to this (exposing web services), so knowing there are going to be 3 "controllers" at some point I need to encapsulate this CRUD somewhere (obviously), but are static methods the way to go, or is there another road? Your input is much appreciated.

    Read the article

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