Search Results

Search found 31491 results on 1260 pages for 'simple talk'.

Page 60/1260 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • EJB 3 Session Bean Design for Simple CRUD

    - by sdoca
    I am writing an application that's sole purpose in life is to do CRUD operations for maintaining records in database. There are relationships between some of the tables/entities. Most examples I've seen for creating session beans deals with complex business logic/operations that interact with many entities which I don't have. Since my application is so very basic, what would be the best design for the session bean(s)? I was thinking of having one session bean per entity which had CRUD the methods defined. Then I thought of combining all of those session beans into a single session bean. And then I found this blog entry which is intriguing, but I must admit I don't understand all of it (what is a ServiceFacade?). I'm leaning towards session bean/entity class, but would like to hear more experienced opinions. Thanks.

    Read the article

  • Understanding CSRF - Simple Question

    - by byronh
    I know this might make me seem like an idiot, I've read everything there is to read about CSRF and I still don't understand how using a 'challenge token' would add any sort of prevention. Please help me clarify the basic concept, none of the articles and posts here on SO I read seemed to really explicitly state what value you're comparing with what. From OWASP: In general, developers need only generate this token once for the current session. After initial generation of this token, the value is stored in the session and is utilized for each subsequent request until the session expires. If I understand the process correctly, this is what happens. I log in at http://example.com and a session/cookie is created containing this random token. Then, every form includes a hidden input also containing this random value from the session which is compared with the session/cookie upon form submission. But what does that accomplish? Aren't you just taking session data, putting it in the page, and then comparing it with the exact same session data? Seems like circular reasoning. These articles keep talking about following the "same-origin policy" but that makes no sense, because all CSRF attacks ARE of the same origin as the user, just tricking the user into doing actions he/she didn't intend. Is there any alternative other than appending the token to every single URL as a query string? Seems very ugly and impractical, and makes bookmarking harder for the user.

    Read the article

  • google map V-3 simple problem with latlng

    - by amar
    hi, i was using v2 of google maps. Now i shifted to v3. In version 2, this WAS working GEvent.addListener(map, "click", function(overlay, latlng) { myLatitude = latlng.lat(); myLongitude = latlng.lng(); alert(myLatitude + ' data ' + myLongitude); }); what should be the equvalant of this code in v3 ?? i searched a lot, but couldn't find any good result.. I have tried this.. google.maps.event.addListener(map, 'click', function(overlay , latlng) { myLatitude = latlng.lat(); //myLongitude = latlng.lng(); alert('hi! ' + myLatitude); }); but no results.. thanks

    Read the article

  • linker error in simple program: multiple definition of function

    - by BillyJean
    My function test is added to two different .cpp-files and the functions are private to their respective files as shown below test1.cpp #include <iostream> using namespace std; void test() { cout << "test" << endl; } test2.cpp #include <iostream> using namespace std; void test() { cout << "test" << endl; } main.cpp #include <iostream> using namespace std; int main() { return 0; } During linking I get the error multiple definition of test() - but how is that possible, considering that the two files have their own private scope!? I could understand it if I included the function prototype in each .cpp-files' corresponding header, but there is no such thing in this example.

    Read the article

  • Java Simple Calculator

    - by Lahiru Kavinda
    I have made this calculator program in Java. This works well only when two numbers are calculated at one time. That means to get the sum of 1+2+3 you have to go this way : press 1 press + press 2 press = press + press 3 press = and it calculates it as 6. But I want to program this so that I can get the answer by: press 1 press + press 2 press + press 3 press = but this gives the answer 5!!! How to code this so that it works like an ordinary calculator? Here is my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class cal1 extends JFrame { double op1 = 0d, op2 = 0d; double result = 0d; char action; boolean b = false; boolean pressequal = false; public cal1() { makeUI(); } private void makeUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 400); b0 = new JButton("0"); b1 = new JButton("1"); b2 = new JButton("2"); b3 = new JButton("3"); b4 = new JButton("4"); b5 = new JButton("5"); b6 = new JButton("6"); b7 = new JButton("7"); b8 = new JButton("8"); b9 = new JButton("9"); bDot = new JButton("."); bMul = new JButton("*"); bDiv = new JButton("/"); bPlus = new JButton("+"); bMinus = new JButton("-"); bEq = new JButton("="); t = new JTextField(12); t.setFont(new Font("Tahoma", Font.PLAIN, 24)); t.setHorizontalAlignment(JTextField.RIGHT); numpad = new JPanel(); display = new JPanel(); numpad.add(b7); numpad.add(b8); numpad.add(b9); numpad.add(bMul); numpad.add(b4); numpad.add(b5); numpad.add(b6); numpad.add(bDiv); numpad.add(b1); numpad.add(b2); numpad.add(b3); numpad.add(bMinus); numpad.add(bDot); numpad.add(b0); numpad.add(bEq); numpad.add(bPlus); numpad.setLayout(new GridLayout(4, 5, 5, 4)); display.add(t); add(display, BorderLayout.NORTH); add(numpad, BorderLayout.CENTER); t.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { typeOnt(e); } }); b0.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b0pressed(e); } }); b1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b1pressed(e); } }); b2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b2pressed(e); } }); b3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b3pressed(e); } }); b4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b4pressed(e); } }); b5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b5pressed(e); } }); b6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b6pressed(e); } }); b7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b7pressed(e); } }); b8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b8pressed(e); } }); b9.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b9pressed(e); } }); bDot.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bDotpressed(e); } }); bPlus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bPlusPressed(e); } }); bMinus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bMinusPressed(e); } }); bMul.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bMulPressed(e); } }); bDiv.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bDivPressed(e); } }); bEq.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { bEqpressed(e); } }); } void typeOnt(KeyEvent e) { e.consume(); } void b0pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "0"); } else { t.setText(t.getText() + "0"); } } void b1pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "1"); } else { t.setText(t.getText() + "1"); } } void b2pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "2"); } else { t.setText(t.getText() + "2"); } } void b3pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "3"); } else { t.setText(t.getText() + "3"); } } void b4pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "4"); } else { t.setText(t.getText() + "4"); } } void b5pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "5"); } else { t.setText(t.getText() + "5"); } } void b6pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "6"); } else { t.setText(t.getText() + "6"); } } void b7pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "7"); } else { t.setText(t.getText() + "7"); } } void b8pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "8"); } else { t.setText(t.getText() + "8"); } } void b9pressed(ActionEvent e) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "9"); } else { t.setText(t.getText() + "9"); } } void bDotpressed(ActionEvent e) { if (!t.getText().contains(".")) { if (b) { t.setText(null); b = false; t.setText(t.getText() + "0."); } else if (t.getText().isEmpty()) { t.setText("0."); } else { t.setText(t.getText() + "."); } } } void bPlusPressed(ActionEvent e) { b = true; action = '+'; op1 = Double.parseDouble(t.getText()); } void bMinusPressed(ActionEvent e) { b = true; action = '-'; op1 = Double.parseDouble(t.getText()); } void bMulPressed(ActionEvent e) { b = true; action = '*'; op1 = Double.parseDouble(t.getText()); } void bDivPressed(ActionEvent e) { b = true; action = '/'; op1 = Double.parseDouble(t.getText()); } void bEqpressed(ActionEvent e) { op2 = Double.parseDouble(t.getText()); doCal(); } void doCal() { switch (action) { case '+': result = op1 + op2; break; case '-': result = op1 - op2; break; case '*': result = op1 * op2; break; case '/': result = op1 / op2; break; } t.setText(String.valueOf(result)); } public static void main(String[] args) { new cal1().setVisible(true); } JButton b0; JButton b1; JButton b2; JButton b3; JButton b4; JButton b5; JButton b6; JButton b7; JButton b8; JButton b9; JButton bDot; JButton bPlus; JButton bMinus; JButton bMul; JButton bDiv; JButton bEq; JPanel display; JPanel numpad; JTextField t; }

    Read the article

  • paperclip callbacks or simple processor?

    - by holden
    I wanted to run the callback after_post_process but it doesn't seem to work in Rails 3.0.1 using Paperclip 2.3.8. It gives an error: undefined method `_post_process_callbacks' for #<Class:0x102d55ea0> I want to call the Panda API after the file has been uploaded. I would have created my own processor for this, but as Panda handles the processing, and it can upload the files as well, and queue itself for an undetermined duration I thought a callback would do fine. But the callbacks don't seem to work in Rails3. after_post_process :panda_create def panda_create video = Panda::Video.create(:source_url => mp3.url.gsub(/[?]\d*/,''), :profiles => "f4475446032025d7216226ad8987f8e9", :path_format => "blah/1234") end I tried require and include for paperclip in my model but it didn't seem to matter. Anyideas?

    Read the article

  • lnk2019 error in very simple c++ program

    - by Erin
    I have tried removing various parts and building, but nothing makes the lnk2019 error go away, or even produces any normal errors. Everything is in the one file at the moment (it won't be later when it is finished). The program has three lists of words and makes a jargon phrase out of them, and you are supposed to be able to add words, remove words, view the lists, restore defaults, save changes to file, and load changes from file. #include "stdafx.h" #include <iostream> #include <string.h> using namespace std; const int maxlist = 20; string adj1[maxlist], adj2[maxlist], noun[maxlist]; void defaultlist(int list) { if(list == 1) { adj1[0] = "green"; adj1[1] = "red"; adj1[2] = "yellow"; adj1[3] = "blue"; adj1[4] = "purple"; int i = 5; while(i != maxlist) { adj1[i] = ""; i = i + 1; } } if(list == 2) { adj2[0] = "shiny"; adj2[1] = "hard"; adj2[2] = "soft"; adj2[3] = "spiky"; adj2[4] = "furry"; int i = 5; while(i != maxlist) { adj2[i] = ""; i = i + 1; } } if(list == 3) { noun[0] = "cat"; noun[1] = "dog"; noun[2] = "desk"; noun[3] = "chair"; noun[4] = "door"; int i = 5; while(i != maxlist) { noun[i] = ""; i = i + 1; } } return; } void printlist(int list) { if(list == 1) { int i = 0; while(!(i == maxlist)) { cout << adj1[i] << endl; i = i + 1; } } if(list == 2) { int i = 0; while(!(i == maxlist)) { cout << adj2[i] << endl; i = i + 1; } } if(list == 3) { int i = 0; while(!(i == maxlist)) { cout << noun[i] << endl; i = i + 1; } } return; } string makephrase() { int num1 = rand()%maxlist; int num2 = rand()%maxlist; int num3 = rand()%maxlist; int num4 = rand()%1; string word1, word2, word3; if(num4 = 0) { word1 = adj1[num1]; word2 = adj2[num2]; } else { word1 = adj2[num1]; word2 = adj1[num2]; } word3 = noun[num3]; return word1 + " ," + word2 + " " + word3; } string addword(string word, int list) { string result; if(list == 1) { int i = 0; while(!(adj1[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(adj1[i] == "") { adj1[i] = word; result = "Word was entered successfully."; } } if(list == 2) { int i = 0; while(!(adj2[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(adj2[i] == "") { adj2[i] = word; result = "Word was entered successfully."; } } if(list == 3) { int i = 0; while(!(noun[i] == "" || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "List is full. Please try again."; if(noun[i] == "") { noun[i] = word; result = "Word was entered successfully."; } } return result; } string removeword(string word, int list) { string result; if(list == 1) { int i = 0; while(!(adj1[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(adj1[i] == word) { adj1[i] = ""; result = "Word was removed successfully."; } } if(list == 2) { int i = 0; while(!(adj2[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(adj2[i] == word) { adj2[i] = ""; result = "Word was removed successfully."; } } if(list == 3) { int i = 0; while(!(noun[i] == word || i == maxlist)) { i = i + 1; } if(i == maxlist) result = "Word is not on the list. Please try again."; if(noun[i] == word) { noun[i] = ""; result = "Word was removed successfully."; } } return result; } /////////////////////////////main/////////////////////////////////// int main() { string mainselection; string makeselection; string phrase; defaultlist(1); defaultlist(2); defaultlist(3); cout << "This program generates jargon phrases made of two adjectives and one noun,"; cout << " on three lists. Each list may contain a maximum of " << maxlist << "elements."; cout << " Please choose from the following menu by typing the appropriate number "; cout << "and pressing enter." << endl; cout << endl; cout << "1. Make a jargon phrase." << endl; cout << "2. View a list." << endl; cout << "3. Add a word to a list." << endl; cout << "4. Remove a word from a list." << endl; cout << "5. Restore default lists." << endl; cout << "More options coming soon!." << endl; cin mainselection if(mainselection == 1) { phrase = makephrase(); cout << "Your phrase is " << phrase << "." << endl; cout << "To make another phrase, press 1. To go back to the main menu,"; cout << " press 2. To exit the program, press 3." << endl; cin makeselection; while(!(makeselection == "1" || makeselection == "2" || makeselection == "3")) { cout << "You have entered an invalid selection. Please try again." << endl; cin makeselection; } while(makeselection == "1") { phrase = makephrase(); cout << "To make another phrase, press 1. To go back to the main menu,"; cout << " press 2. To exit the program, press 3." << endl; } if(makeselection == "2") main(); if(makeselection == "3") return 0; } return 0; } //Rest of the options coming soon!

    Read the article

  • Simple haskell string manage

    - by paurullan
    Theres is a little problem I want to solve with Haskell: let substitute a function that change all of the wildcards in a string for one concrete parameter. The function has de signature of: subs :: String -> String -> String -> String -- example: -- subs 'x' "x^3 + x + sin(x)" "6.2" will generate -- "6.2^3 + 6.2 + sin(6.2)"

    Read the article

  • SubSonic 3.0 Simple Repository Adding a DateTime Property To An Object

    - by Blounty
    I am trying out SubSonic to see if it is viable to use on production projects. I seem to have stumbled upon an issue whith regards to updating the database with default values (String and DateTime) when a new column is created. If a new property of DateTime or String is added to an object. public class Bug { public int BugId { get; set; } public string Title { get; set; } public string Overview { get; set; } public DateTime TrackedDate { get; set; } public DateTime RemovedDate { get; set; } } When the code to add that type of object to the database is run var repository = new SimpleRepository(SimpleRepositoryOptions.RunMigrations); repository.Add(new Bug() { Title = "A Bug", Overview = "An Overview", TrackedDate = DateTime.Now }); it creates the following sql: UPDATE Bugs SET RemovedDate=''01/01/1900 00:00:00'' For some reason it is adding double 2 single quotes to each end of the string or DateTime. This is causing the following error: System.Data.SqlClient.SqlException - Incorrect syntax near '01' I am connecting to SQL Server 2005 Any help would be appreicated as apart from this issue i am finding SubSonic to be a great product. I have created a screen cast of my error here:

    Read the article

  • Coming Up with a Good Algorithm for a Simple Idea

    - by mkoryak
    I need to come up with an algorithm that does the following: Lets say you have an array of positive numbers (e.g. [1,3,7,0,0,9]) and you know beforehand their sum is 20. You want to abstract some average amount from each number such that the new sum would be less by 7. To do so, you must follow these rules: you can only subtract integers the resulting array must not have any negative values you can not make any changes to the indices of the buckets. The more uniformly the subtraction is distributed over the array the better. Here is my attempt at an algorithm in JavaScript + underscore (which will probably make it n^2): function distributeSubtraction(array, goal){ var sum = _.reduce(arr, function(x, y) { return x + y; }, 0); if(goal < sum){ while(goal < sum && goal > 0){ var less = ~~(goal / _.filter(arr, _.identity).length); //length of array without 0s arr = _.map(arr, function(val){ if(less > 0){ return (less < val) ? val - less : val; //not ideal, im skipping some! } else { if(goal > 0){ //again not ideal. giving preference to start of array if(val > 0) { goal--; return val - 1; } } else { return val; } } }); if(goal > 0){ var newSum = _.reduce(arr, function(x, y) { return x + y; }, 0); goal -= sum - newSum; sum = newSum; } else { return arr; } } } else if(goal == sum) { return _.map(arr, function(){ return 0; }); } else { return arr; } } var goal = 7; var arr = [1,3,7,0,0,9]; var newArray = distributeSubtraction(arr, goal); //returned: [0, 1, 5, 0, 0, 7]; Well, that works but there must be a better way! I imagine the run time of this thing will be terrible with bigger arrays and bigger numbers. edit: I want to clarify that this question is purely academic. Think of it like an interview question where you whiteboard something and the interviewer asks you how your algorithm would behave on a different type of a dataset.

    Read the article

  • jQuery Ajax posting Arrays instead of simple data

    - by Ignacio
    Hey, I've tried to update jQuery to its latest version on a system I'm working and I'm having this issue: I have a file that posts data to a .php: $.post( 'ajax_Save.php', { id: [$('#service_id').val()], number: [$('#number').val()] }, function(data){ ... }); On ajax_Save.php var_dump($_POST) gives: array(26) { ["id"]=> array(1) { [0]=> string(5) "18204" } ["number"]=> array(1) { [0]=> string(5) "18250" }... With jQuery version 1.2.2 the result is: array(26) { ["id"]=> string(5) "18204" ["order_number"]=> string(5) "18250" Which is OK. Any clues? Thx

    Read the article

  • Parse simple JSON with Jackson

    - by siik
    Here is my JSON: { "i": 53691, "s": "Something" } Here is my model: public class Test() { private int i; private String s; public setInt(int i){ this.i = i; } public setString(String s){ this.s = s; } // getters here } Here is my class for server's response: public class ServerResponse(){ private Test; public void setTest(Test test){ this.test = test;} public Test getTest(){ return Test; } } When I do: ObjectMapper mapper = new ObjectMapper(); mapper.readValue(json, serverResponse); I'm getting an exception like: JsonProcessingException: Unrecognized field "i" (Class MyClass), not marked as ignorable Please advice.

    Read the article

  • Perl XML::Simple XMLout function

    - by Jeremey
    I pass in the following XML to XMLin: <root foo="bar" foo2="bar2"> <pizzas> <pizza>Pepperoni</pizza> </pizzas> </root> I then edit part of the root element via hash array. I don't care about the pizza, but i do need that XML to come back out exactly as it was. However, I get the following from XMLout: <root foo="bar" foo2="bar2"> <pizzas pizza="Pepperoni"</pizzas> </root> Thoughts?

    Read the article

  • Android simple question

    - by Josemalive
    Hi, I have an android application that shows a grid view that shows: 1 2 3 4 GridView gridview=(GridView)findViewById(R.id.GridView_test); DataBaseHelper dbhelper=new DataBaseHelper(this); ArrayList<String> test=new ArrayList<String>(5); backlinksadapter.add("1"); backlinksadapter.add("2"); backlinksadapter.add("3"); backlinksadapter.add("4"); ArrayAdapter mAdapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, test); gridview.setAdapter(mAdapter); By the moment is working, but i would like to show foreach line of the grid, 2 columns with the values of a 2 dimensional array (something like the GridView in ASP.Net - as datasource -). I would like to show: 1 | Person 1 2 | Person 2 3 | Person 3 4 | Person 4 Any idea? Thanks in advance. Jose.

    Read the article

  • [WCF] Simple login

    - by Tr?n Qu?c Bình
    Hi everybody, I have a WCF service like this: [ServiceContract( SessionMode=SessionMode.Required)] public interface IService { [OperationContract(IsInitiating = true, IsTerminating = false)] void login(string id); [OperationContract(IsInitiating = false, IsTerminating = false)] string getdata(); } public class Service : IService { public void login(string hashedid) { if (username != "someusername" || password != "somepassword") { // can not get data } else { // can get data } } public string getdata() { return "these are data"; } } How can I write the method login and create the client application? Thanks you.

    Read the article

  • flXHR - getting started (a simple question)

    - by Yaron
    Hello, I am trying to use the flXHR javascript library for making cross-domain calls. I got stuck at the begining. As they say in the docs, I copied the /deploy directory's content to a /scripts directory. All the dependencies are supposed to be included in the flXHR download. This is my html, which returns several errors: the errors: y.base_path is undefined y.checkplayer is undefined y.ua is undefined E.attachEvent is not a function thanks

    Read the article

  • How To create a Simple NDK Program in Android NDK

    - by Rakesh
    Hi I am new to android Programming and NDK.Yet i am not clear with working in NDK.I just downloaded android ndk r4.If i want to develop appln using NDK,and i refered http://marakana.com/forums/android/android_examples/49.html for reference,But still not clear how to create the header file and implementation,I did nt have any previuos exp in c language.And they asked for run javah tool to create the JNI header file. I dont know how to use javah tool,but i found it in java bin directory and i tried using cmd javah -jni com.pathname.classname is this correct syntax? if so i tried doing it in android bin directory.I want to know ,what classname represents,is this name of header file class that i try to create Regards Rakesh Shankar.P

    Read the article

  • PHP - Creating a simple array

    - by danit
    Yes I'm a n00b! Now thats out of the way, I have the following code: $page=3; $i=1; while($i<=$pages) { $urls .= "'"."http://twitter.com/favorites.xml?page=" . $i ."',"; $i++; } What I need to create is this array: $data = array('http://twitter.com/favorites.xml?page=1','http://twitter.com/favorites.xml?page=2','http://twitter.com/favorites.xml?page=3'); How can I produce an array from the 'while' loop?

    Read the article

  • Simple typemap example in swig java

    - by celil
    I am trying to wrap a native C++ library using swig, and I am stuck at trying to convert time_t in C, to long in Java. I have successfully used swig with python, but so far I am unable to get the above typemap to work in Java. In python it looks like this %typemap(in) time_t { if (PyLong_Check($input)) $1 = (time_t) PyLong_AsLong($input); else if (PyInt_Check($input)) $1 = (time_t) PyInt_AsLong($input); else if (PyFloat_Check($input)) $1 = (time_t) PyFloat_AsDouble($input); else { PyErr_SetString(PyExc_TypeError,"Expected a large number"); return NULL; } } %typemap(out) time_t { $result = PyLong_FromLong((long)$1); } I guess the in map from Java to C would be: %typemap(in) time_t { $1 = (time_t) $input; } How would I complete the out map from C to Java? %typemap(out) time_t ??? Would I need typemaps like the ones below? %typemap(jni) %typemap(jtype) %typemap(jstype) I need this in order to wrap C functions like this: time_t manipulate_time (time_t dt);

    Read the article

  • PHP: simple form encoding/decoding

    - by Lennart
    Hi guys, Probably, this question has been asked before, though, I'll ask it again. Currently, I'm facing a problem with form encoding. When posting my form, all spaces are replaced by the "+" character. I would like to replace this "+" character by a real space. Does someone has a PHP solution for this? Thanks in advance. Cheers, Lennart

    Read the article

  • Error while excuting a simple boost thread program

    - by Eternal Learner
    Hi All, Could you tell mw what is the problem with the below boost::thread program #include<iostream> #include<boost/thread/thread.hpp> boost::mutex mutex; class A { public: A() : a(0) {} void operator()() { boost::mutex::scoped_lock lock(mutex); } private: int a; }; int main() { boost::thread thr1(A()); boost::thread thr2(A()); thr1.join(); thr2.join(); } I get the error message: error: request for member 'join' in 'thr1', which is of non-class type 'boost::thread()(A ()())' BoostThread2.cpp:30: error: request for member 'join' in 'thr2', which is of non-class type 'boost::thread ()(A ()())'

    Read the article

  • Simple reduction (NP completeness)

    - by Allen
    hey guys I'm looking for a means to prove that the bicriteria shortest path problem is np complete. That is, given a graph with lengths and weights, I need to know if a there exists a path in the graph from s to t with total length <= L and weight <= W. I know that i must take an NP complete problem and reduce it to this one. We have at our disposal the following problems to choose from: 3-SAT, independent set, vertex cover, hamiltonian cycle, and 3-dimensional matching. Any ideas on which may be viable? thanks

    Read the article

  • Explaining persistent data structures in simple terms

    - by Jason Baker
    I'm working on a library for Python that implements some persistent data structures (mainly as a learning exercise). However, I'm beginning to learn that explaining persistent data structures to people unfamiliar with them can be difficult. Can someone help me think of an easy (or at least the least complicated) way to describe persistent data structures to them? I've had a couple of people tell me that the documentation that I have is somewhat confusing. (And before anyone asks, no I don't mean persistent data structures as in persisted to the file system. Google persistent data structures if you're unclear on this.)

    Read the article

  • Need Help With Simple Counting Bug in iPhone SDK

    - by seanny94
    So I'm basically making an app that adds a count to a number and then displays it each time you tap the button. However, the first tap issued doesn't take any action but adds one (just as planned) on the second tap. I've searched to the ends of the earth looking for the solution with no luck, so I'll see what you guys can make of this. :) #import "MainView.h" @implementation MainView int count = 0; -(void)awakeFromNib { counter.text = @"0"; } - (IBAction)addUnit { if(count >= 999) return; NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count++]; counter.text = numValue; [numValue release]; } - (IBAction)subtractUnit { if(count <= 0) return; NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count--]; counter.text = numValue; [numValue release]; } @end

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >