path

JFileChooser(showSaveDialog) cant get the value of the extension file chosen

依然范特西╮ 提交于 2020-01-17 15:40:09
问题 Im making a desktop application and it has a JFileChooser(ShowSaveDialog) function.. When I tried to save a sample text file the program didnt get the extension file that I chose.. I'm trying to use the if else or switch statement and I cant figure it out what command will I use to get the string/Int value for the condition if pdf,word or txt extension is chosen as file extension... public class Save { static boolean flag = false; public static void main(String[] args) throws IOException,

Python - input of file path

坚强是说给别人听的谎言 提交于 2020-01-17 12:49:48
问题 this code works fine when I put the path of the file myself. but when I want to get it from users raw_input() it doesn't work. what can I do? import string import random print "enter number between 6 and 20" n = raw_input() print "enter pathway of file" p = raw_input() print "creating a new text file" new_file = open(p, "w") #the error on this line m = int(n) print random.choice(string.ascii_lowercase) for i in range(0,m): for j in range(0,m): new_file.write(random.choice(string.ascii

How to move along a path but only between two specified path points

房东的猫 提交于 2020-01-17 06:45:35
问题 This question is about d3 version 3.x and path movements. Imagine there is a path and a circle element, and I want the circle to follow that path in a transition, but only up to some percentage. I was asking this before and got a great answer from Gerardo Furtado here: My former question Still, one question in this regards remains for me, and as I am a beginner, I couldn't find any working solution so far: How can i trace this path, lets say, from a point at 25% to a point at 50%, and then

Getting working directory and file name in react & webpack

删除回忆录丶 提交于 2020-01-17 05:21:04
问题 I am working with a react js project. i am using webpack and redux with that. Here is the folder structure of my project. -assets -src -component -index.jsx -container -index.jsx For now i want to use dynamic className for the index.jsx files according to their working directory name. Example: for index.jsx in the folder component, the className will be src-component for index.jsx in the folder container, the className will be src-component I have tried to use npm module path for that. But

Finding all possible paths starting between a specific start and end

主宰稳场 提交于 2020-01-17 03:40:52
问题 I want to find all possible paths starting from a specific node and ending at specific node. I tried depth first search in java but it did not work on my case. Because my paths will be on the same direction. I do not want to traverse all other nodes around selected ones. I couldn't upload the image that shows what I want. Anyway, I'll try to explain. Among nodes 0 1 2 3 4 5 6 7 8 9 The paths I want to find are, for example, will start from 2 to 9. The possible paths produced by the algorithm

Custom View not drawing properly

心已入冬 提交于 2020-01-17 02:51:06
问题 I am making an Android game which has a board with some squares (similar to a chess board). Each square has some colors and I made a custom View class in which I overrided the onDraw() method in order to draw the square in the way I want to. Each square is composed of four triangles, as you can see in the next picture, in which a board with 3x3 squares is shown: https://dl.dropboxusercontent.com/u/48529299/Impossible%20Puzzle/ic_launcher.png Each triangle can be of one of three colors: purple

Python regular expression for Windows file path

霸气de小男生 提交于 2020-01-17 01:25:12
问题 The problem, and it may not be easily solved with a regex, is that I want to be able to extract a Windows file path from an arbitrary string. The closest that I have been able to come (I've tried a bunch of others) is using the following regex: [a-zA-Z]:\\([a-zA-Z0-9() ]*\\)*\w*.*\w* Which picks up the start of the file and is designed to look at patterns (after the initial drive letter) of strings followed by a backslash and ending with a file name, optional dot, and optional extension. The

os.listdir etc fails on shared windows path (Python 2.5)

时光毁灭记忆、已成空白 提交于 2020-01-17 01:14:55
问题 I am seeing some weird behavior while parsing shared paths (shared paths on server, e.g. \storage\Builds) I am reading text file which contains directory paths which I want to process further. In order to do so I do as below: def toWin(path): return path.replace("\\", "\\\\") for line in open(fileName): l = toWin(line).strip() if os.path.isdir(l): print l # os.listdir(l) etc.. This works for local directories but fails for paths specified on shared system. e.g. E:\Test -- works \

android access folder using environment.getexternalstoragedirectory on device with only internal memory would return?

落爺英雄遲暮 提交于 2020-01-16 13:20:35
问题 im using this code to access a folder: String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ "/somefolder"; on devices with sdcard this is ok, i don't have a device with only internal memory to test what happens, what would happen if this is executed on a device without sdcard? will it automatically set to the internal memory path? the user of the app would put this folder in the root of the available memory. is there a way to get internal path? is there a way to check

Accessing nested JavaScript objects with string key

隐身守侯 提交于 2020-01-16 08:39:13
问题 I have a data structure like this : var someObject = { 'part1' : { 'name': 'Part 1', 'size': '20', 'qty' : '50' }, 'part2' : { 'name': 'Part 2', 'size': '15', 'qty' : '60' }, 'part3' : [ { 'name': 'Part 3A', 'size': '10', 'qty' : '20' }, { 'name': 'Part 3B', 'size': '5', 'qty' : '20' }, { 'name': 'Part 3C', 'size': '7.5', 'qty' : '20' } ] }; And I would like to access the data using these variable : var part1name = "part1.name"; var part2quantity = "part2.qty"; var part3name1 = "part3[0].name