Unofficial Programming Thread III

Post » Tue Aug 03, 2010 12:22 am

You can turn off the printing of a header in Notepad++. Settings->Preferences->Print.

I can't imagine printing code as ever being useful myself, but to each their own I guess.

Well it helps if someone doesn't have a way to see it with the syntax highlighting, say for instance no Visual Studio installed and inabiility to install other software. Though I guess Notepad++ portable works but alot of systems on school campuses restrict what can be run from flash drives.
User avatar
Jake Easom
 
Posts: 3424
Joined: Sun Jul 29, 2007 4:33 am

Post » Tue Aug 03, 2010 5:37 am

I still haven't figured the printing issue out but I guess for the moment its not a big deal.

I keep being told if I use WPF to look into MVVM but when I do I get so lost and confused. Do you guys think for a beginner programmer it is worth tryign to wrap my brain around or wait until I get a bit more experience which will let me understand it better?

Also, I want to create an updater for one of my programs but since it is just a single executable I am not sure how to go about it other then have it create a temporary executable which runs and replaces the program. Any suggestions for this?
User avatar
Oscar Vazquez
 
Posts: 3418
Joined: Sun Sep 30, 2007 12:08 pm

Post » Mon Aug 02, 2010 11:30 pm

I keep being told if I use WPF to look into MVVM but when I do I get so lost and confused. Do you guys think for a beginner programmer it is worth tryign to wrap my brain around or wait until I get a bit more experience which will let me understand it better?

Can you expand these acronyms?

Also, I want to create an updater for one of my programs but since it is just a single executable I am not sure how to go about it other then have it create a temporary executable which runs and replaces the program. Any suggestions for this?

On most POSIX operating systems you can replace a file that is currently open (so your executable can overwrite itself just fine). Not sure if that works on Windows or not; it didn't *used* to (ever try overwriting a file in use?).
User avatar
Ella Loapaga
 
Posts: 3376
Joined: Fri Mar 09, 2007 2:45 pm

Post » Tue Aug 03, 2010 8:35 am

Can you expand these acronyms?

Windows Presentation Foundation and Model-View-ViewModel.

And no on Windows operating systems if a file is in use you cannot overwrite it.
User avatar
Kelvin Diaz
 
Posts: 3214
Joined: Mon May 14, 2007 5:16 pm

Post » Tue Aug 03, 2010 1:06 am

I'm afraid I don't know how to help you with those -- I've never done any Windows-specific programming.
User avatar
An Lor
 
Posts: 3439
Joined: Sun Feb 18, 2007 8:46 pm

Post » Tue Aug 03, 2010 3:36 am

Thats alright I seem to be so lost and can't find anythinggood to learn from so I am goign to wait until I learn a bit more and then go back and fix things.

Another thing I keep getting hung up on is icons for my applications. I know it is just for aesthetics and unnecessary but sometimes it would be niceto have one.
User avatar
Darlene Delk
 
Posts: 3413
Joined: Mon Aug 27, 2007 3:48 am

Post » Tue Aug 03, 2010 1:01 am

The Model View View Model is apparently a specialization of http://martinfowler.com/eaaDev/PresentationModel.html design pattern.
User avatar
BRIANNA
 
Posts: 3438
Joined: Thu Jan 11, 2007 7:51 pm

Post » Tue Aug 03, 2010 3:12 am

hi all, so Im very new to Java (all programming) and Im having a little trouble.

I've put together a little piece of code and I can compile it just fine. But when I go to run the class file I always get this error spit back at me.

Exception in thread "main" java.lang.NoClassDefFoundError:


my google search has shown me that this means that the jdk cant find my class file. I checked my classpath

C:\Program Files\Java\jre1.6.0_06\lib\ext\QTJava.zip;C:\Program Files\Java\jdk1.6.0_23\lib
(I also have a separate QTJAVA path, I dont know if I need it becuase its already in my classpath, but I havent touched it.)

ok, so I got to the point where I put my .java file in with my jdk lib and when I compiled it it ran.. it didnt function properly but it ran.

