Is there any class in .Net framework that can read/write standard ini files:
[Section]
<keyname>=<value>
...
Delphi have TIniFile component and I am looking if there is anything similar for C#.
I'm a TDDer and often have a need to refactor out common or similar code. If it is exactly the same there is no big problem, Eclipse can almost always do that by itself. But to get there I'm finding myself often looking at similar, but not identical, code fragments in the same, or even different, files.
It would be very handy if there was a possibility to mark two regions and get Eclipse (or some other tool) to mark the differences. With this information it would be much simpler to iteratively move the regions closer until they are the same and then activate the Extract Method refactoring.
It can be done in Emacs of course, but I'd like to have this readily available from Eclipse. Any pointers?
Hi everyone,
I am having little problem with importing classes in python. My work flow goes like this
index.py
class Template:
def header():
def body():
def form():
def footer():
display.py
I want to call function header(), body() and footer () in my display.py page. Will anyone make me clear about this issue in python. Thanks for your concern.
Hi ,
I am using DotNetOpenAuth Package,
I am trying to upload a package to google docs,
Using client credentials i am able to do it successfully using
following code,
DocumentEntry objDocumentEntry = new DocumentEntry();
objDocumentsService.setUserCredentials(strUserName,strPassWord);
string strAuthenticationToken =
objDocumentsService.QueryAuthenticationToken();
objDocumentEntry =
objDocumentsService.UploadDocument(Server.MapPath("test.docx"), "New
Name");
I want achieve save with plain oAuth,
I am having following code written for it,
if (this.TokenManager != null)
{
if (!IsPostBack)
{
var google = new
WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
// Is Google calling back with authorization?
var accessTokenResponse =
google.ProcessUserAuthorization();
if (accessTokenResponse != null)
{
this.AccessToken =
accessTokenResponse.AccessToken;
}
else if (this.AccessToken == null)
{
// If we don't yet have access, immediately
request it.
GoogleConsumer.RequestAuthorization(google,
GoogleConsumer.Applications.DocumentsList);
}
}
}
I successfully get "AccessToken",
But i am not sure how to use it..
Do we need to exchange this token? what excatly to do with this token?
Is it a sessionToken?
Please provide some inputs, I am badly stuck with this problem from
last 3 days,
Prashant C
I'm a recent vim convert (from fancy IDEs like eclipse.)
I love the :make command in vim and use it extensively; however I also like to edit multiple projects (with separate makefiles.)
So usually to edit more than one project I will do
pushd project1
vim project1.cpp
[suspend signal]
pushd ../project2
vim project2.cpp
and now I can switch between the two projects with ctrl+z i.e. suspend signal, and fg.
When this becomes an issue is when I want to open one project in the context of another so I can do copy/pasting. So if instead in the above I do
pushd project1
vim project1.cpp
:vsp ../project2/project2.cpp
I can edit both concurrently in the same vim process, however I can't effectively build one or the other with the :make command, it will only build project 1.
Does anyone have some kind of scheme that gives them the best of both worlds: being able to edit concurrently while still being able to build multiple projects with the :make command all from the same vim process?
hello,
I am using fortran 90
I have defined a fortran module in fileA.f as:
module getArr
double precision a(100)
end module getArr
The same fileA.f contains a subroutine that uses this module
subroutine my_sub
use getArr
implicit none
getArr%a(1) = 10.5
end subroutine
In fileB.f, I have a fortrtan function. I am trying to access the value of getArr%a(1) as:
double precision function my_func(R)
use getArr
double precision x
x = getArr%a(1)
return
end
But I am getting errors at the compile time. It says it is unable to access the module getArr.
How should I declare it??
Thanks
Hi,
Once I connect my iPhone to my computer, is there anyway I can look at the directory structure on the phone?
Would it work like a USB device for example and let me copy files without using iTunes but just drag and drop through the Finder on a Mac?
Thanks,
Tee
I searched the site but didn't see anything quite matching what I was looking for. I created a stand alone application that uses a web service I created. To run the client I use:
c:/scriptsdirecotry "run-client.bat" param1 param2 param3 param4
how would I go about coding this in python or F#. seems like it should be pretty simple but I haven't seen anything online that quite matches what i'm looking for.
Thanks in advance.
The following does not work and gives me a SIGABRT when I run in the debugger:
std::ifstream inFile;
inFile.open("/Users/fernandonewyork/inputText.txt");
cout << inFile << endl;
vector<string> inText;
if (inFile) {
string s4;
while (inFile>>s4) {
inText.push_back(s4);
}
}
inFile.close();
The following does:
std::ifstream inFile;
inFile.open("/Users/fernandonewyork/inputText.txt");
cout << inFile << endl;
vector<string> inText;
if (inFile) {
string s4("This is no lnger an empty string");
while (inFile>>s4) {
inText.push_back(s4);
}
}
inFile.close();
I was under the impression I was able to simply use s4 without having to worry about any space considerations, or is something else happening here? This is the full error I get from the top code:
malloc: * error for object 0x100010a20: pointer being freed was not allocated
* set a breakpoint in malloc_error_break to debug
Program received signal: “SIGABRT”.
Hi,
Can I open .htm file in HTML page and Edit it ?
e.g. using FrontPage inside HTML page to Open the .htm file and let one authorized user to modify contents of the .htm file, and then save the .htm file in the same folder from which the .htm file opened directly without searching for the folder ?
Thanks,
Ahmed.
We have several fairly large JavaScript files embedded into a single script resources DLL. This is then consumed by multiple projects by way of a reference and page includes via the ASP.NET script manager. This keeps things nice and neat within our ASP.NET pages and requires very little work to integrate into new projects.
The problem is that some of these script files are quite larger (approx 100KB) and take time to download. By running minify on them before embedding this is reduced down a lot (around 70KB) but not enough. What we would like to do is GZIP the files before they are embedded. However, just gzipping the files causes syntax errors as the content is not unzipped. There is a content type "text/javascript" applied in AssemblyInfo when the resource is embedded but we can't find a way to specify content-encoding.
Is there any way to make this work without having to write a httpmodule/handler (which would mean changing the config for all consuming projects)?
In my "Documents" library on Windows 7, one file is not showing up in Windows Explorer.
When I look in C:\Users\%USERNAME%\Documents\blah\blah all 24 files appear. But when I look in Libraries > Documents > blah > blah only 23 show up.
I made a copy of the file and the copy appears.
Refresh doesn't help.
The "Arrange by" setting defaults to "Name". When I change it to "Folder" the extra file appears, but changing it back to "Name" the file disappears again.
How can I make the file appear in all views? Why would it disappear?
EDIT: I deleted the Windows Search Index and things seem to be working again. I say it's a bug in the Search Service.
I'm trying to obtain the Oracle package name used for a Crystal report data source using .NET code.
I have obtained the procedure name, but for some reason I can not find the package name.
Dim rpt as new ReportDocument
rpt.Load(filename)
Dim procedureName As String = rpt.Database.Tables.Item(0).Location
Dim DataSourceAliasName As String = rpt.Database.Tables.Item(0).Name
Currently using .NET Crystal Decisions version: 10.5.3700.0
Hello,
I'm working on a project which involves an FTP server running ProFTPd and a PHP/MySQL backend that creates accounts for users.
Upon the creation of accounts, users are sent e-mails with their account details and instructions for downloading FileZilla or CyberDuck, depending on their OS, detected via user-agent string.
To make things easier for novices, I thought of having .lnk files generated for FileZilla with the account logins details as parameters, so they would just have to click on the .lnk files to open up the server. This is not crucial feature but more of a technical challenge.
My questions are :
is this even feasible ?
are there any alternatives (eg. generating a .bat with a script pointing to the Filezilla executable ?)
are there any issues, perhaps with relative / absolute paths pointing to the executable ?
to go even further, what would be the simplest way of providing users with software with FTP access on a single account / single server (web interface is not an option).
I got many, many files to be uploaded to the server, and I just want a way to avoid duplicates.
Thus, generating a unique and small key value from a big string seemed something that a checksum was intended to do, and hashing seemed like the evolution of that.
So I was going to use hash md5 to do this. But then I read somewhere that "MD5 are not meant to be unique keys" and I thought that's really weird.
What's the right way of doing this?
edit: by the way, I took two sources to get to the following, which is how I'm currently doing it and it's working just fine, with Python 2.5:
import hashlib
def md5_from_file (fileName, block_size=2**14):
md5 = hashlib.md5()
f = open(fileName)
while True:
data = f.read(block_size)
if not data:
break
md5.update(data)
f.close()
return md5.hexdigest()
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
Recently
for a customer demonstration there was a requirement to build a virtual box
image with Oracle Enterprise Manager Cloud Control 12c. This meant installing OEL Linux 6 as well as creating an 11gr2 database and Oracle Enterprise Manager Cloud Control 12c on a single
virtual box. Storage was sized at 300Gb using dynamically allocated storage for the virtual box and about 10Gb was used for
Linux and the initial build.
After
copying over all the binaries and performing all the installations the virtual
box became in the region of 80Gb used size on the host operating system, however
internally it only really needed around 20Gb. This meant 60Gb had been used when copying over all the binaries and although now free was not returned to the host operating system due to the growth of the virtual box storage '.vdi' file. Once the ‘vdi’ storage had grown it is not
shrunk automatically afterwards.
Space is
always tight on the laptop so it was desirable to shrink the virtual box back
to a minimal size and here is the process that was followed.
Install 'zerofree' Linux
package into the OEL6 virtual box
The RPM was
downloaded and installed from a site similar to below;
http://rpm.pbone.net/index.php3/stat/4/idpl/12548724/com/zerofree-1.0.1-5.el5.i386.rpm.html
A simple
internet search for ’zerofree Linux rpm’ was easy to perform and find the
required rpm.
Execute 'zerofree' package on
the desired Linux file system
To execute this package the desired file system needs to be mounted read
only. The following steps outline this
process.
As root: # umount /u01
As root:# mount –o ro –t ext4 /u01
NOTE: The –o is options and the –t is the file
system type found in the /etc/fstab.
Next run zerofree against the required storage, this is located by a
simple ‘df –h’ command to see the device associated with the mount.
As root:# zerofree –v /dev/sda11
NOTE: This
takes a while to run but the ‘-v’ option gives feedback on the process.
What does Zerofree do?
Zerofree’s
purpose is to go through the file system and zero out any unused sectors on the
volume so that the later stages can shrink the virtual box storage obtaining
the free space back.
When zerofree
has completed the virtual box can be shutdown as the last stage is performed on
the physical host where the virtual box vdi files are located.
Compact the virtual box ‘.vdi’
files
The final
stage is to get virtual box to shrink back the storage that has been correctly
flagged as free space after executing zerofree.
On the
physical host in this case a windows 7 laptop a DOS window was opened.
At the prompt the first step is to put the virtual box binaries onto the
PATH.
C:\ >echo %PATH%
The above shows the current value of the PATH environment variable.
C:\ >set PATH=%PATH%;c:\program
files\Oracle\Virtual Box;
The above adds onto the existing path the virtual box binary location.
C:\>cd c:\Users\xxxx\OEL6.1
The above changes directory to where the VDI files are located for the
required virtual box machine.
C:\Users\xxxxx\OEL6.1>VBoxManage.exe
modifyhd zzzzzz.vdi compact
NOTE: The
zzzzzz.vdi is the name of the required vdi file to shrink.
Finally the
above command is executed to perform the compact operation on the ‘.vdi’
file(s). This also takes a long time to
complete but shrinks the VDI file back to a minimum size. In the case of the demonstration virtual box
OEM12c this reduced the virtual box to 20Gb from 80Gb which was a great outcome
to achieve.
I've got a Comodo certificate to sign my application files with the appropriate publisher (that'll be me).
But how do I sign my installation to prevent those triple "are you sure?" UAC dialogs?
Am using the Visual Studio (2008) setup project, no third party tools.
Hi,
I want to make it possible for the administrator to log in as a fontend user from the backend. Right now I'm using two sessions (sessions with different names), one for the admin and one for the frontend.
Is it possible to write in the first session, close it and then open a new session?
This is a simplified version of what I attempted but failed:
session_name('admin_session');
session_start();
// use first session without generatring any output
session_close();
session_name('frontend_session');
session_start();
// use the second session
Thanks.
So I'm trying to learn C++ and I've gotten as far as using header files. They really make no sense to me. I've tried many combinations of this but nothing so far has worked:
Main.cpp:
#include "test.h"
int main() {
testClass Player1;
return 0;
}
test.h:
#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED
class testClass {
private:
int health;
public:
testClass();
~testClass();
int getHealth();
void setHealth(int inH);
};
#endif // TEST_H_INCLUDED
test.cpp:
#include "test.h"
testClass::testClass() { health = 100; }
testClass::~testClass() {}
int testClass::getHealth() { return(health); }
void testClass::setHealth(int inH) { health = inH; }
What I'm trying to do is pretty simple, but the way the header files work just makes no sense to me at all. Code blocks returns the following on build:
obj\Debug\main.o(.text+0x131)||In function main':|
*voip*\test\main.cpp
|6|undefined reference totestClass::testClass()'|
obj\Debug\main.o(.text+0x13c):voip\test\main.cpp|7|undefined reference to `testClass::~testClass()'|
||=== Build finished: 2 errors, 0 warnings ===|
I'd appreciate any help. Or if you have a decent tutorial for it, that would be fine too (most of the tutorials I've googled haven't helped)
Hi forum,
i have this file myfirst.txt located on a cluster of computers down the hall, i.e.:
myname@login1:~> ls
myfirst.txt
which i want to download to the home directory:
scp [email protected]:myfirst.txt .
to which i get:
myfirst.txt 100% 1828 1.8KB/s 00:00
now where (on my home computer) is this myfirst.txt file ? i can't find it. It's not visible when i click 'show hidden files' either.
Tia,
Good day.
I recently create X.509 certificate by using bouncy castle API.
I need to save the certificate result rather than display the result.
I tried to use FileOutputStream, but it does not work.
regards
the result is like follows
-----BEGIN CERTIFICATE-----
MIICeTCCAeKgAwIBAgIGATs8OWsXMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAMT...
-----END CERTIFICATE-----
The code is belows
import java.io.FileOutputStream;
//example of a basic CA
public class PKCS10CertCreateExample
{
public static X509Certificate[] buildChain() throws Exception
{
//create the certification request
KeyPair pair = chapter7.Utils.generateRSAKeyPair();
PKCS10CertificationRequest request =
PKCS10ExtensionExample.generateRequest(pair);
//create a root certificate
KeyPair rootPair=chapter7.Utils.generateRSAKeyPair();
X509Certificate rootCert = X509V1CreateExample.generateV1Certificate
(rootPair);
//validate the certification request
if(!request.verify("BC"))
{
System.out.println("request failed to verify!");
System.exit(1);
}
//create the certificate using the information in the request
X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();
certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
certGen.setIssuerDN(rootCert.getSubjectX500Principal());
certGen.setNotBefore(new Date(System.currentTimeMillis()));
certGen.setNotAfter(new Date(System.currentTimeMillis()+50000));
certGen.setSubjectDN(request.getCertificationRequestInfo().getSubject());
certGen.setPublicKey(request.getPublicKey("BC"));
certGen.setSignatureAlgorithm("SHA256WithRSAEncryption");
certGen.addExtension(X509Extensions.AuthorityKeyIdentifier, false, new AuthorityKeyIdentifierStructure(rootCert));
certGen.addExtension(X509Extensions.SubjectKeyIdentifier, false, new SubjectKeyIdentifierStructure(request.getPublicKey("BC")));
certGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(false));
//certGen.addExtension(X509Extensions.KeyUsage, true, new BasicConstraints(false));
certGen.addExtension(X509Extensions.KeyUsage, true, new KeyUsage(KeyUsage.digitalSignature | KeyUsage.keyEncipherment));
certGen.addExtension(X509Extensions.ExtendedKeyUsage, true, new ExtendedKeyUsage(KeyPurposeId.id_kp_serverAuth));
//extract the extension request attribute
ASN1Set attributes = request.getCertificationRequestInfo().getAttributes();
for(int i=0;i!=attributes.size();i++)
{
Attribute attr = Attribute.getInstance(attributes.getObjectAt(i));
//process extension request
if(attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest))
{
X509Extensions extensions = X509Extensions.getInstance(attr.getAttrValues().getObjectAt(0));
Enumeration<?> e = extensions.oids();
while(e.hasMoreElements())
{
DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
X509Extension ext = extensions.getExtension(oid);
certGen.addExtension(oid, ext.isCritical(), ext.getValue().getOctets());
}
}
}
X509Certificate issuedCert = certGen.generateX509Certificate(rootPair.getPrivate());
return new X509Certificate[]{issuedCert, rootCert};
}
public static void main(String[] args) throws Exception
{
X509Certificate[] chain = buildChain();
PEMWriter pemWrt = new PEMWriter(new OutputStreamWriter(System.out));
pemWrt.writeObject(chain[0]);
//pemWrt.writeObject(chain[1]);
pemWrt.close();
//write it out
//FileOutputStream fOut = new FileOutputStream("pkcs10req.req");
//fOut.write(chain[0].toString());
//fOut.write()
//System.out.println(chain[0].toString());
//fOut.close();
}
}
Forgive me if this is nor the place to ask these questions, I am new to batch and scripts and a bit new to these kind of posts...
I have a folder that will receive files and folders, I want to run a script that looks at the directory and renames all files in each subfolder numerically, and moves them if possible.
For example I have something that looks like the following
Recieved_File_Folder
|_folder1
| |_file1.txt
| |_file2.bmp
|_folder2
| |_file4.exe
| |_file5.bmp
|__file9.txt
|__file10.jpg
I would like to be able to look in every directory and move it to something like this, keeping in mind the names of the files will be random and I want to keep the extension intact also.
Renamed_Folder
|_folder1
| |_1.txt
| |_2.bmp
|_folder2
| |_1.exe
| |_2.bmp
|__1.txt
|__2.jpg
I have spent alot of time on this and am not doing too well with it, any help would be very greatly appreciated!! Thank you in advance!