I have some unit tests that expects the 'current time' to be different than DateTime.Now and I don't want to change the computer's time, obviously. What's the best strategy to achieve this?
Thanks
I want to use HierarchyNode class which is in the Microsoft.VisualStudio.Package namespace and the assembly is MPF.Project.NonShipping.dll.
There was no assembly on the .net reference or on the COM.
I searched for the file, but it was not on the machine.
I also tried to google the dll if we could download it, but there was no link, whatsoever about the download.
I am using VS 2008 sp1 by the way. Thanks in advance.
Hello, Do you imagine that I have the following txt:
/* Licenciaturas na ESTG-IPVC 2009 – v1.1*/
- Info,
3
dados, ;;
- disciplinas, ;;[;]
LEI;7671;Maria Albertina da silva;[email protected];
9;8;12;9;12;11;6;15;7;11;
LTCGM;6567;Artur Pereira Ribeiro;[email protected];
6;13;14;12;11;16;14;
LEI;7701;Ana Maria Carvalho;[email protected];
8;13;11;7;14;12;11;16;14;
How can I make a C program that convert txt to XML.
thanks
How can I make a program that opens a text file, and converts it into a XML file?
The XML might look like:
<curso>
<sigla>LTCGM</sigla>
<NAlunos>1</NAlunos>
<lista_alunos>
<aluno>
<numero>6567</numero>
<nome>Artur Pereira Ribeiro</nome>
<email>[email protected]</email>
<estado>Aprovado</estado>
<media_notas>13</media_notas>
<maior_nota>16</maior_nota>
<menor_nota>11</menor_nota>
</aluno>
</lista_alunos>
</curso>
Hi,
I have a compressed file in the disk, that a partitioned in blocks. I read a block from disk decompress it to memory and the read the data.
It is possible to create a producer/consumer, one thread that recovers compacted blocks from disk and put in a queue and another thread that decompress and read the data?
Will the performance be better?
Thanks!
Hello i want to show the number of lines, words and characters of all configuration files
"/ Etc / * conf" (command "wc"). How can i modify the command to not view the messages
error.
Hi...i have a txt file where the first number define the size of the array's, i know that calloc or malloc can reserve memory, but how?
this code:
typedef struct alpha{
int *size;
char name;
int tot;
char line[60];
}ALPHA;
fgets(line,60,fp);
tot=atoi(line);
size=(int*)calloc(name,sizeof(int);
Imagine that in the first line of the txt is the number 10, wiht this code the size of name will be 10? like name[10]???
Hello
If have a new project (ProjNew ) where i want to put several classes, that are on other project (ProjOld).
The problem is i want to maintain the old classes marked with Obsolete to avoid running all my projects and check if they using it.
But in that way this may throw a ambiguos class name error because i didn't explicity call by namespace..
There is an way to say in the obsolete what assymbly to use in ambiguity case=
A command line in a text editor is a wonderful feature. It allows the user to explore the editor's functionality and learn it's shortcuts in a textual way. It's much faster than using the mouse, and it is much easier to memorise "shortcuts" this way.
Emacs and VI provide this, though, emacs and vi are not "modern".
By "modern", I mean one that is original built to cope with the modern de-facto standards of selecting, copying, pasting, cutting, undoing, redoing and auto-completing.
Cream/vi or Emacs/CUA are not valid options, since there are loads of things built over them that conflict with the mentioned stuff.
It would be nice if there was an editor that would cope with the modern de-facto standards out-off-the-box, but still provide a command-line/minibuffer to perform/explore the commands and learn its shortcuts.
Is there such a thing?
I do not intend to use the "modern"
term as derrogatory. I love both Emacs
and VI, but I hate their keyboard-shortcut historical baggage. When I reffer to de-facto standards, I am not talking about Windows vs Whatever. Kate, gedit, Eclipse, Intelij or Textmate also follow the norm I am talking about and are not Windows editors.
Please do not advertise Vim and
Emacs, that's not answering the
question. I am asking for
alternatives.
Why don't I like emacs and vi:
Emacs: Despite CUA mode, emacs has
loads of modes that conflict with this
(e.g. slime, ruby-mode, etc...) It
would be nice to have something that
would work out-off-the-box.
VI: I do not like that it is
Visual/Insert-based. I do not know how
to browse the text-editor's commands.
I do not like that it is so much
tought for the terminal. I believe
that it has the same problem that I
mentioned for emacs.
This question is starting to look like requirement analysis.. As de-facto standards I mean:
Ctrol-XCV for cut-copy-paste
Ctrol-A for select-all
Contrl-Z for Undo
Ctrol-Y for Redo
Control-F for Searching
Contrl-Space for auto-complete
Shift-arrow for selection
Control-arrow for word-navigation
Alt-Arrow for moving
I'd like to monitor activity on browsers, creating a list with URLaddress, browser number (if have many opened at the same time) and tab number (if there are more than one tab opened).
How to do it with Qt 4.6?
Hello all,
My first question here so be gentle.
I would like arguments for the following code:
public class Example {
private String name;
private int age;
...
// copy constructor here
public Example(Example e) {
this.name = e.name; // accessing a private attribute of an instance
this.age = e.age;
}
...
}
I believe this breaks the modularity of the instance passed to the copy construct.
This is what I believe to be correct:
public class Example {
private String name;
private int age;
...
// copy constructor here
public Example(Example e) {
this.setName(e.getName());
this.setAge(e.getAge());
}
...
}
A friend has exposed a valid point of view, saying that in the copy construct we should create the object as fast as possible. And adding getter/setter methods would result in unnecessary overhead.
I stand on a crossroad. Can you shed some light?
I have a class with a Boolean attribute. When I instantiate and persist this class, the Boolean attribute is stored with the "false" value instead of the expectable "null". How can I set a Boolean attribute to "Null"?
Hi.
I wanna make an app that executes remote scripts. I am going to design it like a Windows Service that listen on tcp/ip port. Every new request I will execute a python scripts.
So I can handle any number of tcp/ip request at same time, so I will need to execute python script in separate threads. How can I do that? Is that simple?
The script will share some objects, like Log files(text files) and other modules. In the log file example every script will write in the same file. So the app (windows service) will be responsible for do that. I need to make this objects thread safe, right?
Hello everybody!
I have a business need to create the NinePatchDrawable objects at runtime, this is, an exterior .png image is received from a server and it has to be applied in a button's background (for example) as a nine patch.
I have tried to create the NinePatchDrawable object, but the constructor asks me for a "byte[] chuck" that describes the patch. The thing is, I have no idea on how to build this chunck from a bitmap that does not have the 9patch information in it.
Any ideas on this topic? Am I seeing the problem from a wrong perpective?
Thanks!
When I use a conditional statement targeting IE6 and below with some PHP code Google Chrome disregards the statement and inserts the code.
Example:
It will insert the content of ie6.php in the body anyway.
Anybody got this problem before?
I am using CodeProject's well known Open Session in View to handle NHibernate Sessions. Does it works well with Level 2 Cache? Anyone has succeeded doing it? Should I use NH.Burrow instead? Any advice on l2 cache in asp.net best practices is appreciated.
Edit: link to CodeProject's article: http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
I saw a code where they have the data access layer like this:
public class CustomerDA{
private static readonly object _sync = new object();
private static readonly CustomerDA _mutex = new CustomerDA();
private CustomerDA(){
}
public CustomerDA GetInstance(){
lock(_sync){
return _mutex;
}
}
public DataSet GetCustomers(){
//database SELECT
//return a DataSet
}
public int UpdateCustomer(some parameters){
//update some user
}
}
public class CustomerBO{
public DataSet GetCustomers(){
//some bussiness logic
return CustomerDA.GetInstance().GetCustomers();
}
}
I was using it, but start thinking... "and what if had to build a facebook like application where there are hundreds of thousands of concurrent users? would I be blocking each user from doing his things until the previous user ends his database stuff? and for the Update method, is it useful to LOCK THREADS in the app when database engines already manage concurrency at database server level?"
Then I started to think about moving the lock to the GetCustomers and UpdateCustomer methods, but think again: "is it useful at all?"
I'm trying to migrate my flat php project to Symfony2, but its coming to be very hard.
For instance, I have a table of Products specification that have several specifications and are distinguishables by its "cat" attribute in that Extraspecs DB table.
Therefore I've created a Entity for that table and want to make an array of just the specifications with "cat" = 0...
I supose the code is this one.. right?
$typeavailable = $this->getDoctrine()
->getRepository('LabsCatalogBundle:ProductExtraspecsSpecs')
->findBy(array('cat' => '0'));
Now how can i put this in an array to work with a form like this?:
form = $this ->createFormBuilder($product)
->add('specs', 'choice', array('choices' => $typeavailableArray), 'multiple' => true)
Thank you in advance :)
#
Thank you all..
But now I've came across with another problem..
In fact i'm building a form from an existing object:
$form = $this ->createFormBuilder($product)
->add('name', 'text')
->add('genspec', 'choice', array('choices' => array('0' => 'None', '1' => 'General', '2' => 'Specific')))
->add('isReg', 'choice', array('choices' => array('0' => 'Material', '1' => 'Reagent', '2' => 'Antibody', '3' => 'Growth Factors', '4' => 'Rodents', '5' => 'Lagomorphs')))
So.. in that case my current value is named "extraspecs", so i've added this like:
->add('extraspecs', 'entity', array(
'label' => 'desc',
'empty_value' => ' --- ',
'class' => 'LabsCatalogBundle:ProductExtraspecsSpecs',
'property' => 'specsid',
'query_builder' => function(EntityRepository $er) {
return $er ->createQueryBuilder('e');
But "extraspecs" come from a relationship of oneToMany where every product has several extraspecs...
Here is the ORM:
Labs\CatalogBundle\Entity\Product:
type: entity
table: orders__regmat
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 100
catnumber:
type: string
scale: 100
brand:
type: integer
scale: 10
company:
type: integer
scale: 10
size:
type: decimal
scale: 10
units:
type: integer
scale: 10
price:
type: decimal
scale: 10
reqcert:
type: integer
scale: 1
isReg:
type: integer
scale: 1
genspec:
type: integer
scale: 1
oneToMany:
extraspecs:
targetEntity: ProductExtraspecs
mappedBy: product
Labs\CatalogBundle\Entity\ProductExtraspecs:
type: entity
table: orders__regmat__extraspecs
fields:
extraspecid:
id: true
type: integer
unsigned: false
nullable: false
generator:
strategy: IDENTITY
regmatid:
type: integer
scale: 11
spec:
type: integer
scale: 11
attrib:
type: string
length: 20
value:
type: string
length: 200
lifecycleCallbacks: { }
manyToOne:
product:
targetEntity: Product
inversedBy: extraspecs
joinColumn:
name: regmatid
referencedColumnName: id
HOw should I do this?
Thank you!!!
My problem is how to know what files or folder are changed before do commit. I can add all the new files in my working copy before do commit, and the repository changes, but if for example i delete one file of the working copy i dont know the way to add this change before do commit. When you use the tortoise for example before do commit the program shows all the changes of the working copy and you can choose what changes commit and what changes dont. There is some way to do this usin sharp svn?? thanks for your answer!!!
A command line in a text editor is a wonderful feature. It allows the user to explore the editor's functionality and learn it's shortcuts in a textual way. It's much faster than using the mouse, and it is much easier to memorise "shortcuts" this way.
Emacs and VI provide this, though, emacs and vi are not "modern".
By "modern", I mean one that is original built to cope with the modern de-facto standards of selecting, copying, pasting, cutting, undoing, redoing and auto-completing.
Cream/vi or EmacsCUE are not valid options, since there are loads of things built over them that conflict with the mentioned stuff.
Is there any alternative?
Hi,
My problem is:
I want to store a array of bytes in compressed file, and then I want to read it with a good performance.
So I create a array of bytes then pass to a ZLIB algorithm then store it in the file.
For my surprise the algorithm doesn't work well., probably because the array is a random sample.
Using this approach, it will will be ber easy to read. Just copy the stream to memory, decompress them and copy it to a array of bytes.
But i need to compress the file. Do I have to use a algorithm, like RLE, for compresse the byte array?
I think that I can store the byte array like a string and then compress it. But i think I am going to have a poor performance on reading data.
Sorry for my poor english.
Thanks