Daily Archives

Articles indexed Saturday June 2 2012

Page 11/14 | < Previous Page | 7 8 9 10 11 12 13 14  | Next Page >

  • Evenly distribute items on the screen

    - by abolotnov
    I am trying to solve this little puzzle (the algorithm): I have N image icons and I want to distribute them evenly on users screen. Say, I put them in a table. If there is one image, there will be one cell in a table. If two - one row with two columns, if three - one row and three columns, if four - two rows, two columns... and so on until row space is gone and since then the table should only grow in columns without adding extra rows. I'm trying to figure an algorithm for this and perhaps this is something that has a solution already somewhere? My attempt is so far something like this: obtain_max_rows() obtain_visible_columns() if (number_of_pictures > max_rows*max_columns) { columns = roundup(number_of_pictures/max_rows) for(max_rows){generate row;for columns{generate column}} } else { **here comes to trouble...** } This logic is bit silly though - it somehow needs to think cases where there are 12 pictures on first screen and 2 on the other trying to balance it say 8/6 or somehow like that.

    Read the article

  • AddAllAttributes method spring mvc

    - by Nick Robertson
    I have two lists List<User> list_of_users=new ArrayList<User>(); List<String> list_of_attributes=new ArrayList<String>(); When i try to use the following lines of code: model.addAttribute("takeattributes",list_of_users); model.addAttribute("takeattributes",list_of_attributes); I realise that it keeps only the second list (list_of_attributes) and the first deleted. I was wondering how to keep both of these two lists in the model.Is this possible to be happened?Is the AddAllAttributes method what i need?If yes can anyone explain me how the AddAllAttributes method is working.I look at the spring mvc documentation but i didn't really understand.

    Read the article

  • Counting amount of items in Pythons 'for'

    - by Markum
    Kind of hard to explain, but when I run something like this: fruits = ['apple', 'orange', 'banana', 'strawberry', 'kiwi'] for fruit in fruits: print fruit.capitalize() It gives me this, as expected: Apple Orange Banana Strawberry Kiwi How would I edit that code so that it would "count" the amount of times it's performing the for, and print this? 1 Apple 2 Orange 3 Banana 4 Strawberry 5 Kiwi

    Read the article

  • Load data from CSV to mySQL database Java+hibernate+spring

    - by mona
    I am trying to load a CSV file in to mySQL database using Java+Hibernate+Spring. I am using the following query in the DAO to help me load in to the database: entityManager.createQuery("LOAD DATA INFILE :fileName INTO TABLE test").setParameter("fileName", "C:\\samples\\test\\abcd.csv").executeUpdate(); I got some idea to use this from http://dev.mysql.com/doc/refman/5.1/en/load-data.html and how to import a csv file into a mysql from an hibernate+spring application? But I am getting the error: java.lang.IllegalArgumentException: node to traverse cannot be null! Please help! Thanks

    Read the article

  • Using Add-on SDK to add toolbar buttons? Integrating XUL and Add-on SDK for Firefox Add-ons?

    - by Salami
    I have already coded most of a Firefox add-on using the Add-on SDK API. I am now discovering that Add-on SDK might not be powerful enough for my purposes. I need two things: A drop down button in the toolbar next to the location bar. To modify the add-ons manager in firefox It is truly disappointing, but I don't believe either of these is possible with the Add-on SDK. First of all, I understand there is a widget module in the Add-on SDK API. But this only allows me to add a simple icon or label to the awkward add-on bar. What if I need to add a nicer button like the one next to the location bar for Firebug or Greasemonkey? As for modifying the add-ons manager in firefox, I have tried Nickolay Ponomarev's XUL with the Add-on SDK without any success whatsoever. If anyone knows how to get this working and can point me in the right direction that would be extremely helpful (cfx init --template xul doesn't do anything the regular SDK does when I try it)

    Read the article

  • Is it okay to rely on javascript for menu layout?

    - by Ryan
    I have a website template where I do not know the number of menu items or the size of the menu items that will be required. The js below works exactly the way I want it to, however this is the most js I've every written. Are there any disadvantages or potential problems with this method that I'm not aware of because I'm a js beginner? I'm currently manually setting the padding for each site. Thank you! var width_of_text = 0; var number_of_li = 0; // measure the width of each <li> and add it to the total with, increment li counter $('li').each(function() { width_of_text += $(this).width(); number_of_li++; }); // calculate the space between <li>'s so the space is equal var padding = Math.floor((900 - width_of_text)/(number_of_li - 1)); // add the padding the all but the first <li> $('li').each(function(index) { if (index !== 0) { $(this).css("padding-left", padding); } });

    Read the article

  • Google Maps KML Solution Validation

    - by user728584
    Google Maps newbie (GIS newbie), I'm looking at a solution to map an overlay (number of polygons) on-top of Google maps and wondered if using a KML file was a viable solution? Basically, I have a number of address (address data) that I will pass to our internal GIS system, the GIS system hands me back a KML file (one file with a number of different locations) and then I draw the polygon using the KML Layering options: https://developers.google.com/maps/documentation/javascript/layers Sound like a viable solution? Cheers

    Read the article

  • Limit checkboxes with jquery based on checked radio buttons

    - by Hiskie
    So, i have this problem with some checkboxes. First of all let me tell you about the "project" itself. It's a webform, the user must complete it and check some checkboxes and radio buttons depending on what he would like to purchase. First of them are 2 radio bullets, numbered 1 and 2, and represent the quantity of the product he wants to purchase. Next to those are about 5 checkboxes that represent the color of the product, it doesn't matter how many of them are, the thing is ... i want, when a user selects 1 at the radio buttons, only 1 checkbox to be active, if he selects 2 then only 2 checkboxes to be available to check. So.. could someone help me? I thought of jQuery but i don't know... There are two divs, the first div with the id of let's say #radioButtons has 2 radio buttons, and the second div has the rest of the checkboxes.

    Read the article

  • Convert Dynamic to Type and convert Type to Dynamic

    - by Jon Canning
    public static class DynamicExtensions     {         public static T FromDynamic<T>(this IDictionary<string, object> dictionary)         {             var bindings = new List<MemberBinding>();             foreach (var sourceProperty in typeof(T).GetProperties().Where(x => x.CanWrite))             {                 var key = dictionary.Keys.SingleOrDefault(x => x.Equals(sourceProperty.Name, StringComparison.OrdinalIgnoreCase));                 if (string.IsNullOrEmpty(key)) continue;                 var propertyValue = dictionary[key];                 bindings.Add(Expression.Bind(sourceProperty, Expression.Constant(propertyValue)));             }             Expression memberInit = Expression.MemberInit(Expression.New(typeof(T)), bindings);             return Expression.Lambda<Func<T>>(memberInit).Compile().Invoke();         }         public static dynamic ToDynamic<T>(this T obj)         {             IDictionary<string, object> expando = new ExpandoObject();             foreach (var propertyInfo in typeof(T).GetProperties())             {                 var propertyExpression = Expression.Property(Expression.Constant(obj), propertyInfo);                 var currentValue = Expression.Lambda<Func<string>>(propertyExpression).Compile().Invoke();                 expando.Add(propertyInfo.Name.ToLower(), currentValue);             }             return expando as ExpandoObject;         }     }

    Read the article

  • How to run a restricted set of programs with Administrator privileges without giving up Admin acces (Win7 Pro)

    - by frLich
    I have a shared system, running Windows7 X64, restricted to a 'standard user' with no password. Not everyone who has access to the system has the administrator password. This works rather well, except for some applications - specially the unlock-applications for encrypted hard drives/USB flash drives. The specific ones either require Administrator access (eg. Seagate Blackarmor) or simply fail without it -- since these programs are sending raw commands to a device, this is to be expected. I would like to be able to add the hashes of these particular programs to a whitelist, and have them run as administrator without needing any prompts. Since these are by definition on removable media, I can't simply use a filename or even a path. One of the users who shares the system can be considered 'crafty', so anything which temporarily grants administrator rights to an user account is certain to cause problems. What i'd like to be able to do: 1) Create an admin account that can only run programs from a whitelist (or, failing that, from a directory) I can't find a good way to do this: As far as I can tell, SRP applies equally to ALL users? Even if I put a "Deny" token on all directories on the system, such that new directories would inherit it, it could still potentially run things from the mounted USB devices. I also don't know whether it's possible to create a new directory that DOESN'T inherit from the parent, that would lake the deny token, and provide admin access. 2) Find a lightweight service that will run these programs in its local context Windows7 seems to block cross-privilege level communication by default, and I haven't found such for windows 7. One example seems to be "sudo" (http://pages.cpsc.ucalgary.ca/~nfriess/sudo/) but because it uses a WLNOTIFY hook, it won't work under Vista nor Windows7 Non-Solutions: - RunAs: Requires administrator password! (but everyone calls it "sudo" anyway) - RunAs /savecred: Nice idea, but appears to be completely insecure. - RUNASSPC - Same concept as RunAs, uses "encrypted" files with credentials, but checks in user-space. - Scheduled Tasks - "Fixed" permissions make this difficult, and doesn't support interactive processes even if it did. - SuRun: From Google: "Surun uses its own Windows service that adds the user to the group of administrators during program start and removes him automatically from that group again"

    Read the article

  • FTP client hangs after a while

    - by lfbn
    I'm using Linux Ubuntu 12.04 with curlftpfs to connect to a remote server. After mounting a remote ftp, opening and saving files with vim, list directories and files, for some time, after a while (no more of 30 minutes), with no reason it hangs. After opening other terminal tabs, all tabs remain iddle...but when using filezilla without restart the computer I still can get to the server and working with no problem. When using Nautilus, instead of curlftpfs, I'm having the same problem. After a while it hangs. Can anyone help me please?

    Read the article

  • Login-time quota for VPN users

    - by Isaac
    I have configured Routing and Remote Access Service in Windows Server 2003 as the VPN server. VPN users are defined in Active Directory which is running on this server too. How i can configure the server to give each user a limited download size (for example 1GB) and does not authenticate them when they exceeds their download quota. The VPN server should also disconnect the users that reach their quota. Update: Apparently a third-party RADIUS server could provide this feature. One solution I have found is TekRADIUS but it is commercial. FreeRADIUS is a open-source free RADIUS server but I am not sure if it could these kind of features.

    Read the article

  • ssh + tinyproxy: poor performance

    - by Paul
    I am currently in China and I would like to still visit some blocked websites (facebook, youtube). I have VPS in the USA and I have installed tinyproxy on it. I log in on my VPS with SSH port-forwarding and I have configured my browser appropriately. Everything works more or less: I can surf to those websites but everything is inusually slow and sometimes data transfer stops abruptly. This probably has to do with the fact that I see some errors in my shell on the VPS like : channel 6: open failed: connect failed: Also in the log-file of tinyproxy I see some bad things: ERROR Sep 06 14:52:14 [28150]: getpeer_information: getpeername() error: Transport endpoint is not connected ERROR Sep 06 14:52:15 [28153]: writebuff: write() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:15 [28168]: readbuff: recv() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:15 [28151]: readbuff: recv() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:15 [28143]: readbuff: recv() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:17 [28147]: writebuff: write() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:23 [28137]: writebuff: write() error "Connection reset by peer" on file descriptor 7 ERROR Sep 06 14:52:26 [28168]: getpeer_information: getpeername() error: Transport endpoint is not connected ERROR Sep 06 14:52:27 [28186]: read_request_line: Client (file descriptor: 7) closed socket before read. ERROR Sep 06 14:52:31 [28160]: getpeer_information: getpeername() error: Transport endpoint is not connected

    Read the article

  • Configuring postfix with Gmail

    - by MultiformeIngegno
    This is what I did.. sudo apt-get install postfix This is my /etc/postfix/main.cf: # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=no smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache myhostname = tsXXX561.server.topcloud.it alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = relayhost = [smtp.gmail.com]:587 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = loopback-only default_transport = smtp relay_transport = smtp inet_protocols = all # SASL Settings smtp_use_tls=yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_tls_security_options = noanonymous smtp_tls_CAfile = /etc/postfix/cacert.pem Then I created the file /etc/mailname with my hostname as content: tsXXX561.server.topcloud.it Then I created the file /etc/postfix/sasl_passwd: [smtp.gmail.com]:587 [email protected]:gmail_password Then sudo postmap /etc/postfix/sasl/passwd sudo cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem service postfix restart Still sends nothing... I'm on Ubuntu Server 12.04.

    Read the article

  • WSS 3.0 fails to hide quick launch items for which the current user does not have access

    - by Nils
    I'm running a Small Business Server 2008 with Windows Sharepoint Services 3.0 (WSS 3.0). I thought WSS was supposed to hide menu items for which the current logged in user don't have access? Apparently, all users can see all links, regardless of whether they have access. This applies to both links to newly created sub-sites as well as document libraries/lists. Is this expected behaviour, or is there a misconfiguration somewhere that causes the links to stay visible even for users without access? Thanks!

    Read the article

  • What is the max supported number of SATA devices (using cable adapters) on a Dell SAS 6/iR adapter?

    - by Zac B
    I've got a Dell SAS 6/iR PCI-E adapter. I don't have a multiplier backplane. I'm planning on connecting SATA (non SAS) drives. If I buy cable adapters only (ones that split a SAS connector on the card to a certain number of SATA cables), how many drives can I connect to this card? The way I see it, there are two limitations: a limitation imposed by the theoretical max number of devices supported on the card (which I've dug through the specs to find, but haven't seen yet), and a limitation imposed by the number of SAS plugs on the card multiplied by the number of SATA cables that come out of the highest-multiplying splitter I can buy. The answer to my question would be the minimum of those two limitations. I've seen 4x SATA coming out of some splitters; are there any that have more? Alternatively, if this is an RTFM question, does anyone have a good link to a "this is how SAS works, this is how you figure out the max number of devices, and this is how the concepts of 'ports', 'lanes', 'endpoint devices', and 'connectors' all relate in SAS-land" document? I've looked around on the Dell docs, but haven't found anything that explains this to someone at my level of understanding of SAN/enterprise storage technologies. Cheers!

    Read the article

  • apache/httpd responds slower under EL6.1 than EL5.6 (centos)

    - by daniel
    I've read through other threads on performance differences between RHEL6 and RHEL5, but none seem a tight match to mine. My issue manifests itself in slightly slower average response time (20ms) per request. I have about 10/10 servers of the same hardware spec with Cent6.1 and Cent5.6. The issue is consistent across the group. I am running Ruby on Rails with Passenger. Apache config is identical (checked out from the same SVN repo) Ruby and Passenger are identical builds. Application is identical and being served traffic round robin. mod_worker An interesting clue from server-status: The Cent6.1 servers have a steady 20-40 threads in the "Reading Request" state while the Cent5.6 servers have around 1. I'm graphing this so I can see it trend over time. I also have a bunch of much newer machines that are significantly faster and are running Cent6.1. They dust all the older machines in response time, but I can see they also have a steady 20-40 threads in the "Reading Request" state. This makes me believe I can get their response time down, if I can figure out what is holding up these requests. My gut is telling me that I need to tune some network setting in sysctl, but I haven't figured it out yet. Help is appreciated.

    Read the article

  • How do I tell Websphere 7 about a front end load balancer so that re-directs are handled correctly?

    - by TiGz
    On WebLogic 11G I can use the console to set the FrontendHost and FrondendPort on a server or on a cluster so that re-directs are handled correctly and end up resolving to the front end load balancer instead of the local host. The MBeans associated with this on WebLogic are, for example: MBean Name com.bea:Name=AdminServer,Type=WebServer,Server=AdminServer Attribute Name FrontendHost Description The name of the host to which all redirected URLs will be sent. If specified, WebLogic Server will use this value rather than the one in the HOST header. Sets the HTTP frontendHost Provides a method to ensure that the webapp will always have the correct HOST information, even when the request is coming through a firewall or a proxy. If this parameter is configured, the HOST header will be ignored and the information in this parameter will be used in its place. Type java.lang.String Readable / Writable RW How is the same thing achieved under Websphere 7? Follow up info: So I have 2 use cases actually. One is that I have a web app running under WebSphere on host A on port 9002 and a LB running on host B at port 80, when I visit the home page of the app via the LB on http://hostb/app the app redirects my browser to http://hostb:9002/app and it 404's I think this is WebSphere's fault but I guess it could be the app's fault? The second is that the web app in question needs to send emails containing URls that the customer can click on to get back into the web app - obviously this needs to be via the LB. On WebLogic the app uses MBeans to derive the LB url and I was hoping to use a similar mechanism on WebSphere.

    Read the article

  • Include requested hostname in access_log

    - by Aaron J Spetner
    I would like my access_log to list the host name that the client is requesting (e.g. when requesting http://www.example.com/test I should see "www.example.com" in the log). The only thing I have found so far is to use %v in the LogFormat directive, but this only gives "the canonical ServerName of the server serving the request" (as described by Apache at http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#formats). This does not help me for requests that use a hostname that is not specified in a ServerName directive. Is there any way to log the requested hostname? Thanks

    Read the article

  • How to schedule a task X minutes after Windows Server 2003 starts?

    - by Joe Schmoe
    How to schedule a task X minutes after Windows Server 2003 starts? In "Scheduled Tasks" one can specify "When my computer starts" but I see no way to specify delay. What I am trying to achieve: there is a service (JIRA) that even though dependent on SQL Server service still doesn't wait long enough for SQL Server to become fully operational. So JIRA service fails to connect to the database and needs to be restarted manually after each server reboot. My plan is to add "SC stop" and "SC start" commands for JIRA service 3 minutes after server starts.

    Read the article

  • MSDTC - Communication with the underlying transaction manager has failed (Firewall open, MSDTC network access on)

    - by SocialAddict
    I'm having problems with my ASP.NET web forms system. It worked on our test server but now we are putting it live one of the servers is within a DMZ and the SQL server is outside of that (on our network still though - although a different subnet) I have open up the firewall completely between these two boxes to see if that was the issue and it still gives the error message "Communication with the underlying transaction manager has failed" whenever we try and use the "TransactionScope". We can access the data for retrieval it's just transactions that break it. We have also used msdtc ping to test the connection and with the amendments on the firewall that pings successfully, but the same error occurs! How do i resolve this error? Any help would be great as we have a system to go live today. Panic :) Edit: I have created a more straightforward test page with a transaction as below and this works fine. Could a nested transaction cause this kind of error and if so why would this only cause an issue when using a live box in a dmz with a firewall? AuditRepository auditRepository = new AuditRepository(); try { using (TransactionScope scope = new TransactionScope()) { auditRepository.Add(DateTime.Now, 1, "TEST-TRANSACTIONS#1", 1); auditRepository.Save(); auditRepository.Add(DateTime.Now, 1, "TEST-TRANSACTIONS#2", 1); auditRepository.Save(); scope.Complete(); } } catch (Exception ex) { Response.Write("Test Error For Transaction: " + ex.Message + "<br />" + ex.StackTrace); }

    Read the article

  • LAN full of public ipv4 addresses - How to filter it?

    - by sparc86
    The answer to my question maybe is not that hard but anyways, I do not know what to do. So, I just got in a new job in a Univerisity and I found out that the network (the LAN) is full of public IP addresses. Seriously, the whole LAN (probably more than 150 hosts) has it' own internet IP address and I don't know how to manage it. I have a very good experience using iptables (Linux firewall) in a NAT'ed environment. But then how should I proceed in an environment where all my LAN is working with a bunch of public IP addresses? Should I just use the "forward" rules and ignore the NAT rules or is there any other issue in such environment which I should take care? Can I add a firewall between the router and the LAN in order to produce packet filtering for these public IP addresses in my LAN or will this just not work? Thanks!

    Read the article

  • Google Chrome in Incognito Mode still logging visits history

    - by casey_miller
    I am using Incognito Mode and today I have noticed that when I frequently visit some site in that mode browser logs it and even on not incognito mode it autofills in address bar making Incognito mode useless in my case. Another fun thing is that the item is not in History so I can't manually remove it. Couldn't find anything in Settings. Why is this happening? BTW, instant search is disabled in my case. Using the latest version to date. Extensions installed List item Send to Google Docs Google Translate Eye Dropper Delicious Readabiliy Pagespeed

    Read the article

  • How can I use an SSH tunnel for all traffic from a single application, without knowing the ports used?

    - by Matthew Read
    I have an application that opens connections on dozens of ports, and doesn't provide documentation about which ports it uses. I could use Wireshark or something to capture the traffic and export the ports from that, but I think it should be simpler than that. (And I'm not sure I would be able to cover all use cases and ensure the app used every single port it can ever use.) So I'm looking for a way to just say "forward all traffic from this application" (bonus points for all traffic from child processes as well) without needing to worry about specific ports. I'm sure there must be a way, but I couldn't hit on the right keywords while searching Google. How can I do this?

    Read the article

  • Cannot ping Google Public DNS on 8.8.8.8

    - by Tibor
    I have a weird problem on my Windows 7 (x64) computer. I seem to cannot ping the Google Public DNS on one of its addresses (while the other works fine). The peculiar thing is that it fails with the General failure. error message which usually means that there is a problem with a network adapter/base connectivity and not a timeout as one would expect. I checked my routing tables for any anomalies and I even flushed them but the problem seems unrelated. All the other hosts I tried ping fine (either respond or timeout). If I try to tracert or connect to the address via browser (yes, I know that it doesn't listen on port 80), it also fails instantaneously. The reason I need to ping 8.8.8.8 is that I commonly use it as a test of Internet conectivity due to it being rememberable. The problem occurs no matter where I connect to the Internet (it is a laptop computer). What could be the cause of this anomaly? Note: I use native IPv6 connectivity.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14  | Next Page >