Daily Archives

Articles indexed Sunday July 8 2012

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

  • Getting the value of an input inside a td for each row with jQuery

    - by Anne
    I am still having so many problems with this: function padTitles() { $('tr').each(function () { var tds = $(this).find('input'), text = tds.filter('[id^="TempRowKey_"]').val(), tdToPad = tds.filter('[id^="title_"]'), pad; if (/0\.0$/.test(text)) pad = 10; else if (/\.0$/.test(text)) pad = 35; else pad = 60; tdToPad.css('paddingLeft', pad); }); } Note: here is what I was using before. This worked when the value was not inside an input: var tds = $(this).find('td'), text = tds.filter('[id^="refKey_"]').text(), It is supposed to get the Value of the Inputs with id's that start with TempRowKey_ and then use these for padding. But the code does nothing. Here is my HTML: <tr id="row_1"> <td id="tempRowKey_1" > <input type="text" size="10" value="1.0.0" class="updatable" id="TempRowKey_1"> </td> <td id="title_1"> <input id="Title_1" class="updatable" type="text" value="zxxx" size="100" name="item.Title"> </td>. <td ... </tr> Is there some way I can test this. I can't get access to anything inside the jQuery block?

    Read the article

  • Devise and cancan gems: has_many association

    - by tiktak
    I use devise and cancan gems and have simple model association: user has_many subscriptions, subscription belongs_to :user. Have following SubscriptionsController: class SubscriptionsController < ApplicationController load_and_authorize_resource :user load_and_authorize_resource :subscription, through: :user before_filter :authenticate_user! def index @subscriptions = @user.subscriptions.paginate(:page => params[:page]).order(:created_at) end #other actions end And Cancan Ability.rb: class Ability include CanCan::Ability def initialize(user) user ||=User.new can [:index, :show], [Edition, Kind] if user.admin? can :manage, :all elsif user.id can [:read, :create, :destroy, :pay], Subscription, user_id: user.id can [:delete_from_cart, :add_to_cart, :cart], User, id: user.id end end end The problem is that i cannot use subscriptions actions as a user but can as a admin. And have no problems with UsersController. When i delete following lines from SubscriptionsController: load_and_authorize_resource :user load_and_authorize_resource :subscription, through: :user before_filter :authenticate_user! Have no problems at all. So the issue in these lines or in Ability.rb. Any suggestions?

    Read the article

  • Interface with generic parameters- can't get it to compile

    - by user997112
    I have an interface like so: public interface MyInterface<E extends Something1> { public void meth1(MyClass1<E> x); } and I have a subclass whose superclass implements the above interface: public class MyClass2<E extends Something1> extends Superclass{ public MyClass2(){ } public void meth1(MyClass1 x) { // TODO Auto-generated method stub } } superclass: public abstract class Superclass<E extends Something1> implements MyInterface{ MyClass1<E> x; protected E y; public Superclass(){ } } the problem is that the parameter for meth1() is supposed to be generic. If I do MyClass1 it doesn't like it and the only way I can get it to compile is by leaving out generic parameters- which feels wrong. What's going wrong?

    Read the article

  • Merge n files using a C program

    - by Amal
    I am writing a download Accelerator. So I download a file from the webserver into n parts. Now I want to merge the files into 1 single file. So I use the following code. And the file names are in the correct order. But the output file I am getting is different from the original download file. Can you tell me where could the error be ?C int cbd_merge_files(const char** filenames, int n, const char* final_filename) { FILE* fp = fopen(final_filename, "wb"); if (fp == NULL) return 1; char buffer[4097]; for (int i = 0; i < n; ++i) { const char* fname = filenames[i]; FILE* fp_read = fopen(fname, "rb"); if (fp_read == NULL) return 1; int n; while ((n = fread(buffer, sizeof(char), 4096, fp_read))) { int k = fwrite(buffer, sizeof(char), n, fp); if (!k) return 1; } fclose(fp_read); } fclose(fp); return 0; }

    Read the article

  • Error when running a basic Hadoop code

    - by Abhishek Shivkumar
    I am running a hadoop code that has a partitioner class inside the job. But, when I run the command hadoop jar Sort.jar SecondarySort inputdir outputdir I am getting a runtime error that says class KeyPartitioner not org.apache.hadoop.mapred.Partitioner. I have ensured that the KeyPartitioner class has extended the Partitioner class, but why am I getting this error? Here is the driver code: JobConf conf = new JobConf(getConf(), SecondarySort.class); conf.setJobName(SecondarySort.class.getName()); conf.setJarByClass(SecondarySort.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); conf.setMapOutputKeyClass(StockKey.class); conf.setMapOutputValueClass(Text.class); conf.setPartitionerClass((Class<? extends Partitioner<StockKey, DoubleWritable>>) KeyPartitioner.class); conf.setMapperClass((Class<? extends Mapper<LongWritable, Text, StockKey, DoubleWritable>>) StockMapper.class); conf.setReducerClass((Class<? extends Reducer<StockKey, DoubleWritable, Text, Text>>) StockReducer.class); and here is the code of the partitioner class: public class KeyPartitioner extends Partitioner<StockKey, Text> { @Override public int getPartition(StockKey arg0, Text arg1, int arg2) { int partition = arg0.name.hashCode() % arg2; return partition; } }

    Read the article

  • Child service not writing to event log

    - by Tommy Fisk
    I am having a very simple (but incredibly frustrating) issue with a parent service and the child service. Let's call the parent service "Service A" and the child "Service B". Both services reside on the same box. Using WCF Storm, when I send Service B a message, I see lots of entries in the event viewer for it. However, if I send a message to Service A, which calls Service B, I only see entries from Service A. So for some reason, the child logs are not written when the parent calls it, but if I call it myself, the logs do indeed show up, so I know it's not a problem with the logging or anything like that. Here is what I am using to write to the event log. // in some random static class private static EventLog el = new EventLog(); el.WriteEntry("In " + location + ", " + message); // params passed in Does anyone know why this is happening? And more importantly what I can do about it?

    Read the article

  • receiving signal: EXC_BAD_ACCESS in web service call function

    - by murali
    I'm new to iPhone development. I'm using xcode 4.2. When I click on the save button, I'm getting values from the html page and my web service is processing them, and then I get the error: program received signal: EXC_BAD_ACCESS in my web service call function. Here is my code: NSString *val=[WebviewObj stringByEvaluatingJavaScriptFromString:@"save()"]; NSLog(@"return value:: %@",val); [adict setObject:[NSString stringWithFormat:@"%i",userid5] forKey:@"iUser_Id" ]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:0] forKey:@"vImage_Url"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:1] forKey:@"IGenre_Id"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:2] forKey:@"vTrack_Name"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:3] forKey:@"vAlbum_Name"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:4] forKey:@"vMusic_Url"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:5] forKey:@"iTrack_Duration_min"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:6] forKey:@"iTrack_Duration_sec"]; [adict setObject:[[val componentsSeparatedByString:@","]objectAtIndex:7] forKey:@"vDescription"]; NSLog(@"dict==%@",[adict description]); NSString *URL2= @"http://184.164.156.55/Music/Track.asmx/AddTrack"; obj=[[UrlController alloc]init]; obj.URL=URL2; obj.InputParameters = adict; [obj WebserviceCall]; obj.delegate= self; //this is my function..it is working for so many function calls -(void)WebserviceCall{ webData = [[NSMutableData alloc] init]; NSMutableURLRequest *urlRequest = [[ NSMutableURLRequest alloc ] initWithURL: [ NSURL URLWithString: URL ] ]; NSString *httpBody = @""; for(id key in InputParameters) { if([httpBody length] == 0){ httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]]; } else{ httpBody=[httpBody stringByAppendingFormat:@"&%@=%@",key,[InputParameters valueForKey:key]]; } } httpBody = [httpBody stringByAppendingFormat:httpBody];//Here i am getting EXC_BAD_ACCESS [urlRequest setHTTPMethod: @"POST" ]; [urlRequest setHTTPBody:[httpBody dataUsingEncoding:NSUTF8StringEncoding]]; [urlRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self]; } Can any one help me please? thanks in advance

    Read the article

  • Makefile - Dependency generation

    - by Profetylen
    I am trying to create a makefile that automatically compiles and links my .cpp files into an executable via .o files. What I can't get working is automated (or even manual) dependency generation. When i uncomment the below commented code, nothing is recompiled when i run make build. All i get is make: Nothing to be done for 'build'., even if x.h (or any .h file) has changed. I've been trying to learn from this question: Makefile, header dependencies, dmckee's answer, especially. Why isn't this makefile working? Clarification: I can compile everything, but when I modify any header file, the .cpp files that depend on it aren't updated. So, if I for instance compile my entire source, then I change a #define in the header file, and then run make build, and I get Nothing to be done for 'build'. (when I have uncommented either commented chunks of the below code). CC=gcc CFLAGS=-O2 -Wall LDFLAGS=-lSDL -lstdc++ SOURCES=$(wildcard *.cpp) OBJECTS=$(patsubst %.cpp, obj/%.o,$(SOURCES)) TARGET=bin/test.bin # Nothing happens when i uncomment the following. (automated attempt) #depend: .depend # #.depend: $(SOURCES) # rm -f ./.depend # $(CC) $(CFLAGS) -MM $^ >> ./.depend; # #include .depend # And nothing happens when i uncomment the following. x.cpp and x.h are files in my project. (manual attempt) #x.o: x.cpp x.h clean: rm -f $(TARGET) rm -f $(OBJECTS) run: build ./$(TARGET) debug: build nm $(TARGET) gdb $(TARGET) build: $(TARGET) $(TARGET): $(OBJECTS) @mkdir -p $(@D) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ obj/%.o: %.cpp @mkdir -p $(@D) $(CC) -c $(CFLAGS) $< -o $@ include $(DEPENDENCIES)

    Read the article

  • How should I handle header files in a bundle?

    - by ldiqual
    I want to develop a program that relies on plugins (here: loadable bundles) to work. Multiple plugins are asked to use the same AFNetworking ressource to make network requests. However, I don't know where to put AFNetworking and CustomPluginProtocol headers. Here is how my program structure looks like for now: MyApp.xcodeproj - AFNetworking - Header.h - Plugins - Plugin1.xcodeproj - PrincipalClass.m - Plugin2.xcodeproj - PrincipalClass.m - Classes - CustomPluginProtocol.h - MainClass.m Of course, every principalClass from PluginN complies to the CustomPluginProtocol. Do the headers have to be copied in each bundle ? Can I just include the main program AFNetworking headers from my plugins ? If so (and that's what I do for now), I don't have any completion. How can I get it ? Edit Ok, so maybe I wasn't clear in my question. I want my plugins to use sources from the main application, let's say CommonClass.m and CommonClass.h. Do the plugins need CommonClass.h in their bundle, and if not, how do I enable completion when I'm in the plugin scope ?

    Read the article

  • nth-child doesn't respond to class

    - by Arne Stephensson
    Is it possible to get the nth-child pseudo-selector to work with a specific class? See this example: http://jsfiddle.net/fZGvH/ I want to have the second DIV.red turn red, but it doesn't apply the color as expected. Not only that, but when you specify this, it changes the 5th DIV to red: div.red:nth-child(6) When you specify this, it changes the 8th DIV to red: div.red:nth-child(9) It seems to be one DIV behind. There are only 8 DIV tags in the example so I don't know why nth-child(9) even works. Testing using Firefox 3.6, but in my actual production code the same problem occurs in Chrome. I'm not understanding something about how this is supposed to work, would appreciate clarification. Also, this will change the 6th DIV to red, but what I actually want is for it to change the second DIV.red to red: div.red:nth-of-type(6) And I don't understand why nth-child() and nth-of-type() respond differently, since there are only eight tags of the same type in the document.

    Read the article

  • postfix on same server as apache2 mysql php

    - by Sandro Dzneladze
    I've dedicated box that hosts wordpress blog with huge traffic. I need mail functionality for me and 2 other employees. I also need mail send capability for fail2ban and logwatch applications. I don't want to stress this box too much, so I wonder: How scure can postfix be? Will I stress server beyond needed with antivirus and mail filters? and postfix? Server is with 2gb ram, e5600 nothing fancy a simple pc.

    Read the article

  • Raspberry Pi based Hadoop cluster

    - by Dmitriy Sukharev
    Is it at least possible to build Hadoop cluster from Raspberry Pi-based nodes? Can such a cluster meet hardware requirements of Hadoop? And if so, how much Raspberry Pi nodes are required to meet requirements? I understand that a cluster from several Raspberry Pi nodes being cheap is not powerful. My purpose is to organize cluster without possibility of loosing personal data from my desktop or notebook, and to use this cluster studying Hadoop. I'd appreciate if you suggest any better ideas of organizing a cheap Hadoop cluster for studying purposes. UPD: I've seen that recommended amount of memory for Hadoop is 16-24GB, multi-core processors, and 1TB of HDD, but it doesn't look like minimal requirements.

    Read the article

  • apt: how to search using package tags?

    - by depesz
    Some (most?) packages in Debian, have tags. For example: =# apt-cache show squirrelmail | perl -lne 'print if /^Tag:/.../^\S/' Tag: implemented-in::php, interface::web, mail::imap, mail::smtp, mail::user-agent, network::server, protocol::http, protocol::imap, protocol::smtp, role::program, scope::application, use::browsing, use::editing, use::searching, use::transmission, use::viewing, web::TODO, web::application, works-with::mail Section: web But, I can't find a way, to list all packages with given tag. Is it possible?

    Read the article

  • Remote Desktop Encryption

    - by Kumar
    My client is RDP 6.1 (On Windows XP SP3) and Server is Windows Server 2003. I have installed an SSL certificate on server for RDP. In the RDP settings (General tab), the Encryption method is set to SSL/TLS 1.0 and Encryption level is set to "Client Compatible". I have following questions In this case is it guaranteed that all communication is encrypted even when I remote login to the server? I mean pwd is encrypted Does RDP always use some kind of encryption even if there is no SSL certificate installed on the server? In this case I do not see security lock in the connection bar. When I set encryption level to "High" then I see security lock. I do believe that communication is both cases will be encrypted. Is it true? Please reply to my questions Thanks in advance Kumar

    Read the article

  • ADD ROUTE command in windows 2008R2

    - by Mehrdad Kamelzadeh
    I don't know much about Networking, So excuse me if I am raising some basic issues. I have a LAN where there is a Windows Server 2008R2 with some clients connected to it. The clients are not joined to the domain of the Server (they are in a WORKGROUP). I have set up a VPS on the server machine (PPTP) with a Static address pool of range 10.0.0.1 - 10.0.0.10 but the LAN range itself is 192.168.1.1 - 192.168.1.254. When I connect to the server from another location over the internet, I can just see the server and I can not see the other clients which are in the same LAN as the server. what to do to see the other clients? a friend of mine said that you should use the ADD ROUTE command. Beacuse of that I used this command as my title. What would be the best way to address this problem? Thanks

    Read the article

  • What do you need to know to get a job as a web developer [closed]

    - by Alex Foster
    What do you need to know to at the very least get your foot in the door? We're assuming for someone who doesn't have a college degree (yet) but will eventually get one. My guess is html, css, javascript, and php, and photoshop and dreamweaver, and sql. And being familiar with using a web host to have sites live, like knowing how to use cpanel. It's probably a very inaccurate and narrow guess but that's what i think right now. I don't know exactly.

    Read the article

  • How do i use socat as a proxy server?

    - by acidzombie24
    I'd like my .NET app to use a proxy which i know how to do except .net doesnt support sock4a/sock5. I know how to setup my app but How do i setup socat to at as a TCP proxy on part 1234 and use the sock5 server at 127.0.0.1:5678? It must forward all TCP connect. I had luck with privoxy earlier but that only supports http connections PS: I am on windows but the commands should be the same as linux

    Read the article

  • Why is my cron daemon is being killed every few minutes?

    - by user113215
    As of about a week ago, my cron daemon refuses to stay running. I'm using Debian 6 x64 on an OpenVZ virtual machine. Running something like pgrep cron shows that the daemon isn't running. I start the service with service cron start or /etc/init.d/cron start and it launches, but it disappears from the running process list after a few minutes (varying anywhere between 1 - 30 minutes before the process is killed again). Using strace -f service cron start, I can see that the process is being killed for some reason: nanosleep({60, 0}, <unfinished ...> +++ killed by SIGKILL +++ There's nothing relevant in /var/log/syslog, /var/log/messages, /var/log/auth.log, or /var/log/kern.log to explain why the the process is dying. The system has at least 800 MB of free memory, and cat /proc/loadavg returns 0.22 0.13 0.04 so resources shouldn't be the issue. With cron running, free -m reports: total used free shared buffers cached Mem: 1024 211 812 0 0 0 -/+ buffers/cache: 211 812 Swap: 0 0 0 I also tried removing and reinstalling the cron package using apt-get. Update: I initially thought the problem was a resource issues. I erased my entire VPS and started from a fresh Debian image. There is now nothing else running on the system, but even from a clean install my cron daemon is still being killed at random. What else should I check? How do I find out what's killing my crond?

    Read the article

  • sql server: losing identity column on export/import

    - by Y.G.J
    Recently I started dealing with SQL Server, my previous experience was in MS-Access. When I'm doing an import/export of a db, from the server to my computer or even in the server, all column with primary key loose the key. Identity is set to false and even bit is not set to the default. How can I can I use an import/export job to make an exact copy of the db and its data? I don't want to have to perform a backup and restore every time I want the same db somewhere else, for another project, etc. I have read about "edit mapping" and the checkbox but that did not helped with the identity specification... and what about the primary key of the tables and the rest of the things?

    Read the article

  • Hourly SQL Server 2005 Slowness (Possibly caused by SYSTEM)

    - by Zorlack
    We're trying to diagnose the cause of slowness on our Database server. We're running the latest rev SQL Server 2005 on Windows 2008x64. The behavior that we're seeing is this: We see the SYSTEM process spike one of the CPUs for about 2 minutes, during this time SQL server slows down by a factor of 10. The slowness lasts until SYSTEM is done, then in an hour everything starts again. During these slowdowns disk writes don't spike, paging doesn't spike, the only noticeable precursor we see is that SYSTEM maxes out one of the sixteen (HT)CPUs. Note that this doesn't happen at the top of the hour, it just happens once an hour, and it shifts a bit depending on the length of the incident. At the moment this is causing intermittent slowdowns, but when the server is really busy it can cause Worker Thread starvation. The server is a Dual Quad Dell R710 with 96GB of RAM and RAID10 data/log disks. Has anyone experienced this kind of problem? Does anyone know where we should look? Edit: SQL Server Version is 9.0.4035

    Read the article

  • What should I encrypt in Debian during install?

    - by ianfuture
    I have seen various guides and recommendations on web about how best to do this but nothing that clearly explains the best way and why. So I understand there is a need for part of Debian during install to be un-encrypted on its own partition to allow it to boot. Most info I have seen is call this /boot and set the boot flag. Next I believe the best approach is to create another partition out of all the rest of the disk space, encrypt this, then on top of that create a LVM and then within the LVM create my various partitions , name them , select size, and file system type. Can I include /swap in the encrypted LVM part ? Is this approach sound? If so what are the partitions I should use (this is going to be a minimal server install with a view to install as and when what I need for a dev server)? Finally how does the installer know what to put in each partition I define ? I appreciate there are more than one question but any help and suggestions would be appreciated. If further clarification is needed please mention in the comments . EDIT : 16/3/2010 After Richard Holloways reply I thought it relevant to add this info: The reasons why I want to do this are to explore maximising security on any server install and set up, due to interest in the area of Computer Security and Forensics. Also I am trying to peform the task as if it being performed in an enterprise situation. On a technical matter, once set up and configured with minimal packages and ssh this server will not physically be easy to access so I will only be entering via ssh. (Yes I know why encrypt something no one will ever be able to get their hands on? Because I can and I want to is the simple answer, but see above too).

    Read the article

  • How to install windows on a server with no CD or DVD drive

    - by user29266
    I've found a few posts on this site, however my situation is different. I have a new Dell server with no OS installed. I would like to install Windows 2008 Web Edition. I have a few USB ports and Ethernet. No CD or DVD drives. Is this article the best & only way to proceed? Installing Windows 2008 via USB thumbdrive or should I just get a external hardrive and hook it up to a usb. Once the OS is installed I'll never need a DVD drive again - so that's idea is a waste of money.

    Read the article

  • OSSIM - Snort/OSSEC/Nagios Logging Config Question

    - by user15736
    Quick n00b OSSIM question. I've looked around but haven't found exactly what I'm looking for. I currently have a Nagios, OSSEC, Nessus, and Snort server and I want to keep those servers active but just ship the logs to the OSSIM server and have it do the correlating and graphing. Can that be done? Everything I've seen is putting the various software functions actually on the OSSIM box but I don't want to do that. I'm running CentOS on all of the systems. Thanks.

    Read the article

  • Windows XP Activation Issues

    - by David
    Related to my older question: Get xp product key from boot Thanks for the help on that one. So, in the end, i couldn't get into my harddrive because i didn't have the available hardware to hook it up to another computer to get the old activation key. So, instead, i entered another activation key (i know, naughty) in hopes that there would be a way to retrieve the old one, restore point or something afterwords. What legal ways can I get xp re-activated after a repair when I don't have any record of my activation key? for those who think im just trying to crack it, your wrong: Got a virus, which stopped me from getting into windows Got AVG Anti Virus, which stopped me from getting into safe mode Got a 2 year old, who decided to rip-off and chew my activation sticker on my computer (nice one). Repaired windows installation thinking i wouldn't be asked to re-enter the activation key, to find that i was.

    Read the article

  • RAID 1 Mirror Error with Two Western Digital 500GB Drives

    - by bm678
    I have Windows 7 Ultimate 64 bit installed on a Western Digital 500GB drive (WD5000BEVT-22ZAT0) that was partitioned automatically by Windows as 100MB System Reserved and 465.66GB drive C. There is also an unallocated second Western Digital 500GB drive (WD5000BPVT-22HXZT1) that I want to use for RAID 1 to mirror the first drive but I get an error message stating “ALL DISKS HOLDING EXTENTS FOR A GIVEN VOLUME MUST HAVE THE SAME SECTOR SIZE, AND THE SECTOR SIZE MUST BE VALID.” I uninstalled Windows patch KB-982018 but I still get the same error message. Could you please let me know how to resolve this? Thanks.

    Read the article

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