Daily Archives

Articles indexed Thursday December 6 2012

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

  • Algorithm: Find smallest subset containing K 0's

    - by Vishal
    I have array of 1's and 0's only. Now I want to find contiguous subset/subarray which contains at least K 0's. Example Array is 1 1 0 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 0 0 and K(6) should be 0 0 1 0 1 1 0 0 0 or 0 0 0 0 1 0 1 1 0.... My Solution Array: 1 1 0 1 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 Index: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Sum: 1 2 2 3 4 4 5 6 6 6 6 6 7 7 8 9 9 9 9 10 11 11 11 Diff(I-S): 0 0 1 1 1 2 2 2 3 4 5 6 6 7 7 7 8 9 10 10 10 11 12 For K(6) Start with 9-15 = Store difference in diff. Next increase difference 8-15(Difference in index) 8-14(Compare Difference in index) So on keep moving to find element with least elements... I am looking for better algorithm for this solution.

    Read the article

  • NSInvalidArgumentException when updating WebView from AppDelegate

    - by H.Protagonist
    I had to do an update in my WebView from the Appdelegate.m I try it like this: [self performSelectorOnMainThread:@selector(loadWebViewWithContent:) withObject:requestObj waitUntilDone:NO]; The loadWebViewWithContent Method works great from ViewController.m, but not from the Appdelegate. I allready wrote this in my Appdelegate.h: -(void)loadWebViewWithContent:(NSURLRequest *)requestObj; Whats wrong? Please help me. I´m still a big Noob in IOS. Error: -[AppDelegate loadWebViewWithContent]: unrecognized selector sent to instance 0x1f86a5e0*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate loadWebViewWithContent]: unrecognized selector sent to instance 0x1f86a5e0'

    Read the article

  • Magento Onepage Success Conversion Tracking Design Pattern

    - by user1734954
    My intent is to track conversions through multiple channels by inserting third party javascript (for example google analytics, optimizely, pricegrabber etc.) into the footer of onepage success . I've accomplished this by adding a block to the footer reference inside of the checkout success node within local.xml and everything works appropriately. My questions are more about efficiency and extensibility. It occurred to me that it would be better to combine all of the blocks into a single block reference and then use a various methods acting on a single call to the various related models to provide the data needed for insertion into the javascript for each of the conversion tracking scripts. Some examples of the common data that conversion tracking may rely on(pseudo): Order ID , Order Total, Order.LineItem.Name(foreach) and so on Currently for each of the scripts I've made a call to the appropriate model passing the customers last order id as the load value and the calling a get() assigning the return value to a variable and then iterating through the data to match the values with the expectations of the given third party service. All of the data should be pulled once when checkout is complete each third party services may expect different data in different formats Here is an example of one of the conversion tracking template files which loads at the footer of checkout success. $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); $amount = number_format($order->getGrandTotal(),2); $customer = Mage::helper('customer')->getCustomer()->getData(); ?> <script type="text/javascript"> popup_email = '<?php echo($customer['email']);?>'; popup_order_number = '<?php echo $this->getOrderId() ?>'; </script> <!-- PriceGrabber Merchant Evaluation Code --> <script type="text/javascript" charset="UTF-8" src="https://www.pricegrabber.com/rating_merchrevpopjs.php?retid=<something>"></script> <noscript><a href="http://www.pricegrabber.com/rating_merchrev.php?retid=<something>" target=_blank> <img src="https://images.pricegrabber.com/images/mr_noprize.jpg" border="0" width="272" height="238" alt="Merchant Evaluation"></a></noscript> <!-- End PriceGrabber Code --> Having just a single piece of code like this is not that big of a deal, but we are doing similar things with a number of different third party services. Pricegrabber is one of the simpler examples. A more sophisticated tracking service expects a comma separated list of all of the product names, ids, prices, categories , order id etc. I would like to make it all more manageable so my idea to do the following: combine all of the template files into a single file Develop a helper class or library to deliver the data to the conversion template Goals Include Extensibility Minimal Model Calls Minimal Method Calls The Questions 1. Is a Mage helper the best route to take? 2. Is there any design pattern you may recommend for the "helper" class? 3. Why would this the design pattern you've chosen be best for this instance?

    Read the article

  • How to handle null response for json object

    - by user1494754
    I get a JSON response as { "edges": [], "nodes": [] } how to check if the objects has null values and handle the case?? JSONObject jobj = new JSONObject(line); JSONArray jArray = jobj.getJSONArray("edges"); if(jArray.length()!=0) { for(int i=0;i<jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); x.add((float) json_data.getInt("x")); y.add((float) json_data.getInt("y")); end This retrurns me : org.json.JSONException: end of input at character 0 of

    Read the article

  • Giving writing permissions for IIS user at Windows 2003 Server

    - by Steve
    I am running a website over Windows 2003 Server and IIS6 and I am having problems to write or delete files in some temporary folder obtaining this kind of warmings: Warning: unlink(C:\Inetpub\wwwroot\cakephp\app\tmp\cache\persistent\myapp_cake_core_cake_): Permission denied in C:\Inetpub\wwwroot\cakephp\lib\Cake\Cache\Engine\FileEngine.php on line 254 I went to the tmp directory and at the properties I gave the IIS User the following permissions: Read & Execute List folder Contents Read And it still showing the same warnings. When I am on the properties window, if I click on Advanced the IIS username appears twice. One with Allow type and read & execute permissions and the other with Deny type and Special permissions. My question is: Should I give this user not only the Read & Execute permissions but also this ones?: Create Attributes Create Files/ Write Data Create Folders/ Append Data Delete Subfolders and Files Delete They are available to select if I Click on the edit button over the username. Wouldn't I be opening a security hole if I do this? Otherwise, how can I do to read and delete the files my website uses? Thanks.

    Read the article

  • how to link static cells to Outlet/Actions - E.G tap the call cell to call the number

    - by holtii
    The code I have. By the way, I can't get Call to work and Website does not open either! - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *urlToOpen = @""; if( indexPath.section == 0 ){ // call number urlToOpen = @"tel:442074036933"; } else if( indexPath.section == 1 ){ // open website urlToOpen = @"http://www.designmuseum.org"; } else { // open address urlToOpen = @"http://maps.apple.com/maps?daddr=Design+Museum+London"; } [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlToOpen]]; NSString *destinationAddress = [NSString stringWithFormat:@"%@+%@+%@", [address street], [address city], [address country]]; NSString *sourceAddress = [LocalizedCurrentLocation currentLocationStringForCurrentLanguage]; NSString *url = [NSString stringWithFormat:@"http://maps.apple.com/maps?saddr=%@&daddr=%@", [sourceAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [destinationAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; I need to add destination address which for my App is = 28 Shad Thames, London, United Kingdom. Which format to write it in? because I cant get it to work and really need to sort this problem of my app real quick

    Read the article

  • "Upgrading" from OpenIndiana 151a to Solaris 11.1 using IPS

    - by syneticon-dj
    I wonder if it would be possible to "upgrade" from an OpenIndiana install (151a) to the current Solaris release (11.1) using the IPS. What I have done so far: added the "solaris" publisher using pkg set-publisher -g http://pkg.oracle.com/solaris/release/ solaris removed the "opensolaris.org" and "openindiana.org" publishers (just to make sure) tried to start the update process using pkg update --accept or explicitly setting the release name pkg image-update --accept --be-name Solaris_11 - both backed out stating there are "No updates available for this image".

    Read the article

  • Can't connect to computer via SBS2011 RWA

    - by sbrattla
    I've got an SBS 2011 Essentials server. Users a able to log on to Remote Web Access using their username and password. However, the trouble starts when a users attempts to log on remotely to his/her computer from the Remote Web Access website. When the user clicks on his/her computer (in the RWA website), the user is first presented with a window listing Publisher, Type, Remote Computer name and Gateway Server. Everything seems fine here, and the user clicks Connect. The user credentials are provided, and a connection is attempted. However, the logon attempt always fails with the message "The logon attempt failed". The logon attempt always generates three log events in the server log: EventId: 4672 - Special Logon EventId: 4624 - Logon EventId: 4634 - Logoff All events happens have the same timestamp. No events are logged on the client machine which the user attempts to log on to. Others have solved this by going to their IIS server and enable "Windows Authentication" for Rpc and RpcWithCert (in Default Web Site). However, this is in place on the server. I've also got RD CAPs and RD RAPs in place. As a side note; if i try to connect to any of the machines using the Remote Desktop Connection using the "Connect from anywhere" functionality - then things work flawlessly! In other words, the error only occurs when attempting to login to a computer via the Remote Web Access website. I've run out of ideas for how I can solve this (too many hours spent). Any ideas highly appreciated!

    Read the article

  • How to redirect the output of the vmrun listProcessesInGuest command on windows?

    - by mark
    I run vmrun.exe with listProcessesInGuest on the command line and get the list of processes displayed in the console window. The exact command line is: "C:\VIX\vmrun.exe" -T vc -h "https://myserver/sdk" -u "mydomain\myuser" -p 123 -gu Administrator -gp 123 listProcessesInGuest "[Storage1] QA-W-7-SP1-64-0/QA-W-7-SP1-64-0.vmx" It works fine. Now I wish to redirect the output, however, neither 2> nor 1> work! The former has no effect - the output is still displayed in the console window, so I conclude it is send to stdout. But the latter does not work too - now nothing is displayed in the console window, but the redirection file is empty! It is created all right, but it has the zero size! Can someone explain what is going on?

    Read the article

  • Windows Server 2012 File Security Warning

    - by Technicolour
    I've mapped my domain users to a remote share, and I'm trying to get rid of the security warning that appears whenever a file is run from the remote share. I've tried adding the FQDN to the intranet list with no prevail and I'm starting to go crazy. I've also turned off IE Enhanced Security Configuration for both Admins and Users. The group policies are being applied, and I can see the FQDN in the intranet list in internet options. Relevant group policy: Relevant security warning:

    Read the article

  • Postfix sendmail -bs shows no output - permissions?

    - by Tatu Ulmanen
    When I run the sendmail -bs command as root, I get the expected output: $ sudo sendmail -bs 220 mydomain.com ESMTP Postfix ehlo localhost 250-mydomain.com 250-PIPELINING 250-SIZE 15728640 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN But when I run the same command without sudo, I get no output at all and sendmail doesn't respond to any commands: $ sendmail -bs ehlo localhost quit wtf ^C $ How can I configure Postfix so that sendmail works for every user (or at least for some specific users)? I need this because SwiftMailer for PHP uses sendmail -bs for sending mails and fails when it can't find any output.

    Read the article

  • Nightly backups (and maybe other tasks) causing server alerts

    - by J. Pablo Fernández
    I have two independent alert notification systems for my servers. The server is a virtual machine on Linode and one of the alerts comes from Linode. The other monitoring system we use is New Relic. They are both watching out for IO utilization. Every night I get alerts from both of them as the server is using too much IO. I run quite a few tasks in the middle of the night but the one I confirmed that can cause IO-warnings is running the backups. The backup is done by s3cmd sync. I tried ionice but it still generates the warnings. Getting warnings every night reduces the efficacy of warnings when they happen for real. For Linode I could raise the level at which a warning is issued, but it might mean making the whole thing useless as the level is too high. What would be the proper solution for this?

    Read the article

  • Apache - Only allow certain domains access to a Restful service

    - by user18910
    For certain Restful URIs I want to block certain domains from executing the requests. How can i do this with Apache? Is it possible For example: www.nottrusted.com calls my Restful Api Apache identifies the request is coming from a non-authorized site Apache blocks the caller and returns a 401 Is this possible? Is it easy for someone one spoof the domain? If a request comes from server side code of nottrusted.com will Apache catch the request? Thanks

    Read the article

  • Allied Telesis router: IP filtering for the LOCAL interface

    - by syneticon-dj
    Given an Allied Telesis router with an AlliedWare OS (2.9.1) I would like to disable access to all management services of the router except for a number of subnets (or alternatively have what is a "management VLAN" with other manufacturers' switch and router models). What I have tried so far: creating a new VLAN and an appropriate IP interface, setting the LOCAL IP into this subnet, creating an IP filter for the IP interface and specifying my exclusion subnets: it simply does not work as intended as I can access the LOCAL IP set from any of the other VLAN interfaces - the traffic is apparently not going through my defined filter set at all creating a new IP filter set and binding it to the LOCAL IP interface: this seems not to affect any kind of traffic at all, the counters for the filter set remain at zero packets setting the Remote Security Officer Level IP address range: this only restricts the ability for a user with the Security Officer privilege level to log in from any but the specified address ranges / subnets. Unfortunately, it does not prevent service availability (and thus DoS capacity) or the ability to log in as a less privileged user (e.g. a "manager") calling technical support: unfortunately no solution so far What I have not tried: creating a filter set for each and every IP interface defined on the router and excluding access to the router's management IP: I would like to reduce the overhead induced by IP filters as the router already is CPU-constrained at times. Setting up filters for every IP interface would mean that each and every traffic packet would have to pass the filters, thus consuming CPU cycles. If by any means possible, I would like to find a different solution.

    Read the article

  • subversion issue on mac os x

    - by user32942
    This exists in my httpd.conf file: <Location /svn> DAV svn SVNParentPath /Users/iirp/Sites/svn Allow from all #AuthType Basic #AuthName "Subversion repository" #AuthUserFile /Users/iirp/Sites/svn-auth-file #Require valid-user </Location> This is working file When I change this to: <Location /svn> DAV svn SVNParentPath /Users/iirp/Sites/svn #Allow from all AuthType Basic AuthName "Subversion repository" AuthUserFile /Users/iirp/Sites/svn-auth-file Require valid-user </Location> and when I access my repository through URL, it gives me the authentication screen but after that screen my svn repository is not showing up correctly. to see message that it gives to me is: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

    Read the article

  • Windows Bluescreen - atikmpag.sys

    - by Mochan
    Information Name: atikmpag.sys bluescreen (BSOD or BlueScreen of Death) Error code: 0x00000116 Appears when: Playing games, watching videos Can be reproduced: Yes Cause: Graphics Card is the main assumption System Specifications Before we begin - I will inform you of my specifications. OS: Windows 7 x64 Home Edition Model: Dell Inspiron 15R Special Edition (aka Inspiron 7520) (Add 2GB of RAM to the model linked) Hard Drive: 1TB CPU: Intel Quad-Core i7 Sandy Bridge (I think) Processor at 2.10GHz (I think it can be clocked to 3GHz?) RAM: 6GB (I think 1 x 4GB and 1 x 2GB) Display: 15.6" HD (1366x768) Graphics: AMD Radeon HD 7500M 2GB Details So now that you know some basics about my computer, I'll get to the problem. Being an Ubuntu user I hardly use Windows, but occasionally I do. Like to run Skyrim and other games incompatible with Linux and WINE. The new Sims 3 Seasons patch is also now not supported. When playing these two games and other ones, theoretically. I have also heard others saying that while watching HD movies and video series it also happens. While watching the bluescreen as it happens, I see it is the 'atikmpag.sys' error. I have not installed much and nothing significant. I think I have downloaded Skyrim, Firefox and The Sims 3. I haven't done much more... since Ubuntu is definitely the best in comparison! (No hate, just a joke :P). I can reproduce it easily (just by running a game for less than a minute). It is always there each time, but it's never at a specific time or anything. So far I have found that it may be caused by lack of power to the graphics card, or it may be damaged or fried. Since I've had the computer for a mere 4 months (and have had other problems with it also). I have contacted Dell but they are useless beyond belief. Anyone with any information, solutions or details are encouraged to share your knowledge, as it would be immensely appreciated.

    Read the article

  • How to transer/execute a script on remote unix server from Linux machine

    - by Jagadeesh
    I am trying to deploy an executable and execute it on remote Unix machine(Linux/Solaris) from Linux without entering the password manually. I tried scp and also SSH key-gen utility to interact with remote server but in either way i couldn't avoid providing the password manually. Since I need to run this command/utility from Java code, I should completely avoid prompting for the password at run time. I have gone through many topics in google but nothing has been materialized. Your help would really be appreciated if i could proceed further on this issue. Thanks in advance. -Jagadeesh

    Read the article

  • Putting and configuring grub on an external drive

    - by HisDudeness
    I want to put a bunch of minor emergency operating systems (such as GParted Live, DSL, Puppy Linux and so on) on a partitioned USB pen drive, with a dedicated grub boot loader on it, which I want to start when I select the drive in the BIOS to boot. The problem is: when writing grub boot options I must tell where kernel and initial ram files are located, but the USB drive can have different letters depending on when I did plug it in, if some others external drive were mounted. So, how can I write appropriate options which automatically refer to the drive grub is installed on without having to specify absolute paths, which might change (I mean, like (hd1,msdos1) ot /dev/sdb1)? And, while we are at it, can I have grub working on a device without an operating system on it to which it can refer? I mean, I want to address the command sudo grub-install /dev/sdb from the LMDE system I'm on right now, but I won't have LMDE on my pen drive. Is that a problem? And installing grub on another device, will I keep the grub I have right now on my HDD?

    Read the article

  • Project not publishing start/finish date for custom TFS work items

    - by pete the pagan-gerbil
    I've got a TFS 2012 project set up with custom work items, that include Start and Finish date read-only fields (Microsoft.VSTS.Scheduling.StartDate and FinishDate). When I publish one of those custom work items from within Office Project, it does not populate those fields the same way as when I publish a Task work item (builtin TFS work item). I've looked at the transitions in the work items, and also the TFS project field mapping XML file but can't find anything that explains the difference in behaviour. What am I missing?

    Read the article

  • What is the minimum delay between two consecutive RS232 frames?

    - by Lord Loh.
    I have been working on creating a UART on an FPGA. I can successfully transmit and receive single characters typed on PuTTY. However, when I set my FPGA to constantly write a large sequences of "A", sometimes I end up with a sequences of "@" or some other characters until I reset the FPGA a few times. I believe the UART on the computer looses track of the difference between the start bit and a zero. The delay between the two "A" is ~ 30us (measured with a logic analyzer) and the baud rate is 115200 8N1. Is there a minimum delay that must be maintained between two consecutive RS232 frames?

    Read the article

  • how to do Putty SSH Auto-Login and Run Command File

    - by supportpb
    I am using the follwing to auto login and then run file containng a command. C:\path\to\putty.exe -load "[Sessionname]" -l [user] -pw [password] -m C:\path\to\commands.txt Commands.txt contains the following command ps -elf|grep 'sometext' but when I try to do so a new window for putty comes and exits instantly after login. I cannot see the output of command in commands.txt What is the problem;. Is there error in my approach or I need some more command to make the putty window pause for sometime before exiting.

    Read the article

  • cp -u is illegal on mac. What are the alternatives?

    - by Barnabas Szabolcs
    I have a MacbookPro Lion, and I have tried to archive my files that is tried to copy and overwrite if the source is newer than the destination. I tried the following command cp -u source destination but it says, -u is illegal. I also did not find --update or -u in the man cp. Can you please help, what can I do in this situation? [I have the question moved over here from SO, so feel free to answer it once more. I hope this is the right way of dealing with this]

    Read the article

  • Internet keeps connecting and disconnecting

    - by OmerPT
    I have a PC running 32bit Windows 7 Professional. My wireless internet card is Edimax EW-7128G, it is inside my computer case and it is connected to an antenna. My problem is: I have a wireless connection to my router, the signal is fine and it's not slow or anything, but it just keeps disconnecting every 30 seconds or so, then connects back, then it disconnects, then connects back and so on. This is new - it only started about a week ago, everything worked just fine until then. I know it's not a problem with the router because: Other computers can connect to it easily and they work just fine, no disconnections (My phone too). I know it's not a problem with the computer or the wireless card itself because: I have Ubuntu installed side-by-side with my Windows, and when I switch to Ubuntu the internet works great. This caused me to think it's probably a problem with the wireless card drivers installed on windows (Ubuntu auto-installed them, I installed them manually on windows): I tried uninstalling them, and then installing them back again, sadly that didn't help. I'm kind of lost here - can anyone think of anything else I should try? Thanks :)

    Read the article

  • Not getting my normal internet speed but my other computers can?

    - by Dennis
    I have Comcast Xfinity and I cannot reach anywhere near my promised speed. My family desktop which is hardwired into the router reaches to 60Mbps and so do my parents computers and my brothers. I cannot seem to get anywhere close to it, I know with being wireless I won't reach it, but I should at least get somewhere close. I can only pull 6Mbps and thats terrible for what I should be receiving. Any clue what could be wrong here? Edit: I have 100% signal and I'm not behind any walls

    Read the article

  • Windows 7 extremely long startup

    - by Tyler
    Windows 7 before it even gets to login. On the "starting windows" splash screen takes no less than 15 minutes to finish more like 25 minutes most times. During this time the hard drive activity led indicator is blinking maybe once every 20 seconds. When I finally get to the desktop everything runs normally. I have unplugged all peripherals with same result. Ideas? It's 32bit. 4gig memory. Fast CPU which I can't recall off the top of my head.

    Read the article

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