I tried putting my working dir in my classpath but that didnt work.

So can anyone help me figure out why my class files wont run in other directories?

running XP and just doing it all in notepad++.... thanks
User avatar
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm

Post » Tue Aug 03, 2010 11:44 am

What's the command you use to run the class?
User avatar
Ana Torrecilla Cabeza
 
Posts: 3427
Joined: Wed Jun 28, 2006 6:15 pm

Post » Tue Aug 03, 2010 3:10 am

*reads through thread* Oh my god.. I don't know what any of you are saying! *cries as his brain melts*
User avatar
Catherine N
 
Posts: 3407
Joined: Sat Jan 27, 2007 9:58 pm

Post » Tue Aug 03, 2010 12:26 pm

I type in "java className" in the dir that I compile my java file.
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Mon Aug 02, 2010 11:28 pm

Are you getting the case correct. There is a difference between ClassName and className
User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Mon Aug 02, 2010 11:10 pm

yeah, I renamed the java file and class just to make sure all that wasnt the cause.
User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Tue Aug 03, 2010 4:43 am

I think I have a problem!
I spend all day at work looking at and manipulating XML data.
I come home, start browsing forums and the first thread I go to is a Programming Thread!

:shakehead:
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Tue Aug 03, 2010 12:51 am

I think I have a problem!
I spend all day at work looking at and manipulating XML data.
I come home, start browsing forums and the first thread I go to is a Programming Thread!

:shakehead:

XML data is sometimes fun to look at and work with. I know I use it in almost all my programs for various things. Works well and avoids large databases or complication connections to them from within the program. Then again all my programs use very small amounts of data (largest XML file was about 30 records).
User avatar
Adam Kriner
 
Posts: 3448
Joined: Mon Aug 06, 2007 2:30 am

Post » Tue Aug 03, 2010 2:18 pm

update: I had to add ". ;" (current dir) to my classpath. Seems to be working now.

thanks for the effort. :)
User avatar
Music Show
 
Posts: 3512
Joined: Sun Sep 09, 2007 10:53 am

Post » Tue Aug 03, 2010 1:09 pm

Imports System.Net.MailModule Module1    Sub Main()        Try            Dim Server As New SmtpClient()            Dim Mail As New MailMessage()            Server.EnableSsl = True            Server.Credentials = New Net.NetworkCredential("account@gmail.com", "password")            Server.Port = 465            Server.Host = "smtp.gmail.com"            Console.WriteLine("Server info. . .")            Mail.To.Add(New System.Net.Mail.MailAddress("account@gmail.com"))            Mail.From = New System.Net.Mail.MailAddress("derp@derp.herp")            Mail.Subject = "this is a test email."            Mail.Body = "this is my test email body."            Console.WriteLine("Message info. . .")            Server.Send(Mail)            Console.WriteLine("Email sent. . .")            Console.ReadKey()        Catch ex As Exception            Console.WriteLine("Error. . . " + ex.Message)            Console.ReadKey()        End Try    End SubEnd Module


Simple email program to revive the thread. Wrote it in VB ( VS 2010 ).
User avatar
benjamin corsini
 
Posts: 3411
Joined: Tue Jul 31, 2007 11:32 pm

Post » Tue Aug 03, 2010 7:39 am

Not sure where to put this but...
I was thinking about setting up my own home server. My dads been challenging me to write a Silverlight application and to host it on a server. Not sure how exactly to do it though.

I have a computer that's just sitting around. What could I do with a home server though besides hosting a web app?

Sorry if none of this made sense. I'm just about to go to bed.
User avatar
nath
 
Posts: 3463
Joined: Mon Jan 22, 2007 5:34 am

Post » Mon Aug 02, 2010 11:11 pm

Not sure where to put this but...
I was thinking about setting up my own home server. My dads been challenging me to write a Silverlight application and to host it on a server. Not sure how exactly to do it though.

I have a computer that's just sitting around. What could I do with a home server though besides hosting a web app?

Sorry if none of this made sense. I'm just about to go to bed.

