Daily Archives

Articles indexed Sunday October 7 2012

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

  • Django: Is it possible to attach media files (css, javascript etc) to a View-class?

    - by mrmclovin
    I can't fins any information on how to define css or javascript files in a view like: class MyView(View): .... class Media: css = { 'all' : 'mystyle.css' } If you have a form you can do like: class MyForm(ModelForm): .... class Media: css = { 'all' : 'mystyle.css' } And then in the template you can print the files like; {{ form.media.css }} I like that Syntax very much and I like to keep the View-specific css files in the app-directory. Does anyone know if it's possible? Thanks!

    Read the article

  • Types in Union or Concat cannot be constructed with hierarchy

    - by user927777
    I am trying to run a query very similar to the following: (from bs in DataContext.TblBookShelf join b in DataContext.Book on bs.BookID equals b.BookID where bs.BookShelfID == bookShelfID select new BookItem { Categories = String.Join("<br/>", b.BookCategories.Select(x => x.Name).DefaultIfEmpty().ToArray()), Name = b.Name, ISBN = b.ISBN, BookType = "Shelf" }).Union(from bs in DataContext.TblBookShelf join bi in DataContext.TblBookInventory on bs.BookID equals bi.BookID select new BookItem { Categories = String.Join("<br/>", bi.BookCategories.Select(x => x.Name).DefaultIfEmpty().ToArray()), Name = bi.Name, ISBN = bi.ISBN, BookType = "Inventory" }); I am receiving "Types in Union or Concat cannot be constructed with hierarchy" after the statement executes, I need to to be able to get a list of categories to display with each book. If anyone could shed some light on a possible solution, it would be greatly appreciated.

    Read the article

  • Bind nic to VM on VMware ESXi 5

    - by lewis
    I have physical server with 2 Broadcom NIC's. First NIC connected to local network, via this connection we can: Connect to ESXi hypervisor (hypervisor has local ip, e.g. 192.168.1.5) Connect to VM on this hypervisor (VM has network adapter, with local ip, e.g. 192.168.1.6) Second NIC connected to "global" network. Via second link(and public IP), we can have access to VM from Internet. How I may setup VM to use second NIC's connection?

    Read the article

  • Methods in the namespace System.Security.Cryptography take 2 minutes to perform when service is hosted in IIS

    - by Asaf Saf
    I built an ASP.NET web-service that uses the System.Security.Cryptography namespace when it handles its requests. When I hosted the service in ASP.NET Development Server, everything worked fine. Then I moved the service into IIS, still using localhost addresses, and surprisingly, each time the service calls a method from the specified namespace, it takes 2 minutes to complete! If a single request requires the service to call 3 methods of the specified namespace, then the request takes total of 6 minutes to complete! The traces show that the request has been received on time, and they show an interval of around 2 minutes upon each call to the specified namespace. Did anyone see this strange behavior elsewhere? Any speculation would be appreciated!

    Read the article

  • .Net in HTML tp return true if reader object not null, otherwise return false

    - by Phill Healey
    I'm using a DataList to show some data from the database and populating the fields on the html side. I now have a requirement to change the visibility of a panel based on whether or not a db field has data or not. I need to be able to show the panel if the relevant data field has content, and hide it if it doesn't. Eg: <asp:Panel ID="pnlNew" runat="server" Style="margin:0; padding:0; width:42px; height:18px; bottom:5px; right:10px; float:right; position:relative; background:url(../_imgVideoBadge.png) no-repeat;" Visible='<%# Eval("cheese") != null %>' ToolTip="available"></asp:Panel> Obviously this doesn't work in terms of the visible property. But hopefully it gives an idea of what I'm trying to achieve. Any help would be greatly appreciated. I've seen examples previously of doing something along the lines of: a ?? b:c How could this be applied to the above requirement?? Thanks in advance.

    Read the article

  • FileInputStream and FileOutputStream to the same file: Is a read() guaranteed to see all write()s that "happened before"?

    - by user946850
    I am using a file as a cache for big data. One thread writes to it sequentially, another thread reads it sequentially. Can I be sure that all data that has been written (by write()) in one thread can be read() from another thread, assuming a proper "happens-before" relationship in terms of the Java memory model? Is this behavior documented? EDIT: In my JDK, FileOutputSream does not override flush(), and OutputStream.flush() is empty. That's why I'm wondering... EDIT^2: The streams in question are owned exclusively by a class that I have full control of. Each stream is guaranteed to be accesses by one thread only. My tests show that it works as expected, but I'm still wondering if this is guaranteed and documented. See also this related discussion: http://chat.stackoverflow.com/rooms/17598/discussion-between-hussain-al-mutawa-and-user946850

    Read the article

  • How to access child object properties?

    - by user1698312
    I'm trying to get the text property from an entry in a dialog with the following code: GtkWidget *dialog, *entry; gchar *text; entry = gtk_entry_new(); dialog = create_dialog(); ... gtk_container_child_get(GTK_CONTAINER(dialog), entry, "text", text, NULL); and i'm getting the following: (textview:3079): Gtk-WARNING **: /build/buildd/gtk+3.0-3.4.2/./gtk/gtkcontainer.c:919: container class `GtkDialog' has no child property named `text' The dialog contains a label and an entry with two buttons.

    Read the article

  • How do I break down an NSTimeInterval into year, months, days, hours, minutes and seconds on iPhone?

    - by willc2
    I have a time interval that spans years and I want all the time components from year down to seconds. My first thought is to integer divide the time interval by seconds in a year, subtract that from a running total of seconds, divide that by seconds in a month, subtract that from the running total and so on. That just seems convoluted and I've read that whenever you are doing something that looks convoluted, there is probably a built-in method. Is there? I integrated Alex's 2nd method into my code. It's in a method called by a UIDatePicker in my interface. NSDate *now = [NSDate date]; NSDate *then = self.datePicker.date; NSTimeInterval howLong = [now timeIntervalSinceDate:then]; NSDate *date = [NSDate dateWithTimeIntervalSince1970:howLong]; NSString *dateStr = [date description]; const char *dateStrPtr = [dateStr UTF8String]; int year, month, day, hour, minute, sec; sscanf(dateStrPtr, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &sec); year -= 1970; NSLog(@"%d years\n%d months\n%d days\n%d hours\n%d minutes\n%d seconds", year, month, day, hour, minute, sec); When I set the date picker to a date 1 year and 1 day in the past, I get: 1 years 1 months 1 days 16 hours 0 minutes 20 seconds which is 1 month and 16 hours off. If I set the date picker to 1 day in the past, I am off by the same amount. Update: I have an app that calculates your age in years, given your birthday (set from a UIDatePicker), yet it was often off. This proves there was an inaccuracy, but I can't figure out where it comes from, can you?

    Read the article

  • C# 5.0 Async/Await Demo Code

    - by Paulo Morgado
    I’ve published the sample code I use to demonstrate the use of async/await in C# 5.0. You can find it here. Projects PauloMorgado.AyncDemo.WebServer This project is a simple web server implemented as a console application using Microsoft ASP.NET Web API self hosting and serves an image (with a delay) that is accessed by the other projects. This project has a dependency on Json.NET due to the fact the the Microsoft ASP.NET Web API hosting has a dependency on Json.NET. The application must be run on a command prompt with administrative privileges or a urlacl must be added to allow the use of the following command: netsh http add urlacl url=http://+:9090/ user=machine\username To remove the urlacl, just use the following command: netsh http delete urlacl url=http://+:9090/ PauloMorgado.AsyncDemo.WindowsForms This Windows Forms project contains three regions that must be uncommented one at a time: Sync with WebClient This code retrieves the image through a synchronous call using the WebClient class. Async with WebClient This code retrieves the image through an asynchronous call using the WebClient class. Async with HttpClient with cancelation This code retrieves the image through an asynchronous call with cancelation using the HttpClient class. PauloMorgado.AsyncDemo.Wpf This WPF project contains three regions that must be uncommented one at a time: Sync with WebClient This code retrieves the image through a synchronous call using the WebClient class. Async with WebClient This code retrieves the image through an asynchronous call using the WebClient class. Async with HttpClient with cancelation This code retrieves the image through an asynchronous call with cancelation using the HttpClient class.

    Read the article

  • Windows Store is open for business!

    - by pluginbaby
    In case you didn’t know, you don’t have to wait for the launch of Windows 8 on October 26 to start building and deploying your apps. Developers from 120 markets (including Canada) can publish Windows Store apps right now! How to start ? Anyone with an MSDN Subscription, Dreamspark account (students) or BizSpark account (startups) get a 1-year Windows Store membership for FREE!! If you don’t have such account, an annual membership is only CAD $49 and lasts a full year. Just go to the Windows Store Dashboard on the Windows Dev Center and sign up. The dev tools are free and the SDK is ready.

    Read the article

  • Run preseed commands as specific user / switching users

    - by pduersteler
    Beside the usual setup where I create a normal user foo, I want to run a few d-i preseed/late_command commands as that foo user. My initial thought was to simply call those commands with sudo, e.g: d-i preseed/late_command in-target echo "<pwd>" | sudo -Si <command>. This works for some sort of commands. However the problem is that some of the commands load up shell scripts which require to not be run with sudo. Issuing a su -c "<command>" would be an alternative, but su does not offer the possibility to read the password from stdin. Is it safe to jump around between the users using su (And if yes, how do I provide the stdin? and does it work or just result in a su: must be run from a terminal) or would this cause issues?

    Read the article

  • Postgresql init.d script not working

    - by Bram Jetten
    I installed Postgresql 8.4 on my VPS with Ubuntu 10.04. Default setup, nothing unusual. After the installation the dbserver is automatically started and is running great. The installer also sets a init.d script in place. This script however, doesn't seem to affect Postgres. $ sudo /etc/init.d/postgresql stop The above line is not stopping the server. The command does not fail or show any message. The logs won't say anything as well. After killing all postgres processes with killall I cannot get Postgres working again using the init script. When rebooting my VPS it somehow starts up and works again.

    Read the article

  • How to run a logon script but not as the current user

    - by user139951
    I want to create a log of when people login or logout of computers in a computer lab. My first idea was to just create login/logout scripts that contact a server, but the problem is since these scripts would run as the current user, that they would then be able to run this script outside of these two occasions. Is there any way to go about running a login/logout script as the domain computer rather than as the user?

    Read the article

  • SSRS 2005 report manager link not coming up

    - by Mohammed Moinudheen
    On my SQL Server 2005 installation. I am able to view the report server URL but I am unable to logon to the report manager URL. "http://servername/reports" I don't get any error message at all. Only thing is the page never loads and is in a hanged state. From the reporting services log folder, I am unable to see any useful messages getting logged in the log file. I also checked the IIS server logs and didn't get any useful information either. Have anyone of you experienced this before? Is there any way to fix this problem, please share your thoughts.

    Read the article

  • Tomcat "connection interrupted" with ssl

    - by Mike Thomsen
    I can access Tomcat on port 8080, but not on 8443. When I try o get there, this is the error I get in Firefox: The connection was interrupted The connection to the.fqdn.com:8443 was interrupted while the page was loading. This is my connector: <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="want" sslProtocol="TLS" keystoreFile="C:\temp\keystore.jks" keystorePass="changeit"/> I have the CA key in the jre's cacerts file. The server cert was generated using EJBCA and should be signed properly. Any suggestions on what is going on?

    Read the article

  • Apache 2.4 subdomain setup fails

    - by Grashopper
    I am struggling with this all the day, no answer i found here as well. Please advice how to setup proper a subdomain i need. My Apache config has 2 domains configured (on same IP), for the domain2.com i need to setup a sub-domain. Here is what i have so far, but the subdomain keeps redirecting me to domain2.com (main site). <VirtualHost 11.11.11.11:80> ServerName domain1.com ServerAlias domain1.com *.domain1.com DocumentRoot "C:/wwwmap/domain1.com" </VirtualHost> <VirtualHost 11.11.11.11:80> ServerName domain2.com ServerAlias domain2.com *.domain2.com DocumentRoot "C:/wwwmap/domain2.com" </VirtualHost> <VirtualHost 46.4.24.4:80> ServerName projects.domain2.com DocumentRoot "C:/wwwmap/projects" </VirtualHost> The DNS entry is: projects in CNAME domain2.com Trying to remove ServerAlias domain2.com *.domain2.com worked so far, but then domain2.com is redirecting to domain1.com What am i doing wrong?

    Read the article

  • RAID1: Which disk will be mirrored?

    - by tmelen
    How does a RAID1 system determine which disk to use as the source and which disk to use as the destination when mirroring? Assume for instance the following scenario: A RAID1 array is created with two disks A and B. A is replaced by disk C, which is added to the array. Files are beeing modified as time goes by. Now B is removed and A is reinserted. Will the RAID1 system realize that A and C are out of sync? And that C is more up-to-date than A? And if not, is there a safe way to avoid the mirroring process to start immediately when disk A is inserted?

    Read the article

  • my.ini optimization on Windows 2008 R2 VPS

    - by MKphpDev
    I have a vmware VPS running Windows Server 2008 R2 Enterprise that has performance issues with MySQL. Every few minutes, MySQL stall for few seconds then responed to queries. I'm sure that my.ini need to be optimized, but unfortunately, I don't have any idea of my.ini configuration. What's running on the server: 2 small wordpress blogs, 1 vbulletin forums (approx. 1.2 GB database, and increasing), small database for some sort of plug-ins (no more than 4000 records) Server Info: Processor: Intel Xeon X5550 @ 2.67GHz, RAM: 6 GB (memory useage never exceeded 2 GB), MySQL 5.5, PHP 5.3.10, IIS 7 current my.ini: [mysqld] default-storage-engine=INNODB sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE _USER,NO_ENGINE_SUBSTITUTION" max_connections=250 myisam_max_sort_file_size=20G innodb_additional_mem_pool_size=256M innodb_flush_log_at_trx_commit=1 innodb_log_buffer_size=8M innodb_buffer_pool_size=512MB innodb_log_file_size=128M innodb_thread_concurrency=10 key_buffer_size = 512M myisam_sort_buffer_size = 8M join_buffer_size = 256K read_buffer_size = 256K sort_buffer_size = 256K table_cache = 4000 thread_cache_size = 200 wait_timeout = 30 connect_timeout = 10 tmp_table_size = 32M max_allowed_packet = 1M max_connect_errors = 10000 query_cache_size = 16M query_cache_limit = 2M query_cache_type = 1 query_cache_min_res_unit = 1024 query_prealloc_size = 16384 query_alloc_block_size = 16384 skip-external-locking read_rnd_buffer_size=1M max_heap_table_size=16M thread_concurrency=8 [mysqld_safe] open_files_limit = 8192 [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer_size = 128M sort_buffer_size = 128M read_buffer = 2M write_buffer = 2M any help with that, please?

    Read the article

  • HP ACU shows parity initialization failed (with screenshot)

    - by lbanz
    I put in a new drive due to a hard drive failure. When the rebuild got to 100%, the controller fails and I need to reboot the server to bring it online. I had to do this about three times and it eventually finished rebuilding. But I found that it says parity initialization status failed. I've left it for a few hours but it didn't seem to reinitialize. Then I ran the insight online diagnostic tools and it reported the disk that I put in reached read/write error threshold. So I'm beginning to think that the brand new disk I put in is faulty. Before I put in the disk, the parity initialization was at a finished state. Should I replace the new disk I put in? I'm very worried as I think the parity is broken. Or is there a way to kick start the initialization process?

    Read the article

  • Blocking IP address with port forwarding

    - by Jeff Storey
    I have a website setup behind a router, so the router has the external facing address and it will forward requests to the webserver inside the network. If there are X number of invalid login attempts, that IP address will be blocked from logging in. The problem is that because the site is being accessed through port forwarding, all requests show up as though they are coming from the router address, and thus the router address becomes the blocked IP. I'm not sure if this is a limitation of the router (linksys wrt160n) or if this a more general issue. Is there a way to handle this?

    Read the article

  • LVM2 volume group lost

    - by MrG
    I updated one of my servers, but - although I took care not to modify - the volume groups on /dev/sdb1 were lost, although the physical volumes seem to be still there: [root@server ~]# pvscan PV /dev/sda2 VG VolGroup lvm2 [465,16 GiB / 0 free] PV /dev/sdb1 lvm2 [1,82 TiB] Total: 2 [2,27 TiB] / in use: 1 [465,16 GiB] / in no VG: 1 [1,82 TiB] [root@server ~]# pvs -v Scanning for physical volume names PV VG Fmt Attr PSize PFree DevSize PV UUID /dev/sda2 VolGroup lvm2 a-- 465,16g 0 465,16g HftbaD-MBs0-3p7D-6O13-CrzU-T9Gb-6W0ofB /dev/sdb1 lvm2 a-- 1,82t 1,82t 1,82t dD4XZP-WStA-61xV-5Sff-ifmW-R4rR-JenHoU [root@server ~]# pvck -d -v /dev/sdb1 Scanning /dev/sdb1 Found label on /dev/sdb1, sector 1, type=LVM2 001 Found text metadata area: offset=4096, size=1044480 Found LVM2 metadata record at offset=10752, size=1037824, offset2=0 size2=0 Found LVM2 metadata record at offset=9216, size=1536, offset2=0 size2=0 Found LVM2 metadata record at offset=7168, size=2048, offset2=0 size2=0 Found LVM2 metadata record at offset=5632, size=1536, offset2=0 size2=0 I attempted to fix it as described here and was able to extract the 4 meta data sets listed above (using i.e. dd bs=1 skip=5632 count=1536 if=/dev/sdb1 of=output.file), none of them includes the lv_data which I'm missing. Please advise how I could access the files which should be on /dev/sdb1 there. Any help is appreciated!

    Read the article

  • Extracting a line section of mysql backup using sed

    - by carpii
    I occasionally need to extract a single record from a mysqlbackup To do this, I first extract the single table I want from the backup... sed -n -e '/CREATE TABLE.*usertext/,/CREATE TABLE/p' 20120930_backup.sql > table.sql In table.sql, the records are batched using extended inserts (with maybe 100 records per insert before it creates a new line starting with INSERT INTO), so they look like... INSERT INTO usertext VALUES (1, field2 etc), (2, field2 etc), INSERT INTO usertext VALUES (101, field2 etc), (102, field2 etc), ... Im trying to extract record 239560 from this, using... sed -n -e '/(239560.*/,/)/p' table.sql > record.sql Ie.. start streaming when it finds 239560, and stop when it hits the closing bracket But this isnt working as I hoped, it just results in the full insert batch being output. Please can someone give me some pointers as to where Im going wrong? Would I be better off using awk for extracting segments of lines, and use sed for extracting lines within a file?

    Read the article

  • Backup script to FTP with timed subfolders

    - by Frederik Nielsen
    I want to make a backup script, that makes a .tar.gz of a folder I define, say fx /root/tekkit/world This .tar.gz file should then be uploaded to a FTP server, named by the time it was uploaded, for example: 07-10-2012-13-00.tar.gz How should such backup script be written? I already figured out the .tar.gz part - just need the naming and the uploading to FTP. I know that FTP is not the most secure way to do it, but as it is non-sensitive data, and FTP is the only option I have, it will do. Edit: I ended up with this script: #!/bin/bash # have some path predefined for backup unless one is provided as first argument BACKUP_DIR="/root/tekkit/world/" TMP_DIR="/tmp/tekkitbackup/" FINISH_DIR="/tmp/tekkitfinished/" # construct name for our archive TIME=$(date +%d-%m-%Y-%H-%M) if [ $1 ]; then BACKUP_DIR="$1" fi echo "Backing up dir ... $BACKUP_DIR" mkdir $TMP_DIR cp -R $BACKUP_DIR $TMP_DIR cd $FINISH_DIR tar czvfp tekkit-$TIME.tar.gz -C $TMP_DIR . # create upload script for lftp cat <<EOF> lftp.upload.script open server user user password lcd $FINISH_DIR mput tekkit-$TIME.tar.gz exit EOF # start backup using lftp and script we created; if all went well print simple message and clean up lftp -f lftp.upload.script && ( echo Upload successfull ; rm lftp.upload.script )

    Read the article

  • Ngingx max worker_connections and access log

    - by MotoTribe
    I'm troubleshoot an issue with my site. I'm seeing in the ngingx-error.log that the max worker_connection limit has been reached when the site went down. I'm not seeing an increase of requests during that time in the ngingx-access.log. Does that mean the mysql database had a bottleneck at that time that caused the requests to queue up? Or would it not log any requests that where made after the max worker_connection limit has been reached?

    Read the article

  • Rsync over ssh: "ERROR: module is read only" suddenly appeared

    - by user978548
    I've used from some time rsync/ssh to backup my shared host contents to my personal Synology NAS (212j for that matter), and it worked quite well. For information, I use a password-less ssh connection. 3 days ago, I updated my NAS software and since (or at least I believe it's since that), the backup won't work anymore. I get the following error on the host: rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Broken pipe (32) ERROR: module is read only ..which I do not understand. beside that nothing changed that I know of in both source and destination that can be related to rsync or ssh, I did check a few things and all seems to be alright: I can still connect through ssh from the host to my NAS with the good user, so ssh stuff like keys haven't changed. I also have the correct file permissions on the NAS (I checked, and also tried to create files, directories, .. with the user used by rsync through ssh). I read here and there that the error means that I have to ensure that my rsyncd.conf have the right read only = no in it, but as far as I know, I never used rsyncd as well as I never configured anything for it and until now it worked like a charm.. I use the following command to do the backup: rsync -ab --recursive \ --files-from="$FILES_FROM" \ --backup-dir=backup_$SUFFIX \ --delete \ --filter='protect backup_*' \ $WDIRECTORY/ \ remote_backup:$REMOTE_BACKUP/ So I'm stuck and really can't figure out what happened. Edit: As suggested in comments, I also tried passing commands to ssh (but not from inside a ssh session), that worked as expected, and also tried a single rsync command, which didnt worked, failing just like the complete backup command. (sharedHost):hostuser:~ > touch test.txt (sharedHost):hostuser:~ > rsync test.txt remote_backup:backups/test.txt ERROR: module is read only rsync error: syntax or usage error (code 1) at main.c(1034) [Receiver=3.0.8] rsync: connection unexpectedly closed (9 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7] and (sharedHost):hostuser:~ > ssh remote_backup 'touch /abs_path_to_backups/backups/test2.txt && echo "ProoF" > /abs_path_to_backups/backups/test2.txt' (sharedHost):hostuser:~ > ssh remote_backup 'cat /abs_path_to_backups/backups/test2.txt' ProoF

    Read the article

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