I am trying to implement a windows service that will ping a FTP site and copy its contents once in every 3 houre.
This service has functions to
List all files in the FTP site
Copy one file
Delete the copied file
Repeats step 2 and 3 for all files in the site
Hello everybody.
Public web-site provides list of employees to Internet visitors. Contact information is hidden but visitor can send email via popup email-form.
What do you think about automated-scripts/viruses/bot spam activity? Is Capture a "must" for this functionality and what kind of precautions can you suggest also?
Thank you in advance
I have a C# application with a datagrid in windows form. I need to monitor a directory (am using FileSystemWatcher) and refresh the datagrid with list of files in the directory. I am not sure how I can set up the interface to do so? Calling the monitorDirectory() from the windows-form Load() does not seem to work as Load is called only once in the application.
Thanks
I'm doing some archiving to a property list and when I unarchive my data using NSKeyedUnarchiver I find that my app crashes if I release the object afterward. I was wondering if the finishDecoding message also autoreleases the object. Seems weird that it crashes when I release it.
This is my grid of nodes:
I'm moving an object around on it using the A* pathfinding algorithm. It generally works OK, but it sometimes acts wrongly:
When moving from 3 to 1, it correctly goes via 2. When going from 1 to 3 however, it goes via 4.
When moving between 3 and 5, it goes via 4 in either direction instead of the shorter way via 6
What can be wrong? Here's my code (AS3):
public static function getPath(from:Point, to:Point, grid:NodeGrid):PointLine {
// get target node
var target:NodeGridNode = grid.getClosestNodeObj(to.x, to.y);
var backtrace:Map = new Map();
var openList:LinkedSet = new LinkedSet();
var closedList:LinkedSet = new LinkedSet();
// begin with first node
openList.add(grid.getClosestNodeObj(from.x, from.y));
// start A*
var curNode:NodeGridNode;
while (openList.size != 0) {
// pick a new current node
if (openList.size == 1) {
curNode = NodeGridNode(openList.first);
}
else {
// find cheapest node in open list
var minScore:Number = Number.MAX_VALUE;
var minNext:NodeGridNode;
openList.iterate(function(next:NodeGridNode, i:int):int {
var score:Number = curNode.distanceTo(next) + next.distanceTo(target);
if (score < minScore) {
minScore = score;
minNext = next;
return LinkedSet.BREAK;
}
return 0;
});
curNode = minNext;
}
// have not reached
if (curNode == target) break;
else {
// move to closed
openList.remove(curNode);
closedList.add(curNode);
// put connected nodes on open list
for each (var adjNode:NodeGridNode in curNode.connects) {
if (!openList.contains(adjNode) && !closedList.contains(adjNode)) {
openList.add(adjNode);
backtrace.put(adjNode, curNode);
}
}
}
}
// make path
var pathPoints:Vector.<Point> = new Vector.<Point>();
pathPoints.push(to);
while(curNode != null) {
pathPoints.unshift(curNode.location);
curNode = backtrace.read(curNode);
}
pathPoints.unshift(from);
return new PointLine(pathPoints);
}
NodeGridNode::distanceTo()
public function distanceTo(o:NodeGridNode):Number {
var dx:Number = location.x - o.location.x;
var dy:Number = location.y - o.location.y;
return Math.sqrt(dx*dx + dy*dy);
}
Hi,
with a previous bash script I created a list of files:
data_1_box
data_2_box
...
data_10_box
...
data_99_box
the thing is that now I need to concatenate them, so I tried
ls -l data_*
but I get
.....
data_89_box
data_8_box
data_90_box
...
data_99_box
data_9_box
but I need to get in the sucession 1, 2, 3, 4, .. 9, ..., 89, 90, 91, ..., 99
Can it be done in bash?
Is it possible to defining arrays in config files in smarty?? for example I want have small data base in config file (located in /configs) - few (about 20) products descriptions: title, price, description. After that I want to list it via foreach or section.
How can I define that array in Smarty without MySql or other db engine. Can I do that?
Hi
I'm trying to change the position of the dropdown list relative to the combobox item.
Setting the position using comboBox.dropdown.x = 1337; doesn't work...
How can I unset the binding applied to an object so that I can apply another binding to it from a different location?
Suppose I have two data templates binded to the same object reference.
Data Template #1 is the default template to be loaded. I try to bind a button command to a Function1 from my DataContext class:
<Button Content="Button 1" CommandParameter="{Binding }" Command="{Binding DataContext.Function1, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/>
This actually works and the function gets binded. However, when I try to load Data Template # 2 to the same object (while trying to bind another button command to a different function (Function2) from my DataContext class):
<Button Content="Button 2" CommandParameter="{Binding }" Command="{Binding DataContext.Function2, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
It doesn't work and the first binding is still the one executed. Is there a workaround to this?
EDIT (for better problem context):
I defined my templates in my Window.Resources:
<Window.Resources>
<DataTemplate DataType="{x:Type local:ViewModel1}">
<local:View1 />
</DataTemplate>
<DataTemplate DataType="{x:Type local:ViewModel2}">
<local:View2 />
</DataTemplate>
</Window.Resources>
The View1.xaml and the View2.xaml contain the button definitions that I described above (I want them to command the control of my process flow).
ViewModel1 and ViewModel2 are my ViewModels that implement the interface IPageViewModel which is the type of my variable CurrentPageViewModel.
In my XAML, I binded ContentControl to the variable CurrentPageViewModel:
<ContentControl Content="{Binding CurrentPageViewModel}" HorizontalAlignment="Center"/>
In my .CS, I have a list defined as List<IPageViewModel> PageViewModels, which I use to contain the instances of my two View Models:
PageViewModels.Add(new ViewModel1());
PageViewModels.Add(new ViewModel2());
// Set starting page
CurrentPageViewModel = PageViewModels[0];
When I try to change my CurrentPageViewModel to the other view model, this is when I want the new binding to work. Unfortunately, it doesn't. Am I doing things the right way?
Is there any command either in debugger or ruby-debug to get a list of all gems and/or plugins loaded in memory for a Rails process? I understand only the 'require' gems are loaded but I would like to quickly see what got loaded during runtime.
Is there a way to use visual studio's "add assembly reference dialog" (or something similar) in my own application? I need it for dynamic code generation and compilation.
This is not simply an OpenFileDialog, since it additionally looks into the GAC and so on, so it will be very complicated to do it on my own, I think.
If this is not possible, how can I get a list of all assemblies from the GAC?
Hi,
I have a requirement to show a list of all users along with the Last Activity Date. The application is .Net based.
I found the MemberShip class provides the Last Activity date. However, this does not work when the MemberShip provider is ActiveDirectory
Link to MSDN page because the ActiveDirectoryMemberShipUser does not implement the LastActivityDate property.
Is there any workaround or other way, I can get the LastActivityDate of the user in the application.
Thanks for any info
Hi all,
You can easily use a List in struts2 select tag, but is there a way to use Map in tag?? If it is possible please provide a sample code...
thanx !
when I try to use a "third part module" in my perl script, I got some error message like
"unknown error, compilation failed in require at ... line xxx"
nothing else and the line mentioned in the error message is exact the same line I "use the module"...
my question is: are there any good practice to handle this situation? like a list to check or something else. thanks in advance.
I have a ListView in a ListActivity populated with strings. However, only the text-part of a list item is clickable, and when it is clicked, only the text-part is highlighted (orange on black background). I would like to make the full line clickable, and when selected, the full line should be marked as selected.
How can I do that?
I tried UIHint("Label") but it doesn't change the behavior. If someone also can point me to a list of possibel values for UIHint, that would be awesome!
I'm using GwtUpload to upload images on GAE. The problem is that the images seem to get much bigger when I move them into a blob. I've noticed the same for simple text fields and in that case I've realised that some weirdo characters are being appended to the end of the field values (encoding right?). Can anyone help?
public class ImageUploadServlet extends AppEngineUploadAction {
/**
* Maintain a list with received files and their content types
*/
Hashtable<String, File> receivedFiles = new Hashtable<String, File>();
Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>();
private Objectify objfy;
public ImageUploadServlet() {
ObjectifyService.register(Thumbnail.class);
objfy = ObjectifyService.begin();
System.out.println("ImageUploadServlet init");
}
/**
* Override executeAction to save the received files in a custom place and
* delete this items from session.
*/
@Override
public String executeAction(HttpServletRequest request,
List<FileItem> sessionFiles) throws UploadActionException {
Thumbnail t = new Thumbnail();
for (FileItem item : sessionFiles) {
//CacheableFileItem item = (CacheableFileItem)fItem;
if (false == item.isFormField()) {
System.out.println("the name 1st:" + item.getFieldName());
try {
// You can also specify the temporary folder
InputStream imgStream = item.getInputStream();
Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream));
t.setMainImage(imageBlob);
System.out.println("blob: " + t.getMainImage());
} catch (Exception e) {
throw new UploadActionException(e.getMessage());
}
} else {
System.out.println("the name 2nd:" + item.getFieldName());
String name = item.getFieldName();
String value;
try {
InputStream is = item.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(is, writer,"UTF-8");
value = writer.toString();
writer.close();
System.out.println("parm name: " + name);
System.out.println("parm value: " + value + " **" + value.length());
System.out.println(item.getContentType());
if (name.equals("thumb-name")) {
t.setName(value);
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Error");
e.printStackTrace();
}
}
removeSessionFileItems(request);
}
objfy.put(t);
return null;
}
As an example the size of the image is 20kb, and the lib has some debugging that confirms that this is the case when it's uploading the file but the blob ends up being over 1 MB.
Wes
I'm using Spring batch - using datareaders to load up lists of items. For each of my readers, they all return an extra null object on the end of the list.
Has anybody seen this before? What am I doing wrong?
I have two checkboxes (Recommended and Others) which have peoples names (concatenated, i.e. John Smith is one item). I want to alphabetize the selected members of each list into one. How can I do this?
If I have a simple low-pass filter, e.g.
filt = fir1(20, 0.2);
and a matrix with a list of numbers (a signal), e.g. [0.1, -0.2, 0.3, -0.4] etc, how do I actually apply the filter I've created to this signal?
Seems like a simple question but I've been stuck for hours. Do I need to manually calculate it from the filter coefficients?
I have comments table where everything is stored, and i have to SUM everything and add BEST ANSWER*10.
I need rank for whole list, and how to show rank for specified user/ID.
Here is the SQL:
SELECT m.member_id AS member_id,
(SUM(c.vote_value) + SUM(c.best)*10) AS total
FROM comments c
LEFT JOIN members m ON c.author_id = m.member_id
GROUP BY c.author_id
ORDER BY total DESC
LIMIT {$sql_start}, 20
I'm a tad new to qt and so far I really only added qwt; but I was wondering, what are some other useful qt plugins? And is there a list somewhere?
Thanks in advance.
How do I get the number of arguments passed to a function, such as Plus[2,3,4,5] has 4 arguments passed to it. I was thinking it may involve the use of the function Length and getting the arguments into a list. The intention is to iterate an operation based on the number of arguments for a function. There is probably a simple solution or function but I haven't come across it yet. Any other ways or suggestions are welcome as well?
I have an assembly which I need to GAC on aSharePoint box which I do not have access to. I am however, able to deploy .dwp or .webpart files to the site.
There is already a entry in the SafeControls list for this assembly in the web.config file for the site.
Am I able to deploy the assembly through a web part?