Daily Archives

Articles indexed Monday April 19 2010

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

  • Making(programming) virtual drives on windows XP

    - by Manux
    Ahoy, I'd like to mount a "virtual drive" myself on Windows XP, I guess using the windows API. What I thought about would be like a server interface, meaning explorer.exe would send "queries", like, list directory, or get file through a pipe or whatever... I know some programs do it, maybe not the way I think it is done, but what the heck, if you know anything, enlighten me please!

    Read the article

  • Does this introduce security vulnerabilities?

    - by mcmt
    I don't think I'm missing anything. Then again I'm kind of a newbie. def GET(self, filename): name = urllib.unquote(filename) full = path.abspath(path.join(STATIC_PATH, filename)) #Make sure request is not tricksy and tries to get out of #the directory, e.g. filename = "../.ssh/id_rsa". GET OUTTA HERE assert full[:len(STATIC_PATH)] == STATIC_PATH, "bad path" return open(full).read()

    Read the article

  • Abstract classes in shared library

    - by JTom
    Hi, I have an ordinary abstract class that has couple of pure virtual methods. The class itself is a part of the shared library. The compilation of the shared library itself is OK. But when the library is linked to another program that has another class deriving from the abstract one in the shared library and defining the pure virtual methods, I get the following linker error: I compile like this..: g++ -I../path/to/the/library main.cpp derived.cpp -L../path/to/the/library -lsomename -o shared ...and the linker error is: libsomename.so: undefined reference to `AbstractClass::method()' It's like the abstract class cannot access its pure virtual methods but I do not try to make any instance of the abstract class anywhere in the library. What could be the problem?

    Read the article

  • How do i make an installer instead of a crash (.NET)

    - by acidzombie24
    My situation is Using .NET 3.5 Using SDL.NET Need to make a friendly installer or warning system. Chances are the user will be on XP (.NET 1.1). If possible can i do something to let the user know he needs to update to 3.5? Maybe have a yes/no dialog which downloads and install the .NET runtimes for him? Now how do i detect if the user has sdl.net installed (chances are its in program files/sdldotnet) and let them know they need sdl.net runtime and have a yes/no dialog that brings them to http://sourceforge.net/projects/cs-sdl/files/ The problem i have mostly is how to make the app not outright crash and how to download 3.5 .NET runtime if it is possible.

    Read the article

  • Issue building C++ DLL with Visual Studio 2010

    - by Jon Tackabury
    I have a very simple DLL written in unmanaged C++ that I access from my application. I recently switch to Visual Studio 2010, and the DLL went from 55k down to 35k with no code changes, and now it will no longer load in Windows 2000. I didn't change any code or compiler settings. I have my defines setup for 0x0500, which should include Windows 2000 support. Has anyone else run into this, or have any ideas of what I can do?

    Read the article

  • How can I make VS2010 behave like VS2008 w/r/t indentation?

    - by Portman
    Situation I have a plain text file where indentation is important. line 1 line 1.1 (indented two spaces) line 1.2 (indented two spaces) line 1.2.3 (indented four spaces) In Visual Studio 2008, when I pressed enter, the next line would also be indented four spaces. However, in Visual Studio 2010, when I press enter, the next line is indented one tab. Question Does anybody know where, in the mountain of preferences under Tools Options, I can return to the way that Visual Studio 2008 worked? Under Options Text Editor Plain Text Tabs, I see the following: If I select "None", then I get no indentation when I move to the next line. If I select "Block", then I get TAB indentation (even though the previous line is spaces). In Visual Studio 2008, my indentation is set to "Block", and I get spaces. I have no idea what "Smart" indenting is, or why it is disabled.

    Read the article

  • Good Database with C library?

    - by Mohit Deshpande
    What is a good database with support for C? I want a database that can persist changes when the program is closing and retrieve them when the user starts up the program. I was thinking maybe like SQLite or Berkeley DB. Some documentation would be great too.

    Read the article

  • UITableView with background UIImageView hides table controls

    - by Khanzor
    I am having a problem setting the background of UITableView to a UIImageView (see below for why I am doing this), once the view is set, it works fine, and scrolls with the UITableView, but it hides the elements of the Table View. I need to have a UIImageView as the background for a UITableView. I know this has been answered before, but the answers are to use: [UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]]; Or something like (which I need to use): UIImageView *background = [MainWindow generateBackgroundWithFrame:tableView.bounds]; [tableView addSubview:background]; [tableView sendSubviewToBack:background]; The reason I need to use the latter is because of my generateBackgroundWithFrame method, which takes a large image, and draws a border around that image to the dimensions specified, and clips the remainder of the image: + (UIImageView *) generateBackgroundWithFrame: (CGRect)frame { UIImageView *background = [[[UIImageView alloc] initWithFrame:frame] autorelease]; background.image = [UIImage imageNamed:@"globalBackground.png"]; [background.layer setMasksToBounds:YES]; [background.layer setCornerRadius:10.0]; [background.layer setBorderColor:[[UIColor grayColor] CGColor]]; [background.layer setBorderWidth:3.0]; return background; } Please note: I understand that this might poorly effect performance, but I don't have the resources to go through and make those images for each potential screen in the app. Please do not answer this question with a mindless "you shouldn't do this" response. I am aware that it is possibly the wrong thing to do. How do I show my UITableView control elements? Is there something that I am doing wrong in my delegate? Here is a simplified version: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(20, 20, 261, 45) reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; UIImage *rowBackground; NSString *imageName = @"standAloneTVButton.png"; rowBackground = [UIImage imageNamed:imageName]; UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 5, 300, 200)]; textView.backgroundColor = [UIColor clearColor]; textView.textColor = [UIColor blackColor]; textView.font = [UIFont fontWithName:@"Helvetica" size:18.0f]; Purchase *purchase = [[PurchaseModel productsPurchased] objectAtIndex:indexPath.row]; textView.text = [purchase Title]; selectedTextView.text = textView.text; UIImageView *normalBackground = [[[UIImageView alloc] init] autorelease]; normalBackground.image = rowBackground; [normalBackground insertSubview:textView atIndex:0]; cell.backgroundView = normalBackground; [textView release]; } return cell; }

    Read the article

  • How do I create a new AnyType[] array?

    - by cb
    Which is the best practice in this situation? I would like an un-initialized array of the same type and length as the original. public static <AnyType extends Comparable<? super AnyType>> void someFunction(AnyType[] someArray) { AnyType[] anotherArray = (AnyType[]) new Comparable[someArray.length]; ...or... AnyType[] anotherArray = (AnyType[]) new Object[someArray.length]; ...some other code... } Thanks, CB

    Read the article

  • Jruby Gems-in-a-jar issue

    - by antonio
    Hi all, I am trying to write some code in ruby (using jruby) to be compiled to java bytecode with jrubyc and deployed to a remote machine where it will be run on the JVM (no ruby available there). Everything works fine as long as I am happy to stick with the standard jruby library. As explained on the jruby website, I simply copy the jruby-complete.jar library to the remote machine and include it in the classpath at runtime. I fire my compiled script and it works: cool! The problems start when I need some other libraries (typically rubygems) to run my script. I am aware of cool stuff like rawr, -which I successfully tested- to put together all you need in a single package. However that is not the solution I am looking for: I will have many small scripts to run independently and I don't want each of them to grow to at least 10 MB just because I insanely include the jruby-complete.jar in each of them. What I would like is to compile a .jar for each of the libraries that I will need to use, put all of them in a common folder on the remote machine and include them at runtime in the classpath when I run my compiled jruby scripts on the JVM. This said, I tried to follow the instructions here: http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar I tried exactly the example shown there, with the "chronic" gem. Going step by step: Install the gem locally: java -jar jruby-complete-1.1.6.jar -S gem install -i ./chronic chronic --no-rdoc --no-ri Package it into a jar: jar cf chronic.jar -C chronic . Write a two lines test script, saving it as testt.rb: require 'chronic' Chronic.parse('tomorrow') Compile with: jrubyc testt.rb Run the resulting java class testt.class with the following (having both jruby-complete.jar and chronic.jar in the same folder as the java class): java -cp .:/jruby-complete.jar:./chronic.jar testt I get the following error: Exception in thread "main" file:/Users/ave2/NetBeansProjects/jrubywatir/lib/jruby-complete.jar!/METAINF/jruby.home/lib/ruby/site_ruby/shared/builtin/core_ext/symbol.rb:1:in `const_missing': uninitialized constant Chronic (NameError) from testt.rb:2 ...internal jruby stack elided... from Module.const_missing(testt.rb:2) from (unknown).(unknown)(:1) I really don't understand what I am doing wrong, and I am totally stuck on this. I am a noob in Ruby, much more used to Python: don't miss a chance to convert an infidel! :-) Thanks.

    Read the article

  • Matlab - Propagate points orthogonally on to the edge of shape boundaries

    - by Graham
    Hi I have a set of points which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. I want to cast a ray from each point from the set of points in an orthogonal direction and detect at which point it intersects the shape boundary at. What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used? Or would it be a case of taking orthogonal unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection? Thank you very much in advance for any help!

    Read the article

  • Possible to download entire whois database / list of registered domains?

    - by Parand
    I wanted to do some analysis on registered domain names. Looks like I can hit whois.internic.net to get information about each domain, but it also looks like there are rate limits that prevent me from doing large numbers of queries. Is there a way to periodically (say daily) grab the entire whois database? I really only care about whether a domain is registered or not, so I don't need the full whois information.

    Read the article

  • Non recursive way to position a genogram in 2D points for x axis. Descendant are below

    - by Nassign
    I currently was tasked to make a genogram for a family consisting of siblings, parents with aunts and uncles with grandparents and greatgrandparents for only blood relatives. My current algorithm is using recursion. but I am wondering how to do it in non recursive way to make it more efficient. it is programmed in c# using graphics to draw on a bitmap. Current algorithm for calculating x position, the y position is by getting the generation number. public void StartCalculatePosition() { // Search the start node (The only node with targetFlg set to true) Person start = null; foreach (Person p in PersonDic.Values) { if (start == null) start = p; if (p.Targetflg) { start = p; break; } } CalcPositionRecurse(start); // Normalize the position (shift all values to positive value) // Get the minimum value (must be negative) // Then offset the position of all marriage and person with that to make it start from zero float minPosition = float.MaxValue; foreach (Person p in PersonDic.Values) { if (minPosition > p.Position) { minPosition = p.Position; } } if (minPosition < 0) { foreach (Person p in PersonDic.Values) { p.Position -= minPosition; } foreach (Marriage m in MarriageList) { m.ParentsPosition -= minPosition; m.ChildrenPosition -= minPosition; } } } /// <summary> /// Calculate position of genogram using recursion /// </summary> /// <param name="psn"></param> private void CalcPositionRecurse(Person psn) { // End the recursion if (psn.BirthMarriage == null || psn.BirthMarriage.Parents.Count == 0) { psn.Position = 0.0f; if (psn.BirthMarriage != null) { psn.BirthMarriage.ParentsPosition = 0.0f; psn.BirthMarriage.ChildrenPosition = 0.0f; } CalculateSiblingPosition(psn); return; } // Left recurse if (psn.Father != null) { CalcPositionRecurse(psn.Father); } // Right recurse if (psn.Mother != null) { CalcPositionRecurse(psn.Mother); } // Merge Position if (psn.Father != null && psn.Mother != null) { AdjustConflict(psn.Father, psn.Mother); // Position person in center of parent psn.Position = (psn.Father.Position + psn.Mother.Position) / 2; psn.BirthMarriage.ParentsPosition = psn.Position; psn.BirthMarriage.ChildrenPosition = psn.Position; } else { // Single mom or single dad if (psn.Father != null) { psn.Position = psn.Father.Position; psn.BirthMarriage.ParentsPosition = psn.Position; psn.BirthMarriage.ChildrenPosition = psn.Position; } else if (psn.Mother != null) { psn.Position = psn.Mother.Position; psn.BirthMarriage.ParentsPosition = psn.Position; psn.BirthMarriage.ChildrenPosition = psn.Position; } else { // Should not happen, checking in start of function } } // Arrange the siblings base on my position (left younger, right older) CalculateSiblingPosition(psn); } private float GetRightBoundaryAncestor(Person psn) { float rPos = psn.Position; // Get the rightmost position among siblings foreach (Person sibling in psn.Siblings) { if (sibling.Position > rPos) { rPos = sibling.Position; } } if (psn.Father != null) { float rFatherPos = GetRightBoundaryAncestor(psn.Father); if (rFatherPos > rPos) { rPos = rFatherPos; } } if (psn.Mother != null) { float rMotherPos = GetRightBoundaryAncestor(psn.Mother); if (rMotherPos > rPos) { rPos = rMotherPos; } } return rPos; } private float GetLeftBoundaryAncestor(Person psn) { float rPos = psn.Position; // Get the rightmost position among siblings foreach (Person sibling in psn.Siblings) { if (sibling.Position < rPos) { rPos = sibling.Position; } } if (psn.Father != null) { float rFatherPos = GetLeftBoundaryAncestor(psn.Father); if (rFatherPos < rPos) { rPos = rFatherPos; } } if (psn.Mother != null) { float rMotherPos = GetLeftBoundaryAncestor(psn.Mother); if (rMotherPos < rPos) { rPos = rMotherPos; } } return rPos; } /// <summary> /// Check if two parent group has conflict and compensate on the conflict /// </summary> /// <param name="leftGroup"></param> /// <param name="rightGroup"></param> public void AdjustConflict(Person leftGroup, Person rightGroup) { float leftMax = GetRightBoundaryAncestor(leftGroup); leftMax += 0.5f; float rightMin = GetLeftBoundaryAncestor(rightGroup); rightMin -= 0.5f; float diff = leftMax - rightMin; if (diff > 0.0f) { float moveHalf = Math.Abs(diff) / 2; RecurseMoveAncestor(leftGroup, 0 - moveHalf); RecurseMoveAncestor(rightGroup, moveHalf); } } /// <summary> /// Recursively move a person and all his/her ancestor /// </summary> /// <param name="psn"></param> /// <param name="moveUnit"></param> public void RecurseMoveAncestor(Person psn, float moveUnit) { psn.Position += moveUnit; foreach (Person siblings in psn.Siblings) { if (siblings.Id != psn.Id) { siblings.Position += moveUnit; } } if (psn.BirthMarriage != null) { psn.BirthMarriage.ChildrenPosition += moveUnit; psn.BirthMarriage.ParentsPosition += moveUnit; } if (psn.Father != null) { RecurseMoveAncestor(psn.Father, moveUnit); } if (psn.Mother != null) { RecurseMoveAncestor(psn.Mother, moveUnit); } } /// <summary> /// Calculate the position of the siblings /// </summary> /// <param name="psn"></param> /// <param name="anchor"></param> public void CalculateSiblingPosition(Person psn) { if (psn.Siblings.Count == 0) { return; } List<Person> sibling = psn.Siblings; int argidx; for (argidx = 0; argidx < sibling.Count; argidx++) { if (sibling[argidx].Id == psn.Id) { break; } } // Compute position for each brother that is younger that person int idx; for (idx = argidx - 1; idx >= 0; idx--) { sibling[idx].Position = sibling[idx + 1].Position - 1; } for (idx = argidx + 1; idx < sibling.Count; idx++) { sibling[idx].Position = sibling[idx - 1].Position + 1; } }

    Read the article

  • Just installed Sql Server 2008 and cannot access it

    - by Mendy
    I just install Sql Server 2008 on a new server and I cannot connect to it. I'm trying to connect using Windows Authentication to the localhost but I get the following error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476

    Read the article

  • Is using os.path.abspath to validate an untrusted filename's location secure?

    - by mcmt
    I don't think I'm missing anything. Then again I'm kind of a newbie. def GET(self, filename): name = urllib.unquote(filename) full = path.abspath(path.join(STATIC_PATH, filename)) #Make sure request is not tricksy and tries to get out of #the directory, e.g. filename = "../.ssh/id_rsa". GET OUTTA HERE assert full[:len(STATIC_PATH)] == STATIC_PATH, "bad path" return open(full).read() Edit: I realize this will return the wrong HTTP error code if the file doesn't exist (at least under web.py). I will fix this.

    Read the article

  • 2d array, using calloc in C

    - by BigBirdy
    Hi, I'm trying to create a 2D array of chars to storage lines of chars. For Example: lines[0]="Hello"; lines[1]="Your Back"; lines[2]="Bye"; Since lines has to be dynamically cause i don't know how many lines i need at first. Here is the code i have: int i; char **lines= (char**) calloc(size, sizeof(char*)); for ( i = 0; i < size; i++ ){ lines[i] = (char*) calloc(200, sizeof(char)); } for ( i = 0; i < size; i++ ){ free(lines[i]); } free(lines); I know that each line can't go over 200 chars. I keep getting errors like "error C2059: syntax error : 'for'" and such. Any ideas of what i did wrong?

    Read the article

  • What does it mean that "Lisp can be written in itself?"

    - by Mason Wheeler
    Paul Graham wrote that "The unusual thing about Lisp-- in fact, the defining quality of Lisp-- is that it can be written in itself." But that doesn't seem the least bit unusual or definitive to me. ISTM that a programming language is defined by two things: Its compiler or interpreter, which defines the syntax and the semantics for the language by fiat, and its standard library, which defines to a large degree the idioms and techniques that skilled users will use when writing code in the language. With a few specific exceptions, (the non-C# members of the .NET family, for example,) most languages' standard libraries are written in that language for two very good reasons: because it will share the same set of syntactical definitions, function calling conventions, and the general "look and feel" of the language, and because the people who are likely to write a standard library for a programming language are its users, and particularly its designer(s). So there's nothing unique there; that's pretty standard. And again, there's nothing unique or unusual about a language's compiler being written in itself. C compilers are written in C. Pascal compilers are written in Pascal. Mono's C# compiler is written in C#. Heck, even some scripting languages have implementations "written in itself". So what does it mean that Lisp is unusual in being written in itself?

    Read the article

  • user input question

    - by jdbeverly87
    My program checks to test if a word or phrase is a palindrome (reads the same both backward and forward, ex "racecar"). The issue I'm having is after someone enters in "racecar" getting it to actually test. In the below code, I marked where if I type in "racecar" and run, Java returns the correct answer so I know I'm right there. But what am I missing as far as entering it into the console. I think my code is ok, but maybe I have something missing or in the wrong spot? Not really looking for a new answer unless I'm missing something, but if possible perhaps a pro at this moving my code to the correct area bc I'm stuck! `import java.util.*; public class Palindrome { public static void main(String[] args) { String myInput; Scanner in = new Scanner(System.in); System.out.println("Enter a word or phrase: "); **//this asks user for input but doesn't check for whether or not it is a palindrome** myInput = in.nextLine(); in.close(); System.out.println("You entered: " + myInput); } { String s="racecar"; **//I can type a word here and it works but I need** int i; **//I need it to work where I ask for the input** int n=s.length(); String str=""; for(i=n-1;i>=0;i--) str=str+s.charAt(i); if(str.equals(s)) System.out.println(s+ " is a palindrome"); else System.out.println(s+ " is not a palindrome"); } }` I'm new at programming so I'm hoping what I got is ok. I know the palindrome test works I'm just needing helping having it test thru where I'm entering it into the console. Thanks

    Read the article

  • How to send value to _popen?

    - by karikari
    Hi, I have a problem here. I need to send some value to 'text1 and 'text2'. For example, text1 = ...and this code below will refer to those values.. FILE *child = _popen("java -jar c:\\simmetrics.jar text1 text2 > c:\\test.txt", "r"); How can achieve it. I have done many ways, and it keep on giving me pointer errors.

    Read the article

  • I am getting the erorr when I try to debug.

    - by Michael
    I am receiving the error noted below. I have built/rebuilt the files sevaral time. I have alson renamed the file the file in the *.exe The NetworkAssociation.exe file is in the debug folder. Any help would be wonderful Visual Studio cannot start debugging because the debub target 'c:\NetworkAssociation\NetworkAssociation\Bin\Debug\NetworkAssociation.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location.

    Read the article

  • Where can I find a list of English phrases?

    - by Marcus Adams
    I'm tasked with searching for the use of cliches and common phrases in text. The phrases are similar to the phrases you might see for the phrase puzzles on Wheel of Fortune. Here are a few examples: Safety First Too Good To be True Winning Isn't Everything I cannot find a list of phrases however. Does anybody know of such a list? Seriously, even a list of all Wheel of Fortune solutions would suffice.

    Read the article

  • How to customize $(project.compileClasspathElement) like expression in Maven?

    - by zbdiablo
    When i try to run a maven plugin, i found that the default classpath defined in expression $(project.compileClasspathElement) is too long. So, i just want to customize a shorter classpath for this plugin. The default configuration is as follows: <plugin> <groupId>org.datanucleus</groupId> <artifactId>maven-datanucleus-plugin</artifactId> <version>2.0.1</version> <configuration> ...<classpathElements>${project.compileClasspathElements}</classpathElements> </configuration> and the value of classpathElements should be a String List. May i solve this problem? and how? thx!

    Read the article

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