I need to pass data between a c# service and a running vb 6 application, considering using Windows Messaging. How do I pass the data back and forth between a C# service and a running vb 6 application? Shortened sample of the data I am passing back and forth is below:
namespace MainSection
{
public struct Info
{
private int _Id;
private string _TypeCode;
private float _Calc;
private DateTime _ProcessDate;
private bool _ProcessFlag;
public int Id
{
get { return _Id; }
set { _Id = value; }
}
public string TypeCode
{
get { return _TypeCode; }
set { _TypeCode = value; }
}
public float Calc
{
get { return _Calc; }
set { _Calc = value; }
}
public DateTime ProcessDate
{
get { return _ProcessDate}
set { _ProcessDate = value; }
}
public bool ProcessFlag
{
get { return _ProcessFlag}
set { _ProcessFlag = value; }
}
}
}
I used to have database entries separated by ampersands (&), but this was causing certain search issues so I decided to encapsulate my entries on both sides by $ and & symbols like:
$this&
But I am having trouble displaying all the entries of a cell as individual records. Before I used:
$unsplitItems = $row['files'];
$files = explode("@", $unsplitItems);
foreach ($files as $file) {
if(strlen($file)) {
echo "<li>$file</li>";
}
}
Any idea how I can split my records and display all the items in the array as individual entries?
We have a customer that would like to modify application user messages that we store in .resx files. I'm thinking this can't be done since the xml file behind the .resx is embedded in a compiled dll. Am I correct? Or, is there a way keep the xml outside of the compiled dll? I realize this can easily be done by other means but I like the ease of the resx file--the classes/properties are created for you.
This seems like an elementary question, but after a lot of searching around I can't seem to find a straightforward explanation:
If I'm building a web application that is going to be accessed largely through a web browser, but that will also support some API requests in a RESTful way, should there be a large degree of separation between the two?
On one hand, it seems a large amount of the functionality is the same, with identical data presented in different views (HTML vs. XML/JSON). But on the other hand, there are certain things I need to present to the browser that doesn't quite fit a RESTful approach: how to get an empty form to create a new instance of a resource and how to get a pre-populated form to edit an existing resource.
Should these two different methods of accessing the system by funneled through different controllers? Different methods in the same controller? The exact same methods with a switch for view type?
Hello Experts!
I'm trying to do a periodic separated thread operation let's say check for internet connection or check for user's info via web service and update the user interface.
i've tried with quartz.net to implement that.So i created an inner class for the window i need to update.That inner class does what is meant for but the problem is that i don't know how to access parent's(window class) members form the child(inner class). for example
public partial class Window2 : Window
{
private int i;
public Window2()
{ InitializeComponent();
}
public string doMyOperation()
{
//code here
return result;
}
public class Myclass :IJob
{
public void Execute(JobExecutionContext context)
{
string result = doMyOperation();
//Now here i could be able to call a label of name lblNotif
//lblNotif.Content = result;
}
}
}
Well the whole idea works but i'm stacked at here i need to access a controls of Window2
Since i'm stacked i tried Spring.Net way of implementing Quartz hoping that i could use MethodInvokingJobDetailFactoryObject and rather have the Operation done on Window2 itself.But for some reason i'm having an exception
Cannot resolve type [System.Windows.Window2,System.Windows];, could not load type from string value System.Windows.Window2,System.Windows
and the wiring is done so
<object name="UpdateLabelJob" type="System.Windows.Window2,System.Windows"/>
What i'm i doing wrong here?Is that a way round? thanks for reading and for helping out
Hi all,
I'm trying to achieve two things, both of which I fail to get at.
On a server are a series of notes; all contain a div (id=ajxContent). Some notes also contain an additiona div (id=ajxHead). The ajxContent itself contains links (class=clicking) to call the next installment, hence the link destination in a variable.
This is my code:
$(document).ready(function(){
$( 'a.clicking' ).live('click', function(e){
e.preventDefault();
var theLink = $(this).attr('href');
$('#loadText').load(theLink + '#ajxContent');
$('h1').load(theLink + '#ajxHead');
});
})
Where it fails:
1) the ajxContent gets loaded into the h1 tag as well as in its intended target.
2) when I had set up the code differently, if there was no div id=ajxHead present in a note, the load would nevertheless erase the existing value in the h1 tag.
Am I on a totally wrong track here, with two load statements? Input is very welcome, thanks.
I have a table where a record looks like this
varchar(255) Name
varchar(255) Text
varchar(255) Value
Name is the DDL name, Text is what is displayed, and Value is returned upon selection. There are between one and twenty options for each Name. Without iterating though each option like a cursor, is there any way to pull out a list of objects, one for each unique DDL Name, using Linq and C#?
A sample of the data:
Beds '4 (10)' 4
Beds '5 (1)' 5
Beds '7 (1)' 7
Baths 'NA (13)' NULL
Baths '0 (1)' 0
Baths '1 (13)' 1
I was thinking about doing an outer select to get the unique Names, then an inner select to get the list of options for it, then return the set as a List of a set of Lists.
I have a subclass of UIView which draws itself based on data held in a corresponding model class, which is a subclass of NSManagedObject.
The problem is, some fields in the data model (e.g. the position of the view) are already held in the view (i.e. the frame property in this case). I then have a data duplication/synchronization problem to solve.
To complicate matters further, the view needs to update in response to changes made to the data model and the data model needs to be updated in responses made to the view (e.g. the user dragging it to a new location).
What's the best way to solve this? Using KVO and references in both directions?
Or is there a better approach?
TLDR summary: (a) Should I include (lengthy) method code in classes which may spawn multiple objects at runtime, (b) does doing so cause memory usage bloat, (c) if so should I "outsource" the code to a class that is loaded only once and have the class methods call that, or alternatively (d) does the code get loaded only once with the object definition anyway and I'm worrying about nothing?
........
I don't know whether there's a good answer to this but if there is I haven't found it yet by searching in the usual places.
In my VB.Net (2010 if it matters) WinForms project I have about a dozen or so class objects in an object model. Some of these are pretty simple and do little more than act as data storage repositories. The ones further up the object model, however, have an increasing number of methods. There can be a significant number of higher level objects in use though the exact number will be runtime dependent so I can't be more precise than that.
As I was writing the method code for one of the top level ones I noticed that it was starting to get quite lengthy.
Memory optimisation is something of a lost art given how much memory the average PC has these days but I don't want to make my application a resource hog. So my questions for anyone who knows .Net way better than I do (of which there will be many) are:
Is the code loaded into memory with each instance of the class that's created?
Alternatively is it loaded only once with the definition of the class, and all derived objects just refer to that definition? (I'm not really sure how that could be possible given that, for example, event handlers can be assigned dynamically, but no harm asking.)
If the answer to the first one is yes, would it be more efficient to write the code in a "utility" object which is loaded only once and called from the real class' methods?
Any thoughts appreciated.
I have a directory named STA. Within that directory are about 600 other directories that have the format hh:mm:ss (for example 00:01:34). Within each of these sub-directories should be three files. I also have a file, 'waveformlist', (contained within STA) which is a list of all of these sub-directories i.e.:
00:01:34
00:02:35
etc.
A lot of the sub-directories do not contain these three files and are instead empty. I want to run a C-shell script to go through every sub directory and check if it is empty.
If it is empty I want to delete that sub directory from the main directory STA, and also remove that sub-directory name from the list 'waveformlist'.
Below is my script so far. It does not recognize when the sub-directory is empty or not and does not like the rm $dir line. Also, I do not know how to go and remove the sub-directory name from 'waveformlist'.
#!/bin/csh
echo "Enter name of station folder to apply filter to as 'STA' e.g. APZ:"
set ans = $<
cd $ans
set c=0
foreach dir (*:*)
if ("${c}" == 0) then
echo "Empty directory:" $dir
rm $dir
else
echo ${dir} "has files"
endif
end
I hope I have been clear enough. Thank you.
I'm blanking on the best way to paste a list of strings together to go into an SQL statement... I'm having trouble with the separator bar | printing at the beginning when I don't want it to:
foo = "blah"
paste_all_together = NULL
for (n in 1:4) {
paste_together = paste(foo ,sep = "")
paste_all_together = paste(paste_all_together, paste_together, sep = "|")
}
> paste_all_together
[1] "|blah|blah|blah|blah"
I just want it to print out "blah|blah|blah|blah". Do I need a nested loop, or is there a better itterator in R for doing this? Or perhaps a better way to input SQL statements?
I currently have a class file with the following enumerator:
using System;
namespace Helper
{
public enum ProcessType
{
Word = 0,
Adobe = 1,
}
}
Or should I include the enumerator in the class where it's being used?
I noticed Microsoft creates a new class file for DockStyle:
using System;
using System.ComponentModel;
using System.Drawing.Design;
namespace System.Windows.Forms
{
public enum DockStyle
{
None = 0,
Top = 1,
Bottom = 2,
Left = 3,
Right = 4,.
Fill = 5,
}
}
I am new to xml and unable to find a way to get content in between tags.
My XML file is
<?xml version="1.0" encoding="utf-8"?>
<block1>
<file name="c:\w0.xml">
<word>Text</word>
<number>67</number>
</file>
<file name="c:\w1.xml">
<word>Text</word>
<number>67</number>
</file>
<file name="c:\w2.xml">
<word>Text</word>
<number>67</number>
</file>
</block1>
So far, I've been successful with generating output to individual files by opening a file for output as part of outer loop and closing it after all output is written. I had used a counting variable ($x) and appended .txt onto it to create a filename, and had written it to the same directory as my perl script. I want to step the code up a bit, prompt for a file name from the user, open that file once and only once, and write my output one "printed letter" per page. Is this possible in plain text? From what I understand, chr(12) is an ascii line feed character and will get me close to what I want, but is there a better way? Thanks in advance, guys. :)
sub PersonalizeLetters{
print "\n\n Beginning finalization of letters...";
print "\n\n I need a filename to save these letters to.";
print "\n Filename > ";
$OutFileName = <stdin>;
chomp ($OutFileName);
open(OutFile, ">$OutFileName");
for ($x=0; $x<$NumRecords; $x++){
$xIndex = (6 * $x);
$clTitle = @ClientAoA[$xIndex];
$clName = @ClientAoA[$xIndex+1];
#I use this 6x multiplier because my records have 6 elements.
#For this routine I'm only interested in name and title.
#Reset OutLetter array
#Midletter has other merged fields that aren't specific to who's receiving the letter.
@OutLetter = @MiddleLetter;
for ($y=0; $y<=$ifLength; $y++){
#Step through line by line and insert the name.
$WorkLine = @OutLetter[$y];
$WorkLine =~ s/\[ClientTitle\]/$clTitle/;
$WorkLine =~ s/\[ClientName\]/$clName/;
@OutLetter[$y] = $WorkLine;
}
print OutFile "@OutLetter";
#Will chr(12) work here, or is there something better?
print OutFile chr(12);
$StatusX = $x+1;
print "Writing output $StatusX of $NumRecords... \n\n";
}
close(OutFile);
}
If I have a method that does multiple, related things, is it good practice to stick each "thing" that the method does into a seperate block?
Ex.
{
int var
//Code
}
{
int var
//More Code
}
It would help reduce the number of local variables, and make the code more readable, but I'm not sure if it's a good idea.
I have an array which has BIG numbers and small numbers in it. I got it from after running a log from WireShark. It is the total number of Bytes of TCP traffic. But Wireshark does not discriminate(it would actually try, and hence it will tell you the traffic stats of ALL types of traffic, but since
This is how the Array look like :
@Array=qw(10912980
10924534
10913356
10910304
10920426
10900658
10911266
10912088
10928972
10914718
10920770
10897774
10934258
10882186
10874126
8531
8217
3876
8147
8019
68157
3432
3350
3338
3280
3280
7845
7869
3072
3002
2828
8397
1328
1280
1240
1194
1193
1192
1194
6440
1148
1218
4236
1161
1100
1102
1148
1172
6305
1010
5437
3534
4623
4669
3617
4234
959
1121
1121
1075
3122
3076
1020
3030
628
2938
2938
1611
1611
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
1541
583
370
178)
When you look at these this array carefully, one thing is obvious to the human eye. There are really BIG numbers and small numbers. (Basically what I am saying is, there is the 1% class and low income class, no middle class). I want to split the array to two different arrays. That would require me to set a threshold. Array 1 should be ONLY the BIG numbers (10924534-10874126), and array 2 should be the smaller numbers (68157-178). Btw, the array is not sorted. User will NOT input the threshold, and hence should be determined smartly.
As far as I understand it is necessary for people using Scala for Android applications to bundle the Scala classes they used with their application.
Considering this adds hundreds of kilobytes to each Scala app redundantly, would it be possible to build a Scala library which can be delivered over the market, so app writers can just depend on that library instead of bundling it themselves?
Hi All,
I originally setup some conditions using CGRectIntersectsRect for some collision detection which worked fine. In the greater scale of things I only need part of the view to be detected.
So originally within the ViewController it was comparing 2 UIviews.
Now what I need to do is collision detection of subViews within 2 different UIViews that are contained in a view in which the view controller does the logic.
My script is no longer working as I suspect CGRectIntersectsRect only compares frames within the same view? I'll keep digging to confirm this.
Any ways around this? Is it possible for example to get the x and y pos of the sub view in relation to the main view that's performing the logic?
For example, I open a file called "abc.txt". Now I want to search for all occurrences of "he is" and "first" simultaneously. I want to be able to do a search forward i.e. Ctrl-s and I'll reach the next instance of either of the two search strings.
This questions concerns mostly Unix/Linux style C++ development. I see that many C++ libraries store their header files in a "include" folder and source files in an "src" folder. For the sake of conformance I adopted this in my own code. But it is not clear to me whether this should be done for application code as well. I've seen a few cases where a flat directory structure is used for that. What would be the recommended approach?
This question isn't about a specific programming language, but more about general best practices.
What characters are best (greatest compatibility over programming languages, OSs, file systems, etc.) to separate words in filenames?
For example:
file.name.txt
file_name.txt
file-name.txt
FileName.txt
filename.txt