Daily Archives

Articles indexed Sunday December 2 2012

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

  • Print the next X number of lines in Scala

    - by soulesschild
    Trying to learn Scala using the Programming in Scala book and they have a very basic example for reading lines from a file. I'm trying to expand on it and read a file line by line, look for a certain phrase, then print the next 6 lines following that line if it finds the line. I can write the script easily enough in something like java or Perl but I have no idea how to do it in Scala (probably because I'm not very familiar with the language yet...) Here's the semi adapted sample code from the Programming in Scala book, import scala.io.Source if(args.length>0) { val lines = Source.fromFile(args(0)).getLines().toList for(line<-lines) { if(line.contains("secretPhrase")) { println(line) //How to get the next lines here? } } } else Console.err.println("Pleaseenterfilename")

    Read the article

  • jquery and requirejs and knockout; reference requirejs object from within itself

    - by Thomas
    We use jquery and requirejs to create a 'viewmodel' like this: define('vm.inkoopfactuurAanleveren', ['jquery', 'underscore', 'ko', 'datacontext', 'router', 'messenger', 'config', 'store'], function ($, _, ko, datacontext, router, messenger, config, store) { var isBusy = false, isRefreshing = false, inkoopFactuur = { factuurNummer: ko.observable("AAA") }, activate = function (routeData, callback) { messenger.publish.viewModelActivated({ canleaveCallback: canLeave }); getNewInkoopFactuurAanleveren(callback); var restricteduploader = new qq.FineUploader({ element: $('#restricted-fine-uploader')[0], request: { endpoint: 'api/InkoopFactuurAanleveren', forceMultipart: true }, multiple: false, failedUploadTextDisplay: { mode: 'custom', maxChars: 250, responseProperty: 'error', enableTooltip: true }, text: { uploadButton: 'Click or Drop' }, showMessage: function (message) { $('#restricted-fine-uploader').append('<div class="alert alert-error">' + message + '</div>'); }, debug: true, callbacks: { onComplete: function (id, fileName, responseJSON) { var response = responseJSON; }, } }); }, invokeFunctionIfExists = function (callback) { if (_.isFunction(callback)) { callback(); } }, loaded = function (factuur) { inkoopFactuur = factuur; var ids = config.viewIds; ko.applyBindings(this, getView(ids.inkoopfactuurAanleveren)); /*<----- THIS = OUT OF SCOPE!*/ / }, bind = function () { }, saved = function (success) { var s = success; }, saveCmd = ko.asyncCommand({ execute: function (complete) { $.when(datacontext.saveNewInkoopFactuurAanleveren(inkoopFactuur)) .then(saved).always(complete); return; }, canExecute: function (isExecuting) { return true; } }), getView = function (viewName) { return $(viewName).get(0); }, getNewInkoopFactuurAanleveren = function (callback) { if (!isRefreshing) { isRefreshing = true; $.when(datacontext.getNewInkoopFactuurAanleveren(dataOptions(true))).then(loaded).always(invokeFunctionIfExists(callback)); isRefreshing = false; } }, dataOptions = function (force) { return { results: inkoopFactuur, // filter: sessionFilter, //sortFunction: sort.sessionSort, forceRefresh: force }; }, canLeave = function () { return true; }, forceRefreshCmd = ko.asyncCommand({ execute: function (complete) { //$.when(datacontext.sessions.getSessionsAndAttendance(dataOptions(true))) // .always(complete); complete; } }), init = function () { // activate(); // Bind jQuery delegated events //eventDelegates.sessionsListItem(gotoDetails); //eventDelegates.sessionsFavorite(saveFavorite); // Subscribe to specific changes of observables //addFilterSubscriptions(); }; init(); return { activate: activate, canLeave: canLeave, inkoopFactuur: inkoopFactuur, saveCmd: saveCmd, forceRefreshCmd: forceRefreshCmd, bind: bind, invokeFunctionIfExists: invokeFunctionIfExists }; }); On the line ko.applyBindings(this, getView(ids.inkoopfactuurAanleveren)); in the 'loaded' method the 'this' keyword doens't refer to the 'viewmodel' object. the 'self' keyword seems to refer to a combination on methods found over multiple 'viewmodels'. The saveCmd property is bound through knockout, but gives an error since it cannot be found. How can the ko.applyBindings get the right reference to the viewmodel? In other words, with what do we need to replace the 'this' keyword int he applyBindings. I would imagine you can 'ask' requirejs to give us the ealiers instantiated object with identifier 'vm.inkoopfactuurAanleveren' but I cannot figure out how.

    Read the article

  • How to use associated Model as datasource for DataView

    - by Chris Gilbert
    I have a Model structure as shown below and I want to know how to use the Bookings array as the datasource of my DataView. Model Structure: Client ClientId Name Bookings (HasManyAssociation) Contacts (HasManyAssociation) AjaxProxy JsonReader (ImplicitIncludes is set to true so child models are created with one call) Booking BookingNodeId BookingDetails Contact ContactNodeId ContactDetails The above gives me a data structure as follows: Client Bookings[ Booking Booking ] Contacts[ Contact Contact ] What I want to be able to do is either, create a Store from my Bookings array and then use that store as the datasource for my DataView OR directly use the Bookings array as the datasource (I don't really care how I do it to be honest). If I setup the AjaxProxy on my Booking model it works fine but then obviously I cannot automatically create my Client and Contacts when I load my JSON. It seems to me to make sense that the Client model, being the top level model hierarchically, is the one to load the data. EDIT: I figured it out as follows (with special thanks to handet87 below for his dataview.setStore() pointer). The key in this case is to know that creating the relationship actually sets up another store called, in this case BookingsStore and ContactsStore. All I needed to do was dataview.setStore("BookingsStore")

    Read the article

  • Import Data from Excel Spreadsheet or CVS into MySQL

    - by Kelly Roper
    I have a spreadsheet which really has only one complicated table. I basically convert the spreadsheet to a cvs and use a groovy script to generate the INSERT scripts. However, I cannot do this with a table that has 28 fields with data within some of the fields on the spreadsheet that make importing into the CVS even more complicated. So the fields in the new CVS are not differentiated properly or my script has not accounted for it. Does anyone have any suggestions on a better approach to do this? Thanks.

    Read the article

  • proftpd - TLS connection hangs authenticating

    - by greydet
    I setup a proftpd server that uses TLS/SSL certificate for authentication. Everything works well when I connect through lftp or Filezilla (with explicit connection). But once I attempt connecting with simple ftp connection from Filezilla, the USER command ends with the 550 response (SSL/TLS required). After that any further connection through lftp or Filezilla (with explicit connection) will hang authenticating. Anyone knows how to workaround this issue? Is there a way to ask Filezilla to automatically use TLS/SSL if required? I am using Ubuntu server 10.04 with proftpd 1.3.2c. There is no error message in the log files.

    Read the article

  • Shrew VPN Client gives default route- changing the policy stops me from accessing VPN network

    - by Lock
    I am using the shrew client to connect to what I believe is a Netscreen VPN. Now, when connected, the client adds the VPN as the default route. I do not want this- there is only 1 network behind the VPN that I need to access. I found that with the shrew client, you can change the "Policy" settings on the connection, and can add your own networks in that should tunnel over the VPN. I do this, and add my network in, but when I connect the VPN, I get nothing. Can't access the network. Any idea why this would be? I can see my network in the routing table, and its correctly pointing to the correct gateway. A traceroute shows all time-outs, so I can't be 100% sure that it is trying to tunnel over the VPN. Any idea how I can troubleshoot this?

    Read the article

  • Windows Server (2012) ASP.NET

    - by alexus
    I honestly don't even know where to start.. I created a Windows Server 2012 (Azure) VM, inside of VM I THOUGHT I did everything whatever is required to run ASP.NET application.. BUT that wasn't a case. I'm stuck and unable to run a simple ASP.NET app HelloWorld( and I blame Microsoft! I had everything running before they decided to wipe out my VM so that's why I'm redoing that VM. What can I do to resolve this? Where should I look? My HelloWorld application returns Internal Server Error 500.19. I've must have missed something somewhere, but I need someone help me to pinpoint. PLEASE HELP!

    Read the article

  • How to set up Zabbix to monitor SQL Server Failover Active-Passive Cluster?

    - by Sebastian Zaklada
    It should be simple, so it is just most likely my approach being totally off and someone will hopefully prod me into the right direction. We have a Zabbix 2.0.3 server instance set up monitoring a bunch of different servers, but now we need to set it up to monitor and notify any alerts in regards to the SQL Server 2008 R2 Failover Active-Passive cluster. Essentially, this is a 2 servers cluster, when only one of its nodes can be "active" at a given time, serving all SQL Server related requests, while the other server just "sleeps" and from the point of anyone logged on on that server - has all of the SQL Server related services in stopped state. We have tried setting up Zabbix agents on both servers, using SQL Server 2005 templates (we could not find any 2008 specific ones and the 2005 ones always seemed to be working just fine for monitoring 2008 R2 instances) and configuring Zabbix server for both of the servers, but we end up having constant alerts for the server being currently the passive one in the cluster. We have been able to look up various methods of actually monitoring the failover, but we have not been able to find any guidance in regards to how to instruct Zabbix, that in this particular case, only one of the servers in the group is expected to be in the online state, while the other can be just discarded and should not raise any alerts. I hope I made myself clear. Thanks for any guidance. I am out of ideas.

    Read the article

  • WSUS performance for unneeded updates

    - by mhouston100
    We have a WSUS server serving around 300 PC's and a couple of dozen servers and a discussion came up at work as to what products to include. We have a single SQL 2005 instance on one of the servers and it has NEVER been updated. My first thought was to just tick the box for SQL 2005 and let WSUS do it's thing to upgrade to the latest service pack at least. One of the other guys here has the opinion that having updates that are relevant to only a small selection of hosts would effect the performance of WSUS as a whole, claiming that each update does a 'check' against all the hosts or something similar. My argument is that manually updating these servers is obviously not working as the admins are not paying attention to what is needed. So my question is: Do updates that only effect a sub-set of the hosts effect the overall performance of the WSUS server in relation to ALL the hosts? (disk space is not an issue at this point) Is there any performance justification for or against manually updating small amounts of products? Basically I'm needing a rebuttal against his argument and I'm unable to find any concrete documentation to prove him wrong.

    Read the article

  • Dual Nic, one keeps dropping

    - by user1215018
    I'm running windows server 2008 r2 on a dell poweredge 2850. I have 2 NICs, one is configured behind a firewall with a dhcp server on the main local LAN and another one has it's own dedicated connection to one of our 13 static IPs. So in a nutshell we have 2 of our static IPs going to this server, one indirectly through a firewall/dhcp server, and the other directly. I am trying to reach IIS on port 80 and port 443. The problem is that the NIC with the direct connection (NIC2) keeps dropping and says either "No internet connection" or "Unauthenticated". However, the NIC behind the firewall (NIC1) has no problems at all. Update: This is the second time this has happened in 3 days and each time the fix has been enabling the dhcp client on the NIC, allowing it to error out to a 169.x.x.x address, then re-enabling the nic with it's static IP assignment.

    Read the article

  • linux + change/edit file without effecting on file date

    - by yael
    I want to edit some file in my linux for example ls -ltr /etc/some_file -rw-r--r-- 1 root root 188 Jul 1 2010 sysstat . echo "Server101_IP=187.0.98.4" >> /etc/some_file . I expect to get the following date: ls -ltr /etc/some_file -rw-r--r-- 1 root root 188 Jul 1 2010 sysstat but the date & time of this file must be not change ! I just want to edit file but I Wondering how to change the file without effect on the date & time of the file - is it possible ?

    Read the article

  • how to drop_caches in OpenVZ centos6 container

    - by Omar Jackman
    I have tried sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' sudo echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches and a bunch of other variations but with every try I get bash: /proc/sys/vm/drop_caches: Permission denied How do I clear the ram used for buffers/cache in my centos6 openvz container? It seems like the only way to do what I need is to reboot the container.

    Read the article

  • ProFTPD mod_tls is not loaded properly?

    - by develroot
    The server is running CentOS 5 with DirectAdmin. I am trying to get ProfFTPD work over TLS, however it seems that proftpd is lacking mod_tls support, even though it was compiled with mod_tls. # proftpd -l Compiled-in modules: mod_core.c mod_xfer.c mod_auth_unix.c mod_auth_file.c mod_auth.c mod_ls.c mod_log.c mod_site.c mod_delay.c mod_facts.c mod_ident.c mod_ratio.c mod_readme.c mod_cap.c As you can see there is no mod_tls.c, however, the DirectAdmin configuration file for proftpd suggests that it was built with TLS support: # cat /usr/local/directadmin/custombuild/configure/proftpd/configure.proftpd #!/bin/sh install_user=ftp \ install_group=ftp \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var/run \ --mandir=/usr/share/man \ --without-pam \ --disable-auth-pam \ --enable-nls \ --with-modules=mod_ratio:mod_readme:mod_tls And all I get when I try to connect over FTPS using FileZilla is: Raspuns: 220 ProFTPD 1.3.3c Server ready. Comanda: AUTH TLS Raspuns: 500 AUTH not understood Comanda: AUTH SSL Raspuns: 500 AUTH not understood Am I missing something? thanks.

    Read the article

  • Backup XAMPP (Htdocs & MySQL)

    - by Max
    I have a development server, but would like to backup everything at least daily to a remote location. I would like to backup the htdocs folder and the MySQL servers. But if possible also the settings of the server and anything else relevant. At the moment I am using DropBox for the htdocs, but this is not ideal. I have looked into Git, DropBox simple copy paste on a daily basis. I was wondering what any advice would be. For example how hard would it be to set it up as a cloud based system? Any and all advice is greatly appreciated.

    Read the article

  • Debian - error while loading shared libraries

    - by Jirí Valoušek
    i have an problem with script DocToText from Silvercoders.com on my 64bit Debian Squeeze. It works properly on another 32bit machine, but on this i have still problem with some .so module. # file /bin/bash /bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped if i run doctotext.sh it`s return an error: ./doctotext: error while loading shared libraries: libgsf-1.so.114: cannot open shared object file: No such file or directory please, can you help?

    Read the article

  • Unable to log iptables

    - by ActuatedCrayon
    I'm having trouble getting iptables to log to any file. My iptables looks like: Chain INPUT (policy ACCEPT 1366 packets, 433582 bytes) pkts bytes target prot opt in out source destination 869 60656 LOG icmp -- venet0 * 0.0.0.0/0 0.0.0.0/0 LOG flags 0 level 7 Syslogd is the only log helper running. The default syslog.conf didn't work, so I tried adding "kern.=debug -/var/log/iptables.log". But the file already has "kern.* -/var/log/kern.log". There are recent syslog entries, so it's not a permissions thing. I'm running Ubuntu 12.04.1 with 2.6.32-042stab061.2

    Read the article

  • Building an Email server for mass emails

    - by EGHDK
    I recently started doing IT odd jobs for a company. The company has a pretty decent sized mail list that costs them over $3000 per month to send out email from. The company is set on creating their own email server so that it can just run and send emails to the client lists. They only send out emails roughly once a month. Has anyone had experience with this? This wouldn't be an email server I guess (as it doesn't need to handle incoming messages) It just has to be able to send around 200,000 emails, once a month. What would be the best way to go about this? Services online like MailChimp have proved to be too pricey. It's not an ad that is being sent out, it's more of a monthly newsletter, so we don't need any crazy software for ROI or anything crazy like that. If I could fit 200,000 people in GMAIL, I'd do it, but I don't think I can (heh... maybe I should try).

    Read the article

  • Adding IP address to OpenVZ VPS (OpenVZ Web Panel)

    - by andy
    I apologise if I sound at all dumb. This is my first dedicated server having used a VPS for over a year and I'm trying to setup a VPS on this new server. I purchased a subnet from my hosting provider that I believe allows me 6 usable IP addresses: 177.xx.xxx.201 - 177.xx.xxx.206 The subnet address looks like this: 177.xx.xxx.200/29. I've gone on my server and added them like it said on a wiki like so: ip addr add 177.**.***.201/29 dev eth0 I done that for all six and now when I go to them in the browser they point to my server. The problem is, I'm using OpenVZ web panel to create VMs (http://code.google.com/p/ovz-web-panel/) so I created a VM and assigned one of those IPs to it. However when SSHing to that IP it SSH's to the dedicated server and not the VM. Am I missing something?

    Read the article

  • How to whitelist a user agent for nginx?

    - by djb
    I'm trying to figure out how to whitelist a user agent from my nginx conf. All other agents should be shown a password prompt. In my naivity, I tried to put the following in before deny all: if ($http_user_agent ~* SpecialAgent ) { allow; } but I'm told "allow" directive is not allowed here (!). How can I make it work? A chunk of my config file: server { server_name site.com; root /var/www/site; auth_basic "Restricted"; auth_basic_user_file /usr/local/nginx/conf/htpasswd; allow 123.456.789.123; deny all; satisfy any; #other stuff... } Thanks for any help.

    Read the article

  • php5-suhosin Broken Installation

    - by h00j
    Hi i get the following error when trying to install, have you any idea how to fix? apt-get install php5-suhosin Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: php5-suhosin : Depends: phpapi-20090626 E: Unable to correct problems, you have held broken packages. I get the following error in my apache2 error log [Mon May 07 21:43:15 2012] [error] [client ip] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/suhosin.so' - /usr/lib/php5/20100525/suhosin.so: cannot open shared object file: No such file or directory in Unknown on line 0

    Read the article

  • Backing up server and multiple clients

    - by inquam
    I'm running a Amahi server. It's basically a Fedora14 x64 installation. I'm looking for a good solution to backup my 200GB system drive on the server to an external USB/eSATA drive every night. I looked into using dd but since other things might be running on the server at the same time it didn't feel quite safe. I would like the backups to be incremental so the following backups after the initial one would be quite fast. The backup should also be bootable or prehaps be able to produce a bootable disk after booting from a CD or something. I would also like the server to be able to do similar backups of my clients running Ubuntu, Windows 7 x64, Windows 7 Starter, OSX Lion, Windows XP and so on. So no applications backing up only shared folders or something like that. My guess is a client daemon would have to exist that would lock the system to allow backup of a Windows system drive that can otherwise be quite cranky. Booting up a CD in a crashed client and connecting to the server restoring the latest backup and being up running is my ideal goal. Is there anything out there that would fit these needs?

    Read the article

  • NGINX: dynamic locations stored in DB

    - by chimpanzee
    Is there a possibility to store nginx locations in DB instead of the config to serve them dynamically? The task is to create dynamic URLs for video files based on user's IP and video ID. The idea is when the user visits my website such an dynamic URL is created and added to the db as a new nginx location that exists just for this user and not for others. Or nginx doesn't fit my task and I need to use another tool? Thanks.

    Read the article

  • How to troubleshoot memory card read?

    - by shinjin
    The built in memory card reader in my laptop mounts SD cards as read-only only. This happens both in Windows 7 and Ubuntu. Most of the time. Ever now an then it works. After a some non-deterministic combination of uninstalling/reinstalling/disabling/enabling of the driver with the mandatory reboots the card reader works for a while. Is there any sane way to troubleshoot if it's an actual hardware problem, or just a matter of drivers? I've tested it with several SD cards, that work just fine in other devices. System: Acer Aspire 8951G, Windows 7-64bit

    Read the article

  • UTF-8 locale portability (and ssh)

    - by kine
    I spend a lot of my time sshed into various machines, all of which are different (some are embedded, some run Linux, some run BSD, &c.). On my own local machines, however, i use OS X, which of course has a userland based on FreeBSD. My locale on those machines is set to en_GB.UTF-8, which is one of the available options: % echo `sw_vers` ProductName: Mac OS X ProductVersion: 10.8.2 BuildVersion: 12C60 % locale -a | grep -i 'en_gb.utf' en_GB.UTF-8 Several of the more-capable Linux systems i use appear to have an equivalent option, but i note that on Linux the name is slightly different: % lsb_release -d Description: Debian GNU/Linux 6.0.3 (squeeze) % locale -a | grep -i 'en_gb.utf' en_GB.utf8 This makes me wonder: When i ssh into a Linux machine from my Mac, and it forwards all of my LC_* variables with that 'UTF-8' suffix, does that Linux machine even understand what is being asked of it? Or is it just falling back to some other locale? In either case, what is the mechanism behind its behaviour, and is it dependent on any particular set-up (e.g., will i see the same behaviour on a BusyBox-based system as on a GNU-based one)?

    Read the article

  • ash scripting: space-containing variable refuses to be grepped

    - by Luci Sandor
    I am trying to run the script listed at http://talk.maemo.org/showthread.php?t=70866&page=2 on its intended hardware, a Nokia Linux phone running BusyBox ash. The script receives the name of WiFi network as a parameter, and tries to connect the phone to it. I suspect the script works, but my SSID, BU (802.1x), has space and parentheses in it. So when I type at the command prompt autoconnect.sh BU\ \(802.1x\) I get various errors. First, LIST=`iwconfig wlan0 | awk -F":" '/ESSID/{print $2}'` if [ $LIST = "\"$1\"" ]; then ...fails, even I am connected to the network. The error is not avoided by using single or double quotes instead of escaping characters at the command prompt. Second, if [ -z `iwlist wlan0 scan | grep -m 1 -o \"$1\"` ]; then echo SSID \"$1\" not found; shows that grep does not find the string, although the same grep, typed directly into the command prompt, does find 'BU (802.1x)'. How do I quote $1 in the two circumstances above so that it will work with my network SSID, containing spaces and parentheses? Thank you.

    Read the article

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