You can use it for media streaming to a home theater system, data backup, central storage, maskeshift home webserver, those would be what I can think of off the top of my head.
User avatar
Makenna Nomad
 
Posts: 3391
Joined: Tue Aug 29, 2006 10:05 pm

Post » Tue Aug 03, 2010 2:13 pm

So I wrote the following method to log data in my applications (I actually added it as a publicmethod to a class library I am creating for myself):
        static void WriteLog(string Information)        {            const string LogFileName = "applog.txt";            StreamWriter LogWriter = new StreamWriter(LogFileName, true);            try            {                using (LogWriter)                {                    LogWriter.WriteLine(DateTime.Now.ToString("yyyy/MM/dd") + " "                         + DateTime.Now.ToString("HH:mm:ss") + " "                         + Information);                }            }            catch (Exception ex)            {                LogWriter.WriteLine(ex.Message);            }        }


Ignore the fact it is static, I wrote it in the default class of a console application. Right now I have it writing the date and I am pretty sure, if I recall right, it writes the time in 24 hour format. So far this is the behavior I want, but I am not sure how to skip a line at the end and keep writing if the file exists orpush down all the data and write the newest data on top. This method currently just overwrites the log file each time which although this is fine for some applications, not the behavior I want.

Any advice on what to do to solve this issue? I was thinking of using File.Exists() and then run another method to add theblank line but I figure there might be a better way.
User avatar
CArlos BArrera
 
Posts: 3470
Joined: Wed Nov 21, 2007 3:26 am

Post » Tue Aug 03, 2010 4:15 am

Just thought I would share some news regarding the Android OS. http://mono-android.net/ is now in the works to allow .NET applications to run on the Android patform. This seems like it will be good for the community. I am wonderig though how many new developers it will bring since Windows Phone 7 probably is already written in a .NET language (not sure about this so I am guessing).
User avatar
Travis
 
Posts: 3456
Joined: Wed Oct 24, 2007 1:57 am

Post » Tue Aug 03, 2010 12:40 pm

This morning I figured out a way to create a random string of characters (but can be changed to include numbers and symbols) and was thinking of posting the tutorial online. I already submitted it to the DreamInCode website so hopefully it gets approved. But I was thinking of create a simple site to host tutorials as well, not only for C# but other languages as well. Would anyone be interested in working on this with me to expand it for other languages as well?
User avatar
Shianne Donato
 
Posts: 3422
Joined: Sat Aug 11, 2007 5:55 am

Post » Tue Aug 03, 2010 7:33 am

Not sure where to put this but...
I was thinking about setting up my own home server. My dads been challenging me to write a Silverlight application and to host it on a server. Not sure how exactly to do it though.

I have a computer that's just sitting around. What could I do with a home server though besides hosting a web app?

Sorry if none of this made sense. I'm just about to go to bed.

DarkOneVenzar gave a few suggestions; other things you might want to use it for are a web proxy (caching as well as blocking crud you don't want), an IMAP mail server, printer server, and if you're feeling really ambitious, an LDAP server (centralised address book and account management). Nice thing about servers is that they'll often run quite happily on old, crappy hardware and have reasonably low power consumption thanks to the fact that they don't need a lot of CPU power or a fancy graphics card so you can just leave them on permanently without worrying about hideous electricity bills. I'd strongly suggest using RAID of some sort for your storage array if you keep important stuff on it, though; mirroring is the easiest though the likes of RAID/Z2 that Sun's ZFS supports is good in terms of both efficiency and high reliability, although the latter generally requires a Unix of some description which you may or may not want to pursue.
User avatar
kiss my weasel
 
Posts: 3221
Joined: Tue Feb 20, 2007 9:08 am

Post » Tue Aug 03, 2010 3:28 pm

The computer I had as my server died this morning. It just wouldn't turn on. Which blows. But oh well. :shrug:
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Tue Aug 03, 2010 4:55 am

The computer I had as my server died this morning. It just wouldn't turn on. Which blows. But oh well. :shrug:

I suggest you fill it with dynamite to teach it a lesson. :hehe:
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

PreviousNext

Return to Othor Games