Is there a built-in command for downloading a file using the command line on Windows? I know I can get cygwin and install wget, but I would like a solution that works on any windows PC.
On SANs with Mylex RAID controllers there is a command-line utility called mlxcfg that allows one to configure the SAN. Does such a utility exist for Clariion CX SANs and is it free to use without licensing for Navisphere?
I'm looking for a way to set a group of File Types to "Index Properties and File Contents" (Control Panel, Indexing Options, Advanced Options, File Types).
Basically I'd like to write a batch file that switches that setting for a large group of file types and be able to share it with my entire team. Clicking in the UI is time consuming for everyone.
This is a great solution for bringing up the GUI, but I'd like to create a batch file
What is the command line for Indexing Options?
hi.
im looking for a small utility that can copy files over to/from remote windows hosts, and which can take the credentials (domain user and password) as part of its command line, similar to psexec.
i know i can use net use to map the target directory to a drive letter and use xcopy, and i know psexec can upload files to be executed on the remote machine and then delete them, but im looking for a small utility to distribute files to remote hosts that will not be as awkward to use as net use + xcopy
Hi there,
I want to compress a file using command line. I m writting :
C: compact /c aa.xml
return successful message but i cant see any zip file in C folder. Where is the problem?
Thanks for your helps..
I have a program that opens with a specific shortcut, but the shortcut seems to send parameters to the application. If I go directly to the target directory and double-click, it does not work. However, if I use the command line and pass in a certain argument, the application opens correctly.
I want to open certain file types using the application, but the application must have the parameters, or it will not work. Is it possible to do this sort of thing?
I'd like to write a simple script that alerts me if a log changes. For this I'm using grep to find the lines I'm interested in. Right now it works like this:
grep line /var/log/file | mail -s Log [email protected]
Problem is that this sends a mail even if no matching lines are found. The mail utility from mailutils seems to have no switch telling it to drop mails that have an empty body.
Is there a quick and easy way to do so?
I'm new to Linux. I have a Windows network connected to a Linux computer. When I try to browse Windows files from windows managers in Linux, it asks for user name, work group name and password.
The address of computer network is something like this: smb://computer-name/folder
I want to access my network folders and files using command line. I have searched a little bit but I didn't find anything.
Any suggestions?
Thanks in advance
In command line, we have, for example, TAB, which autocomplete the commands.
In the GUI, we need just to select a text for Ubuntu to copy it. And the mouse middle button can be used to paste.
Which other "untold" secrets Ubuntu hides?
obs. I don't know which of the items I told are for any Linux or Ubuntu specific.
In command line, we have, for example, TAB, which autocomplete the commands.
In the GUI, we need just to select a text for Ubuntu to copy it. And the mouse middle button can be used to paste.
Which other "untold" secrets Ubuntu hides?
obs. I don't know which of the items I told are for any Linux or Ubuntu specific.
I have a case that I would like to trigger an automatic download for a list of 114 file (recitation) for each reader,
for example if i want to download the recitations for a reader called abkr, the urls for the files will look like the following..
http://server6.mp3quran.net/abkr/001.mp3
http://server6.mp3quran.net/abkr/002.mp3
...
http://server6.mp3quran.net/abkr/113.mp3
http://server6.mp3quran.net/abkr/114.mp3
simply these are Quran recitations, so they are always have a total of 114
is there an easy way to loop that using command line on Windows ?
I'm looking for a way to set a group of File Types to "Index Properties and File Contents" (Control Panel, Indexing Options, Advanced Options, File Types).
Basically I'd like to write a batch file that switches that setting for a large group of file types and be able to share it with my entire team. Clicking in the UI is time consuming for everyone.
This is a great solution for bringing up the GUI, but I'd like to create a batch file
What is the command line for Indexing Options?
Hi,
I'm working on some application and using ThreadPoolExecutor for handling various tasks. ThreadPoolExecutor is getting stuck after some duration. To simulate this in a simpler environment, I've written a simple code where I'm able to simulate the issue.
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class MyThreadPoolExecutor {
private int poolSize = 10;
private int maxPoolSize = 50;
private long keepAliveTime = 10;
private ThreadPoolExecutor threadPool = null;
private final ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(
100000);
public MyThreadPoolExecutor() {
threadPool = new ThreadPoolExecutor(poolSize, maxPoolSize,
keepAliveTime, TimeUnit.SECONDS, queue);
threadPool.setRejectedExecutionHandler(new RejectedExecutionHandler() {
@Override
public void rejectedExecution(Runnable runnable,
ThreadPoolExecutor threadPoolExecutor) {
System.out
.println("Execution rejected. Please try restarting the application.");
}
});
}
public void runTask(Runnable task) {
threadPool.execute(task);
}
public void shutDown() {
threadPool.shutdownNow();
}
public ThreadPoolExecutor getThreadPool() {
return threadPool;
}
public void setThreadPool(ThreadPoolExecutor threadPool) {
this.threadPool = threadPool;
}
public static void main(String[] args) {
MyThreadPoolExecutor mtpe = new MyThreadPoolExecutor();
for (int i = 0; i < 1000; i++) {
final int j = i;
mtpe.runTask(new Runnable() {
@Override
public void run() {
System.out.println(j);
}
});
}
}
}
Try executing this code a few times. It normally print outs the number on console and when all threads end, it exists. But at times, it finished all task and then is not getting terminated. The thread dump is as follows:
MyThreadPoolExecutor [Java Application]
MyThreadPoolExecutor at localhost:2619 (Suspended)
Daemon System Thread [Attach Listener] (Suspended)
Daemon System Thread [Signal Dispatcher] (Suspended)
Daemon System Thread [Finalizer] (Suspended)
Object.wait(long) line: not available [native method]
ReferenceQueue<T>.remove(long) line: not available
ReferenceQueue<T>.remove() line: not available
Finalizer$FinalizerThread.run() line: not available
Daemon System Thread [Reference Handler] (Suspended)
Object.wait(long) line: not available [native method]
Reference$Lock(Object).wait() line: 485
Reference$ReferenceHandler.run() line: not available
Thread [pool-1-thread-1] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-2] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-3] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-4] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-6] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-8] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-5] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-10] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-9] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [pool-1-thread-7] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: not available
AbstractQueuedSynchronizer$ConditionObject.await() line: not available
ArrayBlockingQueue<E>.take() line: not available
ThreadPoolExecutor.getTask() line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available
Thread [DestroyJavaVM] (Suspended)
C:\Program Files\Java\jre1.6.0_07\bin\javaw.exe (Jun 17, 2010 10:42:33 AM)
In my actual application,ThreadPoolExecutor threads go in this state and then it stops responding.
Regards,
Ravi Rao
im trying to come up with a design for a wrapper for use when invoking command line utilities in java. the trouble with runtime.exec() is that you need to keep reading from the process' out and err streams or it hangs when it fills its buffers. this has led me to the following design:
public class CommandLineInterface {
private final Thread stdOutThread;
private final Thread stdErrThread;
private final OutputStreamWriter stdin;
private final History history;
public CommandLineInterface(String command) throws IOException {
this.history = new History();
this.history.addEntry(new HistoryEntry(EntryTypeEnum.INPUT, command));
Process process = Runtime.getRuntime().exec(command);
stdin = new OutputStreamWriter(process.getOutputStream());
stdOutThread = new Thread(new Leech(process.getInputStream(), history, EntryTypeEnum.OUTPUT));
stdOutThread.setDaemon(true);
stdOutThread.start();
stdErrThread = new Thread(new Leech(process.getErrorStream(), history, EntryTypeEnum.ERROR));
stdErrThread.setDaemon(true);
stdErrThread.start();
}
public void write(String input) throws IOException {
this.history.addEntry(new HistoryEntry(EntryTypeEnum.INPUT, input));
stdin.write(input);
stdin.write("\n");
stdin.flush();
}
}
public class Leech implements Runnable{
private final InputStream stream;
private final History history;
private final EntryTypeEnum type;
private volatile boolean alive = true;
public Leech(InputStream stream, History history, EntryTypeEnum type) {
this.stream = stream;
this.history = history;
this.type = type;
}
public void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;
try {
while(alive) {
line = reader.readLine();
if (line==null) break;
history.addEntry(new HistoryEntry(type, line));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
my issue is with the Leech class (used to "leech" the process' out and err streams and feed them into history - which acts like a log file) - on the one hand reading whole lines is nice and easy (and what im currently doing), but it means i miss the last line (usually the prompt line). i only see the prompt line when executing the next command (because there's no line break until that point).
on the other hand, if i read characters myself, how can i tell when the process is "done" ? (either complete or waiting for input)
has anyone tried something like waiting 100 millis since the last output from the process and declaring it "done" ?
any better ideas on how i can implement a nice wrapper around things like runtime.exec("cmd.exe") ?
Hi SO community!
I am drawing graphs into a WinForms Picturebox. Now I am searching for a possibility to 'duplicate' a line (an array of points), so that the two resulting lines are positioned a fixed distance away from the original one. Like in this picture, I have the red line and want to get the black ones:
I thought about just moving the line a few pixels up/right/up-right, but that leads to strange overlapping lines.
Is there any other approach that does what I want? Any ideas would be greatly appreciated. Thanks!
I have file A2.txt with coordinate x1,y1,x2,y2 in every line like below :
204 13 225 59
225 59 226 84
226 84 219 111
219 111 244 192
244 192 236 209
236 209 254 223
254 223 276 258
276 258 237 337
in my php file i have that code. This code should take every line and draw line with coordinate from line. But something was wrong cause nothing was draw :/:
<?php
$plik = fopen("A2.txt", 'r') or die("blad otarcia");
while(!feof($plik))
{
$l = fgets($plik,20);
$k = explode(' ',$l);
imageline ( $mapa , $k[0] , $k[1] , $k[2] , $k[3] , $kolor );
}
imagejpeg($mapa);
imagedestroy($mapa);
fclose($plik) ;
?>
If I use imagejpeg and imagedestroy in while its only first line draw. What to do to draw every line ??
Please help :)
As an input I have a photo of a simple symbol, e.g.: https://www.dropbox.com/s/nrmsvfd0le0bkke/symbol.jpg
I would like to detect the straight lines in it, like points of start and ends of the lines. In this case, assuming the top left of the symbol is (0,0), the lines would be defined like this:
start end (coordinates of beginning and end of a line)
1. (0,0); (0,10) (vertical line)
2. (0,10); (15, 15)
3. (15,15); (0, 20)
4. (0,20); (0,30)
How can I do it (pereferably using OpenCV)? I though about Hough lines, but they seem to be good for perfect thin straight lines, which is not the case in a drawing. I'll probably work on binarized image, too.
I have several versions of Python installed on a Windows 7 computer.
I want to run Python 2.7 by default, but for whatever reason, typing python in the command line runs Python version 2.4.5. I've tried adding C:\Python27 to my system path variable as per this question, and manually combed my path variable it to make sure Python 2.4.5 wasn't tossed in there by mistake, but that didn't fix the issue. I have to type in C:\Python27\python.exe every time I want to access the correct version of python I want.
What other places can I check? How can I make the command line use the correct version of python?
I also found this but it's not for windows.
[EDIT]
My path (separated by semicolons):
C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Dell\DW WLAN Card\Driver;
C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;
C:\Program Files (x86)\Windows Live\Shared;
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\Java\jdk1.6.0_26\bin;
C:\Program Files\Java\jdk1.6.0_21 ;
C:\Program Files\IVI Foundation\VISA\Win64\Bin\;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;
C:\Program Files\WPIJavaCV\OpenCV_2.2.0\bin;
C:\Program Files (x86)\LilyPond\usr\bin;
C:\Program Files\TortoiseSVN\bin;
C:\Program Files (x86)\doxygen\bin;
C:\Program Files (x86)\Graphviz 2.28\bin;
C:\Users\Michael\bin\Misc\cppcheck\;
C:\Program Files (x86)\Git\cmd;
C:\Python27\python.exe;
C:\Ruby192\bin;
C:\Users\Michael\AppData\Roaming\cabal\bin;
C:\Python27\;
[EDIT 2]
Running python spews this out:
'import site' failed; used -v for traceback
Python 2.4.5 (#1, Jul 22 2011, 02:01:04)
[GCC 4.1.1] on mingw32
Type "help", "copyright", "credits" or "license" for more information.
>>>
...and running python --version (as suggested below) seems to be an unrecognized option.
(I also tried running python -v, and it appears that Python 2.4 is trying to import libraries from C:\Python27\Lib, and failed due to a syntax error when it encountered a with statement, which was added in later version, I think)
Also, I'm not sure if it's significant or not, but the above python version says something about GCC and mingw32, while running C:\python27\python.exe shows this:
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>>
UPDATE (see end of question)
The text "search and replace" utility programs I've seen, seem to only search on a line-by-line basis...
Is there a command-line tool which can locate one block of lines (in a text file), and replace it with another block of lines.?
For example: Does the test file file contain this exact group of lines:
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
'Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!'
I want this, so that I can replace multiple lines of text in a file and know I'm not overwriting the wrong lines.
I would never replace "The Jabberwocky" (Lewis Carroll), but it makes a novel example :)
UPDATE:
..(sub-update) My following comment about reasons when not use sed are only in the context of; don't push any tool too far beyond its design intent (I use sed quite often, and consider it to be invaluable.)
I just now found an interesting web page about sed and when not to use it.
So, because of all the sed answers, I"ll post the link.. it is part of the sed FAQ on sourceforge
Also, I'm pretty sure there is some way diff can do the job of locating the block of text (once it's located, the replacement is quite straight foward; using head and tail) ... 'diff' dumps all the necessary data, but I haven't yet worked out how to filter it , ... (I'm still working on it)
Hi.
My simple requirement: Reading a huge ( a million) line test file (For this example assume it's a CSV of some sorts) and keeping a reference to the beginning of that line for faster lookup in the future (read a line, starting at X).
I tried the naive and easy way first, using a StreamWriter and accessing the underlying BaseStream.Position. Unfortunately that doesn't work as I intended:
Given a file containing the following
Foo
Bar
Baz
Bla
Fasel
and this very simple code
using (var sr = new StreamReader(@"C:\Temp\LineTest.txt")) {
string line;
long pos = sr.BaseStream.Position;
while ((line = sr.ReadLine()) != null) {
Console.Write("{0:d3} ", pos);
Console.WriteLine(line);
pos = sr.BaseStream.Position;
}
}
the output is:
000 Foo
025 Bar
025 Baz
025 Bla
025 Fasel
I can imagine that the stream is trying to be helpful/efficient and probably reads in (big) chunks whenever new data is necessary. For me this is bad..
The question, finally: Any way to get the (byte, char) offset while reading a file line by line without using a basic Stream and messing with \r \n \r\n and string encoding etc. manually? Not a big deal, really, I just don't like to build things that might exist already..
I'm trying to do some analysis under Windows 7 as to why I can't get a Windows Experience Index (WEI) rating due to disk issues. To this end, I'm trying to run winsat from the command line with :-
winsat disk -seq -read -drive c
and
winsat disk -ran -write -n 2
but the command window is closing too quickly to be able to read the results. I've tried opening a seperate cmd window to run it in but it still insists on launching its own window to run in, closing straight away.
Any idea how I can see the output?
There's such utility for Windows developers called regtlib. I have three computers - one with WinXP, another two with Win2k3. If I run built-in Windows search for file with wildcard regtlib* on the whole filesystem search finds nothing on all three computers.
If I try to execute regtlib on WinXP command line it says it can't find such a file or built-in command. The same on one of the two Win2k3 computers. But when I do that on the other Win2k3 computer I see typical regtlib output.
What happens? What is the magic that invokes regtlib without the file being present on the filesystem?
I am looking for a (linux) command line tool to parse HTML files and extract some elements, ideally with some XPath-like syntax.
I have the following requirements:
It must be able to parse arbitrary HTML files (which may contain errors) in a robust manner
It must be able to extract text of elements and attributes
What I have tried so far:
xmlstarlet: would be perfect, but mostly reports errors in files (e.g. entity not defined), even xml fo or htmltidy does not help.
xmllint: the best I have found so far, but is not able to extract attribute texts. Something like //a/@href reports <a href="foo">, what I need is just foo. string(//a/@href) works, but queries only the first entry. data is not supported.
hxextract: works, but cannot extract attributes.
XQilla: would support XPath 2.0 and thus data. It also support xqilla:parse-html, but I have had no luck making this work.
Can you recommend me another tool?
I posted this on the Ubuntu forums and they had no good answer. I hope you guys have a solution!
On my relatively new install, it's
booting into command line instead of
X--again.
This is the reason I reinstalled in
the first place. This has happened to
me three times now.
So, I boot up and it gets past GRUB,
past the glowing Ubuntu option, then
it prompts me for my username, then
password. I run:
startx
And that starts the GUI for about a
minute, then it runs the GUI login
system.
To add to the mess, the network-applet
is not shown in the panel.
Additionally, Chrome will not launch
(I ran Firefox from the terminal).
What's the problem here?