Daily Archives

Articles indexed Sunday January 9 2011

Page 12/29 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Dynamic Programming resources in C?

    - by EsotericMe
    Hi everyone, I'll be writing the online Google test tomorrow as a fresher. Apparently, they definitely ask one problem on Dynamic Programming? Does anyone know of a good resource for collection of DP problems in C along with solutions? I know what DP is & have used it on an occasion or twice. However I feel to crack a DP problem in test, prior practice of typical problems will make it easier to approach. Any good resources or problem sets with solutions in C will be highly appreciated. Thanks.

    Read the article

  • onchange event is not woking

    - by Jim
    Hello guys, Whats wrong with this code? My first function working fine but second function is not working. Please help me. Thanks function bag1() { var sum = 0; var qty = document.form1.qty.value; var pack = document.form1.pack.value; document.form1.bag.value = (qty*pack)/100; } function bag2() { var sum = 0; var qty = document.form1.qty.value; var pack1 = document.form1.pack1.value; document.form1.bag1.value = (qty*pack1)/100; } Here is HTML code <input id="item1" name="item1" type="text" maxlength="255" value=""/> <input type="text" maxlength="255" value=""/> <input id="weight" name="weight" type="text" maxlength="255" value=""/> <input id="pack" name="pack" type="text" maxlength="255" onchange="bag1();" value=""/> <input id="bag" name="bag" type="text" maxlength="255" value=""/> <input id="rate" name="rate" type="text" maxlength="255" value=""/> <input id="amount" name="amount" type="text" maxlength="255" value=""/> <input id="element_12" name="type" type="text" maxlength="255" value=""/> <input id="element_13" name="brand" type="text" maxlength="255" value=""/> <!-------------------------- Caculating 2th Row ---------------------------------------------------------------> <input type="text" maxlength="255" value=""/> <input type="text" maxlength="255" value=""/> <input id="weight2" name="weight2" type="text" maxlength="255" value=""/> <input id="pack2" name="pack2" type="text" maxlength="255" value=""/> <input id="bag2" name="bag2" type="text" maxlength="255" onchange="bag2();" value=""/> <input id="rate2" name="rate2" type="text" maxlength="255" value=""/> <input id="amount2" name="amount2" type="text" maxlength="255" value=""/> <input id="element_12" name="type" type="text" maxlength="255" value=""/> <input id="element_13" name="brand" type="text" maxlength="255" value=""/> </form type="submit" value="calculator2">

    Read the article

  • WPF,XAML: How to set the ZIndex of a particular control to the topmost.

    - by Sudhakar Singh
    how do i set any control to the topmost of the screen. For e.g. i have a textblock in a datatemplate or a hierarchichal data template..etc... now i would like to set this textblock to the topmost on mouseover. Setting the Grid.ZIndex value to 1 in the trigger for IsMouseOver doesn't work many times. In order to do that i set the ZIndex value for all the contols to -1 in the window. it worked in one scenario but doesn't work other times. If anyone can get me the details of ZIndex and how to set the control to the topmost without worrying about the other controls, it would be of great help. Note: setting the value of ZIndex to a higher value e.g. 99999 also doesn't work.

    Read the article

  • C++ Linux getpeername IP family

    - by gln
    hi In my Linux C++ application I'm using getpeername in order to get the peer IP. my problem is: when I enable the IPv6 on my machine the IP I got from the peer is with family IF_INET6 although it is IPv4. code: int GetSockPeerIP( int sock) { struct sockaddr_storage ss; struct socklen_t salen = sizeof(ss); struct sockaddr *sa; memset(&ss,0,salen); sa = (sockaddr *)&ss; if(getpeername(sock,sa,&salen) != 0) { return -1; } char * ip=NULL: if(sa->sa_family == AF_INET) { ip = inet_ntoa((struct sockaddr_in *)sa)->sin_addr); } else { //ip = how to convert IPv6 to char IP? } return 0; } how can I fix it? thanks1

    Read the article

  • What is the best design to this class?

    - by HPT
    assume this class: public class Logger { static TextWriter fs = null; public Logger(string path) { fs = File.CreateText(path); } public static void Log(Exception ex) { ///do logging } public static void Log(string text) { ///do logging } } and I have to use this like: Logger log = new Logger(path); and then use Logger.Log() to log what I want. the question is: is this a good design? to instantiate a class and then always call it's static method? any suggestion yield in better design is appreciated.

    Read the article

  • How to enumerate word document using office interop API?

    - by Shekhar
    Hello everyone, I want to traverse through all the elements of an word document one by one and according to type of element (header, sentence, table,image,textbox, shape, etc.) I want to process that element. I tried to search any enumerator or object which can represent elements of document in office interop API but failed to find any. API offers sentences, paragraphs, shapes collections but doesnt provide generic object which can point to next element. For example : <header of document> <plain text sentences> <table with many rows,columns> <text box> <image> <footer> (Please imagine it as a word document) So, now I want some enumerator which will first give me <header of document>, then on next iteration give me <plain text sentences>, then <table with many rows,columns> and so on. Does anyone knows how we can achieve this? Is it possible? I am using C#, visual studio 2005 and Word 2003. Thanks a lot

    Read the article

  • Change IE user agent

    - by Ahmed
    I'm using WatiN to automate Internet Explorer, and so far it's been great. However, I would really like to be able to change the user agent of IE so the server thinks it's actually Firefox or some other browser. A Firefox useragent string look something like: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 With the following code RegistryKey ieKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent"); ieKey.SetValue("", "Mozilla/5.0"); ieKey.SetValue("Compatible", "Windows"); ieKey.SetValue("Version", "U"); ieKey.SetValue("Platform", "Windows NT 5.1; en-US"); ieKey.DeleteSubKeyTree("Post Platform"); I have been able to change the IE useragent string from Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; AskTbMP3R7/5.9.1.14019) to Mozilla/4.0 (Windows; U; Windows NT 6.1; Trident/4.0; en-US; rv:1.9.2.13) Now, the question: how do I delete the Trident/4.0 part and add the "Gecko/20101203 Firefox/3.6.13" part after the parentheses? I would really like to do this programatically in C#, without using any IE add-ons. Thanks in advance.

    Read the article

  • restrict documents for mapreduce with mongoid

    - by theBernd
    I implemented the pearson product correlation via map / reduce / finalize. The missing part is to restrict the documents (representing users) to be processed via a filter query. For a simple query like mapreduce(mapper, reducer, :finalize => finalizer, :query => { :name => 'Bernd' }) I get this to work. But my filter criteria is a little bit more complicated: I have one set of preferences which need to have at least one common element and another set of preferences which may not have a common element. In a later step I also want to restrict this to documents (users) within a certain geographical distance. Currently I have this code working in my map function, but I would prefer to separate this into either query params as supported by mongoid or a javascript function. All my attempts to solve this failed since the code is either ignored or raises an error. I did a couple of tests. A regular find like User.where(:name.in => ['Arno', 'Bernd', 'Claudia']) works and returns #<Mongoid::Criteria:0x00000101f0ea40 @selector={:name=>{"$in"=>["Arno", "Bernd", "Claudia"]}}, @options={}, @klass=User, @documents=[]> Trying the same with mapreduce User.collection. mapreduce(mapper, reducer, :finalize => finalizer, :query => { :name.in => ['Arno', 'Bernd', 'Claudia'] }) fails with `serialize': keys must be strings or symbols (TypeError) in bson-1.1.5 The intermediate query parameter looks like this :query=>{#<Mongoid::Criterion::Complex:0x00000101a209e8 @key=:name, @operator="in">=>["Arno", "Bernd", "Claudia"]} and at least @operator looks a bit weird to me. I'm also uncertain if the class name can be omitted. BTW - I'm using mongodb 1.6.5-x86_64, and the mongoid 2.0.0.beta.20, mongo 1.1.5 and bson 1.1.5 gems on MacOS. What am I doing wrong? Thanks in advance.

    Read the article

  • WPF: Template Binding in Control template

    - by Sam
    I have the following control template. I wish to set the source property for the image control in the control template using Template Binding. But since this is a control template for button control and the button control doesn't have source property, i can't use TemplateBinding in this case. <ControlTemplate x:Key="BtnTemplate" TargetType="Button"> <Border CornerRadius="5" Margin="15" Cursor="Hand"> <StackPanel> <Image Name="Img" Style="{StaticResource ImageStyle}" Source="temp.jpg" Height="100" Width="100" Margin="5"></Image> <Label Content="{TemplateBinding Content}" Background="Transparent" Margin="2"></Label> </StackPanel> </Border> </ControlTemplate> Since i have to set different images for different instances of button, i can't hardcode the path as well. Please let me know how to tackle this situation.

    Read the article

  • How to develop Online Shopping Portal Application using PHP ?

    - by Sarang
    I do not know PHP & I have to develop a Shopping Portal with following Definition : Scenario: Online Shopping Portal XYZ.com wants to create an online shopping portal for managing its registered customers and their shopping. The customers need to register themselves first before they do shopping using the shopping portal. However, everyone, whether registered or not, can view the various products along with the prices listed in the portal. The registered customers, after logging in, are allowed to place order for one or more products from the products listed in the portal. Once the order is placed, the customer gets a reference order number and the order status should be “order in process”. The customers can track their order using the given reference number. The management of XYZ.com should be able to modify the order status of a particular reference order number to “shipped” once the products are shipped to the shipping address entered by the customer at the time of placing the order. The Functionalities required are : Create the interface for the XYZ.com shopping portal using HTML/XHTML and CSS. Implement the client side validations using JavaScript. Create the tables using MySQL. Implement the functionality using the server side scripting language, PHP. Integrate all the above tasks and make the XYZ.com shopping portal functional. How do I develop this application with following proper steps of development ?

    Read the article

  • Building XCode From Command Line Issues (Updating Entitlements file location)

    - by michaellindahl
    The first error is a warning for complier 'com.apple.compilers.gcc.4_0' I don't know if this is okay and I can just not worry about it. The second tells me that my entitlements file is no longer at that location. I know this and I thought I had correctly updated it in Xcode's info window. This project builds fine in Xcode. Michael-Lindahls-Mac:~ michaellindahl$ xcodebuild -project /Users/michaellindahl/Dropbox/Xcode/App/app.xcodeproj -alltargets 2011-01-03 11:41:51.591 xcodebuild[15162:60f] warning: compiler 'com.apple.compilers.gcc.4_0' is based on missing compiler 'com.apple.compilers.gcc.4_0' === BUILD NATIVE TARGET app OF PROJECT app WITH THE DEFAULT CONFIGURATION (Release) === Check dependencies [BEROR]CodeSign error: The entitlements file '/Users/michaellindahl/Dropbox/Xcode/deletedAppFile/Entitlements.plist' is missing ** BUILD FAILED **

    Read the article

  • push new value to mongodb inner array - mongodb/php

    - by Rizky Ramadhan
    hi i have this document in mongo: { "_id": ObjectId("4d0b9c7a8b012fe287547157"), "done_by": ["1"] } and i want to add another value to "done_by" field, so my expected document will be:: { "_id": ObjectId("4d0b9c7a8b012fe287547157"), "done_by": ["1","2","3"] } i try this: $conn = new Mongo(); $q = $conn->server->gameQueue; $id = new MongoId("4d0b9c7a8b012fe287547157"); $q->update(array("_id"=>$id),array('$push' => array("done_by","2"))); but nothing happens, anyone know how to do this?

    Read the article

  • Python 3, urllib ... Reset Connection Possible?

    - by Rhys
    In the larger scale of my program the goal of the below code is to filter out all dynamic html in a web-page source code code snippet: try: deepreq3 = urllib.request.Request(deepurl3) deepreq3.add_header("User-Agent","etc......") deepdata3 = urllib.request.urlopen(deepurl3).read().decode("utf8", 'ignore') The following code is looped 3 times in order to identify whether the target web-page is Dynamic (source code is changed at intervals) or not. If the page IS dynamic, the above code loops another 15 times and attempts to filter out the dynamic content. QUESTION: While this filtering method works 80% of the time, some pages will reload ALL 15 times and STILL contain dynamic code. HOWEVER. If I manually close down the Python Shell and re-execute my program, the dynamic html that my 'refresh-page method' could not shake off is no longer there ... it's been replaced with new dynamic html that my 'refresh-page method' cannot shake off. So I need to know, what is going on here? How is re-running my program causing the dynamic content of a page to change. AND, is there any way, any 'reset connection' command I can use to recreate this ... without manually restarting my app. Thanks for your response.

    Read the article

  • jQuery - Using .one() with hover

    - by Jared
    Is there any way to get a hover function to only execute once? This is what I'm currently trying: $('#ask').live('hover', function() { $('#homesearch-after').hide(300); $.doTimeout( 300, function() { hideClosedSearchLink(); showHomeSearch(); }); }); But that's not working. How can I only get this hover to activate once? I've tried changing .live with .one and .bind... resulting in nothingness.

    Read the article

  • Best approch to dynamically filter .net objects

    - by maxba
    The project i´m working currently on has a way to define a filter to filter objects from a database. This filter is a pretty straitforward class containing filtercriteria that will be combined to a sql where-clause. The goal now is to use this filter class to filter .net objects as well. So the filter for example defines, that the title property of the object that it is applied to must contain some userdefined string etc. What are ways to approch this problem? What should the filter return instead of the sql where-clause and how can it be applied to the object? I´m thinking about this for hours and don´t yet have even a slight idea how to solve this. Been thinking about reflection, dynamic code execution, building expressions but still haven´t found an acutal starting point.

    Read the article

  • What can cause a kernel hang on redhat 4?

    - by Ivan Buttinoni
    I've to solve a nasty problem on a ten machine "cluster": randomly one of these machine hang during an hard computation, sometime still ping sometime not. The problem was described me at the phone, I've still no touch/see these machine, so I can't be more precise. It seem there's no (real) keyboard or monitor linked to them, so I haven't nothing about keyboard led or messages on monitor. Don't worry, what I really need is some suggestion where to search the problem, some suggestions on what can cause a kernel hang on a working machine. I also see this post, but seem same need on a different situation. My ideas since now: - HW problem (ram, cpu, fan etc.) - bad autofs configuration - bad nfs(?) configuration - presence of a trojan/hacker/etc - /dev/"swap" linked to /dev/zero - kernel out of memory(??) - kernel bugged In other words I try to imagine what kind of envent can occour that can crash the kernel insted of the application that generate the event. What hang have YOU experienced before? Write it to me! TIA

    Read the article

  • Original sender is not correctly identified when spam is forwarded

    - by Stephan Burlot
    I have a forwarding rule with Postfix that forwards all messages to my main email address. When a spam message is sent to one of my emails, it is forwarded but the sender is shown as being the forwarding domain, not the spammer's domain. Real example: mywebsite.com is hosted on Linode. [email protected] sends an email to [email protected] the mail is forwarded to [email protected] my email hosting (anotherwebsite.com) sees it's spam and sends a message to [email protected] and Linode reports a TOS violation. I have modified my postfix settings so I now use RBL, but if a message goes through, it may happen again. How can I prevent this to happen again? Is there some settings to change on Postfix so the original sender is correctly identified? Thanks Stephan

    Read the article

  • Is visiting HTTPS websites on a public hotspot secure?

    - by Calmarius
    It's often said that HTTPS SSL/TLS connections are encrypted and said to be secure because the communication between the server and me is encrypted (also provides server authentication) so if someone sniffs my packets, they will need zillions of years to decrypt if using brute force in theory. Let's assume I'm on a public wifi and there is a malicious user on the same wifi who sniffs every packet. Now let's assume I'm trying to access my gmail account using this wifi. My browser does a SSL/TLS handshake with the server and gets the keys to use for encryption and decryption. If that malicious user sniffed all my incoming and outgoing packets. Can he calculate the same keys and read my encrypted traffic too or even send encrypted messages to the server in my name?

    Read the article

  • Personal email server

    - by celil
    I would like to set up a personal email server. I am currently using Gmail, but I am becoming increasingly concerned at the amount of data that I share with Google. I would like to migrate all of my email to my personal server. Is there an easy to use, secure, open source alternative to Gmail that can be ran on personal servers? I do not need a web interface to my email as I usually access it via IMAP.

    Read the article

  • Laptop Toshiba Satelite M300 screen is completely blank.

    - by Nadia
    Hi, My laptop Toshiba satelite M300 Laptop screen is completely blacked out. It powers up and appears to be running but the screen is blank. I've taken battery pack off and back on again. Before the screen was blacked out, it used to flicker a bit. Also before it blacked out i was having problems with the internet and I was on phone to Internet provider who took me through steps to take my laptop back to a future date where it was operational. It then worked properly for a few days but then switched it on and screen was blank. It's more then a year old so out of warranty. Any suggestions on whether I should pay the $300 bucks to see if they can fix it?

    Read the article

  • HP Cue-Scanning Flow component freezes

    - by Nathan Fellman
    I am trying to scan with an HP network scanner (actually E6500 all-in-one). Whenever I try to scan, it starts up a flash screen with HP Scanning written all over it, which proceeds to do nothing. Digging in, I found that the process that gets stuck is hpqkygrp.exe, aka "HP CUE-Scanning Flow Component". This happened when I tried scanning from onenote or from the HP Solution Center. However, it seems that scanning from Windows' Fax and Scan utility works fine. As a (probably related) side-note, scanning directly from the scanner (using the buttons on its panel) doesn't work either. How can I keep this process from getting stuck?

    Read the article

  • Depending on another open source library: copy/paste code or include

    - by user5794
    I'm working on a large class and started implementing new features that need graphics. I started writing the graphics functions myself, but I know that open source libraries exist that can provide me with this functionality without me having to write it myself. The problem is that I prefer the class to be self-sufficient and not dependent on any other library. If I don't write it myself, I would have to ask the user to make sure a graphics library is already installed (less user-friendly). If I write it myself, I do a lot more work than I have to. I could also copy/paste some of the relevant code into my own class, but not sure about the disadvantages of doing this (it's an open source library that matches my license, so I'm not concerned with legality, just programming-wise if there are disadvantages). So what should I do: copy paste code from the external library write the code myself so it's truly self-sufficient ask the user to download and install another library

    Read the article

  • Script / App to unRAR files, and only delete the archives which were sucessfully expanded.

    - by Jeremy
    I have a cron job which runs a script to unrar all files in a certain directory (/rared for argument's sake) and place the expanded files in /unrared. I would like to change this script so that it deletes the original rar archives from /rared only if they successfully extracted. This does not mean that unrar has reported that they have been fully extracted, because I have had data corruption during decompression before. Ideally (pie-in-the-sky, just to give you an idea of what I'm shooting for,) the unrar program would include this functionality, comparing an expected md5sum value with the actual md5sum value and only deleting the archive if they match. I don't mind scripting this entire process if I have to, but there must be a better way than unraring twice and comparing md5sums.

    Read the article

  • Network connection delay after installing indicator-network

    - by Adrian
    Ok, so here's the thing,I installed wingpanel in UBUNTU 10.10, i removed the gnome-panels (yes, both). In the wingpanel itself there's no NETWORK indicator, so i google it and in some forums, some guy wrote that you have to install "indicator-network". I did it, and it solved the network indicator in the wingpanel, BUT now everytime i turn on my computer, the connection takes like 2 minutes or more to connect, when before installing this thing it did it immediately. How can i solve this? any help?

    Read the article

  • Trouble with my website and IE7

    - by Hamish Hagaheygui
    Hi there, sorry im new here but i have a serious problem; I changed the CSS style sheet for IE7 for my site http://bumblebbids.com , but now when using IE7 it has no graphics and all of the scripts code is printed ; I have tried replacing the original stylesheet but it made no difference, so please suggest ways that i can fix this? If not, would it be possible to have a 'Incompatible browser' message that only appears for IE7 users? Thanks

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >