Search Results

Search found 25401 results on 1017 pages for 'adobe partner program'.

Page 101/1017 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • Improving my first Clojure program

    - by StackedCrooked
    After a few weekends exploring Clojure I came up with this program. It allows you to move a little rectangle in a window. Here's the code: (import java.awt.Color) (import java.awt.Dimension) (import java.awt.event.KeyListener) (import javax.swing.JFrame) (import javax.swing.JPanel) (def x (ref 0)) (def y (ref 0)) (def panel (proxy [JPanel KeyListener] [] (getPreferredSize [] (Dimension. 100 100)) (keyPressed [e] (let [keyCode (.getKeyCode e)] (if (== 37 keyCode) (dosync (alter x dec)) (if (== 38 keyCode) (dosync (alter y dec)) (if (== 39 keyCode) (dosync (alter x inc)) (if (== 40 keyCode) (dosync (alter y inc)) (println keyCode))))))) (keyReleased [e]) (keyTyped [e]))) (doto panel (.setFocusable true) (.addKeyListener panel)) (def frame (JFrame. "Test")) (doto frame (.add panel) (.pack) (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) (.setVisible true)) (defn drawRectangle [p] (doto (.getGraphics p) (.setColor (java.awt.Color/WHITE)) (.fillRect 0 0 100 100) (.setColor (java.awt.Color/BLUE)) (.fillRect (* 10 (deref x)) (* 10 (deref y)) 10 10))) (loop [] (drawRectangle panel) (Thread/sleep 10) (recur)) Despite being an experienced C++ programmer I found it very challenging to write even a simple application in a language that uses a radically different style than what I'm used to. On top of that, this code probably sucks. I suspect the globalness of the various values is a bad thing. It's also not clear to me if it's appropriate to use references here for the x and y values. Any hints for improving this code are welcome.

    Read the article

  • Help me with the simplest program for "Trusted" application

    - by idazuwaika
    Hi, I hope anyone from the large community here can help me write the simplest "Trusted" program that I can expand from. I'm using Ubuntu Linux 9.04, with TPM emulator 0.60 from Mario Strasser (http://tpm-emulator.berlios.de/). I have installed the emulator and Trousers, and can successfully run programs from tpm-tools after running tpmd and tcsd daemons. I hope to start developing my application, but I have problems compiling the code below. #include <trousers/tss.h> #include <trousers/trousers.h> #include <stdio.h> TSS_HCONTEXT hContext; int main() { Tspi_Context_Create(&hContext); Tspi_Context_Close(hContext); return 0; } After trying to compile with g++ tpm.cpp -o tpmexe I receive errors undefined reference to 'Tspi_Context_Create' undefined reference to 'Tspi_Context_Close' What do I have to #include to successfully compile this? Is there anything that I miss? I'm familiar with C, but not exactly so with Linux/Unix programming environment. ps: I am a part time student in Master in Information Security programme. My involvement with programming has been largely for academic purposes.

    Read the article

  • Files under Program Files have a split personality

    - by regularfry
    I have a Ruby application I'm installing (along with a packaged ruby interpreter) under Program Files on Windows 7 with an NSIS-built installer. In order to debug it, I edited one of the files to add some debugging statements. After that, I uninstalled the package and ran a new version of the installer which includes a new copy of the edited file, without debugging statements. Now, I can't get the new copy to load into ruby. If I run type <filename> in cmd.exe, or open the file in Notepad.exe or Firefox, I see the new version. If I run ruby -e "puts File.read('<filename>')", or open the file in emacs, I see the old version. If, in Windows Explorer, I copy the file to a new filename, everything can see the new contents at that filename. If I delete the original file and rename the copy to replace the original, the split personality returns. This situation survives a reboot, so it's not a simple matter of a file being accidentally held open. What on earth is going on here? Is there some aspect of the install process that might be checkpointing the file in a way I can revert, or at least switch off while I'm debugging the installer?

    Read the article

  • Kernighan & Ritchie word count example program in a functional language

    - by Frank
    I have been reading a little bit about functional programming on the web lately and I think I got a basic idea about the concepts behind it. I'm curious how everyday programming problems which involve some kind of state are solved in a pure functional programing language. For example: how would the word count program from the book 'The C programming Language' be implemented in a pure functional language? Any contributions are welcome as long as the solution is in a pure functional style. Here's the word count C code from the book: #include <stdio.h> #define IN 1 /* inside a word */ #define OUT 0 /* outside a word */ /* count lines, words, and characters in input */ main() { int c, nl, nw, nc, state; state = OUT; nl = nw = nc = 0; while ((c = getchar()) != EOF) { ++nc; if (c == '\n') ++nl; if (c == ' ' || c == '\n' || c = '\t') state = OUT; else if (state == OUT) { state = IN; ++nw; } } printf("%d %d %d\n", nl, nw, nc); }

    Read the article

  • Perl program for extracting the functions alone in a Ruby file

    - by thillaiselvan
    Hai all, I am having the following Ruby program. puts "hai" def mult(a,b) a * b end puts "hello" def getCostAndMpg cost = 30000 # some fancy db calls go here mpg = 30 return cost,mpg end AltimaCost, AltimaMpg = getCostAndMpg puts "AltimaCost = #{AltimaCost}, AltimaMpg = {AltimaMpg}" I have written a perl script which will extract the functions alone in a Ruby file as follows while (<DATA>){ print if ( /def/ .. /end/ ); } Here the <DATA> is reading from the ruby file. So perl prograam produces the following output. def mult(a,b) a * b end def getCostAndMpg cost = 30000 # some fancy db calls go here mpg = 30 return cost,mpg end But, if the function is having block of statements, say for example it is having an if condition testing block means then it is not working. It is taking only up to the "end" of "if" block. And it is not taking up to the "end" of the function. So kindly provide solutions for me. Example: def function if x > 2 puts "x is greater than 2" elsif x <= 2 and x!=0 puts "x is 1" else puts "I can't guess the number" end #----- My code parsing only up to this end Thanks in Advance!

    Read the article

  • Logic for family tree program

    - by david robers
    Hi All, I am creating a family tree program in Java, or at least trying to. I have developed several classes: Person - getters and setter for name gender age etc FamilyMember - extends Person getters and setters for setting arents and children Family - which consists of multiple family members and methods for adding removing members FamilyTree which is the main class for setting relationships. I have two main problems: 1) I need to set the relationships between people. Currently I am doing: FamilyMember A, FamilyMember B B.setMother(A); A.setChild(B); The example above is for setting a mother child relationship. This seems very clunky. Its getting very long winded to implement all relationships. Any ideas on how to implement multiple relationships in a less prodcedural way? 2) I have to be able to display the family tree. How can I do this? Are there any custom classes out there to make life easier? Thanks for your time...

    Read the article

  • net send command program debugging in C#

    - by riad
    Dear all, I write a program to execute and send msg using windows net send command.Its working fine for single receptor.But the problem happen when i want to send message in many receptors. i use a for loop to take receptor name from a list box. Here all message go to the first receptor.The problem happen on process execution.So far i guess the process is not clear or dead on the time. Can any body guide me how i can send the msg to multiple users at a time? my code below: string sendingMessage = messageRichTextBox.Text; string[] recepentAddressArray = new string[recepentAddressListBox.Items.Count]; for (int j = 0; j < recepentAddressListBox.Items.Count; j++) // Getting address from list box { recepentAddressArray[j] = recepentAddressListBox.Items[j].ToString(); string recepantAddress = recepentAddressArray[j]; try { string strLine = "net send " + recepantAddress + " " + sendingMessage + " >C:netsend.log"; FileStream fs = new FileStream("c:netsend.bat", FileMode.Create, FileAccess.Write); StreamWriter streamWriter = new StreamWriter(fs); streamWriter.BaseStream.Seek(0, SeekOrigin.End); streamWriter.Write(strLine); streamWriter.Flush(); streamWriter.Close(); fs.Close(); Process p = new Process(); p.StartInfo.FileName = "C:netsend.bat"; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.Start(); p.WaitForExit(); p.Close(); FileStream fsOutput = new FileStream("C:netsend.log", FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(fsOutput); reader.BaseStream.Seek(0, SeekOrigin.Begin); string strOut = reader.ReadLine(); reader.Close(); fsOutput.Close(); } catch (Exception) { MessageBox.Show("ERROR"); } }

    Read the article

  • system out output for double numbers in a java program

    - by Nikunj Chauhan
    I have a program where I am generating two double numbers by adding several input prices from a file based on a condition. String str; double one = 0.00; double two = 0.00; BufferedReader in = new BufferedReader(new FileReader(myFile)); while((str = in.readLine()) != null){ if(str.charAt(21) == '1'){ one += Double.parseDouble(str.substring(38, 49) + "." + str.substring(49, 51)); } else{ two += Double.parseDouble(str.substring(38, 49) + "." + str.substring(49, 51)); } } in.close(); System.out.println("One: " + one); System.out.println("Two: " + two); The output is like: One: 2773554.02 Two: 6.302505836000001E7 Question: None of the input have more then two decimals in them. The way one and two are getting calculated exactly same. Then why the output format is like this. What I am expecting is: One: 2773554.02 Two: 63025058.36 Why the printing is in two different formats ? I want to write the outputs again to a file and thus there must be only two digits after decimal.

    Read the article

  • program won't find math.h anymore

    - by 130490868091234
    After a long time, I downloaded a program I co-developed and tried to recompile it on my Ubuntu Linux 12.04, but it seems it does not find math.h anymore. This may be because something has changed recently in gcc, but I can't figure out if it's something wrong in src/Makefile.am or a missing dependency: Download from http://www.ub.edu/softevol/variscan/: tar xzf variscan-2.0.2.tar.gz cd variscan-2.0.2/ make distclean sh ./autogen.sh make I get: [...] gcc -DNDEBUG -O3 -W -Wall -ansi -pedantic -lm -o variscan variscan.o statistics.o common.o linefile.o memalloc.o dlist.o errabort.o dystring.o intExp.o kxTok.o pop.o window.o free.o output.o readphylip.o readaxt.o readmga.o readmaf.o readhapmap.o readxmfa.o readmav.o ran1.o swcolumn.o swnet.o swpoly.o swref.o statistics.o: In function `calculate_Fu_and_Li_D': statistics.c:(.text+0x497): undefined reference to `sqrt' statistics.o: In function `calculate_Fu_and_Li_F': statistics.c:(.text+0x569): undefined reference to `sqrt' statistics.o: In function `calculate_Fu_and_Li_D_star': statistics.c:(.text+0x63b): undefined reference to `sqrt' statistics.o: In function `calculate_Fu_and_Li_F_star': statistics.c:(.text+0x75c): undefined reference to `sqrt' statistics.o: In function `calculate_Tajima_D': statistics.c:(.text+0x85d): undefined reference to `sqrt' statistics.o:statistics.c:(.text+0xcb1): more undefined references to `sqrt' follow statistics.o: In function `calcRunMode21Stats': statistics.c:(.text+0xe02): undefined reference to `log' statistics.o: In function `correctedDivergence': statistics.c:(.text+0xe5a): undefined reference to `log' statistics.o: In function `calcRunMode22Stats': statistics.c:(.text+0x104a): undefined reference to `sqrt' statistics.o: In function `calculate_Fu_fs': statistics.c:(.text+0x11a8): undefined reference to `fabsl' statistics.c:(.text+0x11ca): undefined reference to `powl' statistics.c:(.text+0x11f2): undefined reference to `logl' statistics.o: In function `calculateStatistics': statistics.c:(.text+0x13f2): undefined reference to `log' collect2: ld returned 1 exit status make[1]: *** [variscan] Error 1 make[1]: Leaving directory `/home/avilella/variscan/latest/variscan-2.0.2/src' make: *** [all-recursive] Error 1 The libraries are there because this simple example works perfectly well: $ gcc test.c -o test -lm $ cat test.c #include <stdio.h> #include <math.h> int main(void) { double x = 0.5; double result = sqrt(x); printf("The hyperbolic cosine of %lf is %lf\n", x, result); return 0; } Any ideas?

    Read the article

  • Boost Date_Time problem compiling a simple program

    - by Andry
    Hello! I'm writing a very stupid program using Boost Date_Time library. int main(int srgc, char** argv) { using namespace boost::posix_time; date d(2002,Feb,1); //an arbitrary date ptime t1(d, hours(5)+nanosec(100)); //date + time of day offset ptime t2 = t1 - minutes(4)+seconds(2); ptime now = second_clock::local_time(); //use the clock date today = now.date(); //Get the date part out of the time } Well I cannot compile it, compiler does not recognize a type... Well I used many features of Boost libs like serialization and more... I correctly built them and, looking in my /usr/local/lib folder I can see that libboost_date_time.so is there (a good sign which means I was able to build that library) When I compile I write the following: g++ -lboost_date_time main.cpp But the errors it showed me when I specify the lib are the same of those ones where I do not specify any lib. What is this? Anyone knows? The error is main.cpp: In function ‘int main(int, char**)’: main.cpp:9: error: ‘date’ was not declared in this scope main.cpp:9: error: expected ‘;’ before ‘d’ main.cpp:10: error: ‘d’ was not declared in this scope main.cpp:10: error: ‘nanosec’ was not declared in this scope main.cpp:13: error: expected ‘;’ before ‘today’

    Read the article

  • Program to find the result of primitive recursive functions

    - by alphomega
    I'm writing a program to solve the result of primitive recursive functions: 1 --Basic functions------------------------------ 2 3 --Zero function 4 z :: Int -> Int 5 z = \_ -> 0 6 7 --Successor function 8 s :: Int -> Int 9 s = \x -> (x + 1) 10 11 --Identity/Projection function generator 12 idnm :: Int -> Int -> ([Int] -> Int) 13 idnm n m = \(x:xs) -> ((x:xs) !! (m-1)) 14 15 --Constructors-------------------------------- 16 17 --Composition constructor 18 cn :: ([Int] -> Int) -> [([Int] -> Int)] -> ([Int] -> Int) 19 cn f [] = \(x:xs) -> f 20 cn f (g:gs) = \(x:xs) -> (cn (f (g (x:xs))) gs) these functions and constructors are defined here: http://en.wikipedia.org/wiki/Primitive_recursive_function The issue is with my attempt to create the compositon constructor, cn. When it gets to the base case, f is no longer a partial application, but a result of the function. Yet the function expects a function as the first argument. How can I deal with this problem? Thanks.

    Read the article

  • Compiling a Windows C++ program in g++

    - by Phenom
    I'm trying to compile a Windows C++ program in g++. This is what I get. /usr/include/c++/4.4/backward/backward_warning.h:28:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. btree.cpp:1204: error: ‘_TCHAR’ has not been declared btree.cpp: In function ‘int _tmain(int, int**)’: btree.cpp:1218: error: ‘__int64’ was not declared in this scope btree.cpp:1218: error: expected ‘;’ before ‘frequency’ btree.cpp:1220: error: ‘LARGE_INTEGER’ was not declared in this scope btree.cpp:1220: error: expected primary-expression before ‘)’ token btree.cpp:1220: error: ‘frequency’ was not declared in this scope btree.cpp:1220: error: ‘QueryPerformanceFrequency’ was not declared in this scope btree.cpp:1262: error: expected primary-expression before ‘)’ token btree.cpp:1262: error: ‘start’ was not declared in this scope btree.cpp:1262: error: ‘QueryPerformanceCounter’ was not declared in this scope btree.cpp:1264: error: name lookup of ‘i’ changed for ISO ‘for’ scoping btree.cpp:1264: note: (if you use ‘-fpermissive’ G++ will accept your code) btree.cpp:1304: error: expected primary-expression before ‘)’ token btree.cpp:1304: error: ‘end’ was not declared in this scope btree.cpp:1306: error: ‘total’ was not declared in this scope btree.cpp:1316: error: ‘getchar’ was not declared in this scope The first thing I noticed is that there are these variable types called _TCHAR, _int64, and LARGE_INTEGER, which is probably a Windows thing. What can these be changed to so that they will work in g++? Also, if there's anything else in here that you know can be converted to g++, that would be helpful. I got the code from here: http://touc.org/btree.html

    Read the article

  • Strange problem with simple multithreading program in Java

    - by Elizabeth
    Hello, I am just starting play with multithreading programming. I would like to my program show alternately character '-' and '+' but it doesn't. My task is to use synchronized keyword. As far I have: class FunnyStringGenerator{ private char c; public FunnyStringGenerator(){ c = '-'; } public synchronized char next(){ if(c == '-'){ c = '+'; } else{ c = '-'; } return c; } } class ThreadToGenerateStr implements Runnable{ FunnyStringGenerator gen; public ThreadToGenerateStr(FunnyStringGenerator fsg){ gen = fsg; } @Override public void run() { for(int i = 0; i < 10; i++){ System.out.print(gen.next()); } } } public class Main{ public static void main(String[] args) throws IOException { FunnyStringGenerator FSG = new FunnyStringGenerator(); ExecutorService exec = Executors.newCachedThreadPool(); for(int i = 0; i < 20; i++){ exec.execute(new ThreadToGenerateStr(FSG)); } } } EDIT: I also testing Thread.sleep in run method instead for loop.

    Read the article

  • How to refresh/redraw the screen (not the program window)

    - by mohrphium
    I'm having a bit of a hard time figuring out, how to remove a drawn ellipse after it has been drawn somewhere else. I need a circle to follow my mouse all the time and this is all the program should do. I get the mousepositions and draw my circle but how can I remove the last one? #include <Windows.h> #include <iostream> void drawRect(int a1, int a2){ HDC screenDC = ::GetDC(0); //Draw circle at mouse position ::Ellipse(screenDC, a1, a2+5, a1+9, a2+14); ::ReleaseDC(0, screenDC); //::InvalidateRect(0, NULL, TRUE); //<- I tried that but then everything flickers //Also, the refresh rate is not fast enough... still some circles left } int main(void) { int a1; int a2; bool exit=false; while (exit!=true) { POINT cursorPos; GetCursorPos(&cursorPos); float x = 0; x = cursorPos.x; float y = 0; y = cursorPos.y; a1=(int)cursorPos.x; a2=(int)cursorPos.y; drawRect(a1, a2); } } I am working with graphics and all that stuff for the first time. Im kinda stuck here... once again. Thanks.

    Read the article

  • Deployment a web-site on IIS from another program

    - by slo2ols
    Hi, I developed a web-site on ASP.NET 3.5 SP1 platform. And additional I have 2 win services. My task is to build install package. I decided that Visual Studio install projects are not met my requirements. I design my own installer for this project, because I need to resolve many question and problem in install process. My problem: I need to deploy web-site into IIS, but I don't know how to do it easy. I found Microsoft tool as Web Deployment Tool, but I didn't find any documentation. And must I include this tool into my installer for deployment at destination customer? Another side I found SDC Tasks Library and it looks like a solution for me. But I saw many topics where people had problems and because the project was dead anybody couldn't help them. I know it is a long story... My question: how can I deploy the web-site from another program (I know that IIS versions have some differences and it is another headache), set a virtual directory, application pool (very important), a type of authentification and so forth ??? Thanks.

    Read the article

  • Why this C# Regular Expression crashes my program?

    - by robert_d
    using System; using System.IO; using System.Net; using System.Text.RegularExpressions; namespace Working { class Program4 { static string errorurl = "http://www.realtor.ca/propertyDetails.aspx?propertyId=8692663"; static void Main(string[] args) { string s; s = getWebpageContent(errorurl); s = removeNewLineCharacters(s); getFields(s); Console.WriteLine("End"); } public static void getFields(string html) { Match m; string fsRE = @"ismeasurement.*?>.*?(\d+).*?sqft"; m = Regex.Match(html, fsRE, RegexOptions.IgnoreCase); } private static string removeNewLineCharacters(string str) { string[] charsToRemove = new string[] { "\n", "\r" }; foreach (string c in charsToRemove) { str = str.Replace(c, ""); } return str; } static string getWebpageContent(string url) { WebClient client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); Stream data = client.OpenRead(url); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); return s; } } } This program hangs. It runs correctly when I remove RegexOptions.IgnoreCase option or when I remove call to removeNewLineCharacters() function. Could someone tell me what is going on, please?

    Read the article

  • Issue with Running Android Program on Eclipse

    - by Hossein Mobasher
    I downloaded complete Android Environment Development Environment Snapshots from marakana.com. I start eclipse and create new Android project. On the Run Configurations, i created New Configuration to run the application, and set the Target to Automatic and select the AVD that appropriate to run the application. But, when i click on the run icon, it starts the new emulator, and after some minutes, just android emulator be ran and my application doesn't run on it. What do i do to solve the running problem and run my project on emulator ? NOTE 1: Console outputs : [2012-03-07 16:03:49 - New] ------------------------------ [2012-03-07 16:03:49 - New] Android Launch! [2012-03-07 16:03:49 - New] adb is running normally. [2012-03-07 16:03:49 - New] Performing com.android.example.NewActivity activity launch [2012-03-07 16:03:53 - New] Launching a new emulator with Virtual Device 'Device' [2012-03-07 16:04:00 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error NOTE 2: My Program Source: package com.android.example; import android.app.Activity; import android.os.Bundle; public class NewActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } Thanks for your attention :)

    Read the article

  • C++ program crashes at runtime

    - by qwerty
    Hello, I have this simple c++ program #include <cstdlib> #include <iostream> #include <math.h> #include <stdlib.h> #include <time.h> #include <vector> using namespace std; int aleator(int n) { return (rand()%n)+1; } int main() { int r; int indexes[100]={0}; // const int size=100; //int a[size]; std::vector<int>v; srand(time(0)); for (int i=0;i<25;i++) { int index = aleator(100); if (indexes[index] != 0) { // try again i--; continue; } indexes[index] = 1; cout << v[index] ; } cout<<" "<<endl; system("pause"); return 0; } But at runtime it crashes, so i got that error with 'Send error report' and 'Don't send'. What i'm doing wrong? Thanks!

    Read the article

  • Body Mass Index program in haskell

    - by user364996
    Hi there. I'm trying to write a simple program in Haskell that can determine someone's body mass index. Here's what I have written: type Height = Float type Weight = Float type PeopleStats = [(String, Height, Weight)] and... bmi :: Height -> Weight -> Float bmi heightCm weightKg = weightKg/(heightCm)^2 healthy :: Height -> Weight -> Bool healthy heightCm weightKg | 25 > index && 18 < index = True | otherwise = False where index = bmi heightCm weightKg So far, the function "healthy" can calculate someone's BMI, and the function "healthyPeople" returns a boolean statement determining if the person's BMI falls within the limits which is considered normal for a healthy person. I want to write a function called "healthyPeople". healthyPeople :: PeopleStats -> [String] This function needs to take a list of PeopleStats and returns a list of names (Strings) of people who are deemed to be "healthy" from the "healthy" function. For example: If I input [("Lee", 65, 185), ("Wang", 170, 100), ("Tsu", 160, 120)] I will get a list of the names of the people whose BMI returns true form the boolean function in "healthy". Please help !!!!

    Read the article

  • GUI for server-client program

    - by sksingh73
    I am making a server-client application in c++. In this i am also using shared memory & file read-write operations. my program is completely ready & i now wants to make a gui for it. someone suggested me to go for QT4, but when i tried it, i found i have to re-write 80% of the code because QT has got its own classes & variable. i don't want to do it. i want suggestions from you on this regard. my requirements for gui are very simple i.e there will be a main form, which will have two text boxes in which all messages being sent & received by client & server should be shown. there should be another lineedit box, through which i can send the messages to the other end server. I don't know how to make this gui. someone suggested tcl/tk, other suggested me use php/swig. i am not sure how to go about this. my only requirement is that i want to make this simple gui with minimum of changes in my code. THANX

    Read the article

  • Java program using a class from a JAR file

    - by Myn
    Hi guys, I'll try to phrase this as best I can. I have a program which has an API-like functionality - it uses reflection to dynamically call methods from within a class. In this instance: Server.java public static void main(String[] args) { Class<?> clazz = Class.forName("DiHandler"); StHandler out = (StHandler) clazz; out.read(); DiHandler.java // implements StHandler import edu.ds.*; public void read() { Ds aType = new Ds(); aType = "134"; } So DiHandler has a method read() which can contain anything, it doesn't matter to Server.java after compile time. My problem is: DiHandler.java uses the class Ds from a JAR file. When I'm working on DiHandler.java in Eclipse (in a separate project from the project Server.java is in) I can add this JAR without a problem. But when I move DiHandler.class, after it's compiled, to be used by Server.class, how can it still use the JAR file? I hope this makes some sense, I suppose another way to phrase it would be how can I allow DiHandler to call on a class from the JAR without editing the classpath? Thanks very much in advance and sorry for any confusion or poor phrasing, I can only offer thanks and the customary offer of a pint for any assistance. M

    Read the article

  • Fire Box doesnot support program based calling function

    - by manish
    on clicking any row of the following program... i am firinf on function mail file click....function just having alert message that shoes deffrent file name on the bases of clicking... *its working properly in IE .....FireBox N other browser function doesnot call on clicking on any row.. whats problem..please help me......i am writing code for your better awareness* For Each info In fsi Response.Write("<span id=" & " 'userijd'" & " onmouseup=" & "mailfileclick('" & info.Name & "')" & ";>") Response.Write("<td width=" & "16%" & " bgcolor=" & "#FFFFFF" & " style=" & "border-bottom-style:&nbsp;solid;&nbsp;border-bottom-width:&nbsp;1px" & " bordercolor=" & "#C0C0C0" & " nowrap" & ">") Response.Write("<font face=" & "Arial" & "style=" & "font-size:&nbsp;9pt" & " color=" & "#000000" & ">" & Mid(contents, InStr(contents, "Date: ") + Len("Date:"), 17) & "</font></td>") Response.Write("</span>") Next

    Read the article

  • AttributeError in my Python program regarding classes

    - by Axel Finkel
    I'm doing an exercise out of the Python book that involves creating a class and a subclass. I am getting the following error when I try to run the program: AttributeError: 'Customer' object has no attribute 'name', when it tries to go through this bit of code: self.name.append(name) As this is my first time dealing with classes and objects in Python, I'm sure I am making some overt mistake somewhere, but I can't seem to figure it out. I've looked over the documentation for creating classes and writing member functions, and it looks correct, but it is obviously not. I want the Customer subclass to inherit the name, address, and telephone attributes from the Person superclass, but it doesn't seem to be doing so? Here is my code: class Person: def __init__(self): self.name = None self.address = None self.telephone = None def changeName(self, name): self.name.append(name) def changeAddress(self, address): self.address.append(address) def changeTelephone(self, telephone): self.telephone.append(telephone) class Customer(Person): def __init__(self): self.customerNumber = None self.onMailingList = False def changeCustomerNumber(self, customerNumber): self.customerNumber.append(customerNumber) def changeOnMailingList(): if onMailingList == False: onMailingList == True else: onMailingList == False def main(): customer1 = Customer() name = 'Bob Smith' address = '123 Somewhere Road' telephone = '111 222 3333' customerNumber = '12345' customer1.changeName(name) customer1.changeAddress(address) customer1.changeTelephone(telephone) customer1.changeCustomerNumber(customerNumber) print("Customer name: " + customer1.name) print("Customer address: " + customer1.address) print("Customer telephone number: " + customer1.telephone) print("Customer number: " + customer1.customerNumber) print("On mailing list: " + customer1.OnMailingList) customer1.changeOnMailingList() print("On mailing list: " + customer1.OnMailingList) main()

    Read the article

  • Java program will read from database, but not write to it

    - by ck1221
    I have a Java program that successfully connects to a mysql database that is hosted on godaddy's server. I can read from that db with out issue, however, when I try to write to it with INSERT or UPDATE for example, the query does not execute. I am using the 'admin' account that I set up through godaddy, I realize this is not the root account. I have checked and verified that the connection is not read only, and have logged out of phpmyadmin while the query ran. I'm not sure what else I can try or if anyone has experienced this issue. Maybe a setting to the connection I have failed to set? Or maybe its not possible since the db is hosted on godaddy's servers? Any help is great! Thanks. Here is some relevant code: Connection to db: Connection con; public DBconnection(String url, String user, String pass) { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection (url,user,pass); if(!con.isClosed()) System.out.println("connecton open"); } catch (InstantiationException e) {e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();} catch (SQLException e) {e.printStackTrace();} } Send Query: public ResultSet executeQuery(String query) { ResultSet rs = null; try { Statement stmt = (Statement) con.createStatement(); rs = stmt.executeQuery(query); //while(rs.next()) //System.out.println(rs.getString("ticket_num")); } catch (SQLException e) {} return rs; } Insert Query (works in phpmyadmin): conn.executeQuery("INSERT INTO tickets VALUES(55555,'12/01/2012','me','reports','test','','','0','Nope')");

    Read the article

  • Importing a C DLL's functions into a C++ program

    - by bobobobo
    I have a 3rd party library that's written in C. It exports all of its functions to a DLL. I have the .h file, and I'm trying to load the DLL from my C++ program. The first thing I tried was surrounding the parts where I #include the 3rd party lib in #ifdef __cplusplus extern "C" { #endif and, at the end #ifdef __cplusplus } // extern "C" #endif But the problem there was, all of the DLL file function linkage looked like this in their header files: a_function = (void *)GetProcAddress(dll, "a_function"); While really a_function had type int (*a_function) (int *). Apparently MSVC++ compiler doesn't like this, while MSVC compiler does not seem to mind. So I went through (brutal torture) and fixed them all to the pattern typedef int (*_a_function) (int *); _a_function a_function ; Then, to link it to the DLL code, in main(): a_function = (_a_function)GetProcAddress(dll, "a_function"); This SEEMS to make the compiler MUCH, MUCH happier, but it STILL complains with this final set of 143 errors, each saying for each of the DLL link attempts: error LNK2005: _a_function already defined in main.obj main.obj Multiple symbol definition errors.. sounds like a job for extern! SO I went and made ALL the function pointer declarations as follows: function_pointers.h typedef int (*_a_function) (int *); extern _a_function a_function ; And in a cpp file: function_pointers.cpp #include "function_pointers.h" _a_function a_function ; ALL fine and dandy.. except for linker errors now of the form: error LNK2001: unresolved external symbol _a_function main.obj Main.cpp includes "function_pointers.h", so it should know where to find each of the functions.. I am bamboozled. Does any one have any pointers to get me functional? (Pardon the pun..)

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >