Daily Archives

Articles indexed Wednesday November 7 2012

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Trouble calling a method from an external class

    - by Bradley Hobbs
    Here is my employee database program: import java.util.*; import java.io.*; import java.io.File; import java.io.FileReader; import java.util.ArrayList; public class P { //Instance Variables private static String empName; private static String wage; private static double wages; private static double salary; private static double numHours; private static double increase; // static ArrayList<String> ARempName = new ArrayList<String>(); // static ArrayList<Double> ARwages = new ArrayList<Double>(); // static ArrayList<Double> ARsalary = new ArrayList<Double>(); static ArrayList<Employee> emp = new ArrayList<Employee>(); public static void main(String[] args) throws Exception { clearScreen(); printMenu(); question(); exit(); } public static void printArrayList(ArrayList<Employee> emp) { for (int i = 0; i < emp.size(); i++){ System.out.println(emp.get(i)); } } public static void clearScreen() { System.out.println("\u001b[H\u001b[2J"); } private static void exit() { System.exit(0); } private static void printMenu() { System.out.println("\t------------------------------------"); System.out.println("\t|Commands: n - New employee |"); System.out.println("\t| c - Compute paychecks |"); System.out.println("\t| r - Raise wages |"); System.out.println("\t| p - Print records |"); System.out.println("\t| d - Download data |"); System.out.println("\t| u - Upload data |"); System.out.println("\t| q - Quit |"); System.out.println("\t------------------------------------"); System.out.println(""); } public static void question() { System.out.print("Enter command: "); Scanner q = new Scanner(System.in); String input = q.nextLine(); input.replaceAll("\\s","").toLowerCase(); boolean valid = (input.equals("n") || input.equals("c") || input.equals("r") || input.equals("p") || input.equals("d") || input.equals("u") || input.equals("q")); if (!valid){ System.out.println("Command was not recognized; please try again."); printMenu(); question(); } else if (input.equals("n")){ System.out.print("Enter the name of new employee: "); Scanner stdin = new Scanner(System.in); empName = stdin.nextLine(); System.out.print("Hourly (h) or salaried (s): "); Scanner stdin2 = new Scanner(System.in); wage = stdin2.nextLine(); wage.replaceAll("\\s","").toLowerCase(); if (!(wage.equals("h") || wage.equals("s"))){ System.out.println("Input was not h or s; please try again"); } else if (wage.equals("h")){ System.out.print("Enter hourly wage: "); Scanner stdin4 = new Scanner(System.in); wages = stdin4.nextDouble(); Employee emp1 = new HourlyEmployee(empName, wages); emp.add(emp1); printMenu(); question();} else if (wage.equals("s")){ System.out.print("Enter annual salary: "); Scanner stdin5 = new Scanner(System.in); salary = stdin5.nextDouble(); Employee emp1 = new SalariedEmployee(empName, salary); printMenu(); question();}} else if (input.equals("c")){ for (int i = 0; i < emp.size(); i++){ System.out.println("Enter number of hours worked by " + emp.get(i) + ":"); } Scanner stdin = new Scanner(System.in); numHours = stdin.nextInt(); System.out.println("Pay: " + emp1.computePay(numHours)); System.out.print("Enter number of hours worked by " + empName); Scanner stdin2 = new Scanner(System.in); numHours = stdin2.nextInt(); System.out.println("Pay: " + emp1.computePay(numHours)); printMenu(); question();} else if (input.equals("r")){ System.out.print("Enter percentage increase: "); Scanner stdin = new Scanner(System.in); increase = stdin.nextDouble(); System.out.println("\nNew Wages"); System.out.println("---------"); // System.out.println(Employee.toString()); printMenu(); question(); } else if (input.equals("p")){ printArrayList(emp); printMenu(); question(); } else if (input.equals("q")){ exit(); } } } Here is one of the class files: public abstract class Employee { private String name; private double wage; protected Employee(String name, double wage){ this.name = name; this.wage = wage; } public String getName() { return name; } public double getWage() { return wage; } public void setName(String name) { this.name = name; } public void setWage(double wage) { this.wage = wage; } public void percent(double wage, double percent) { wage *= percent; } } And here are the errors: P.java:108: cannot find symbol symbol : variable emp1 location: class P System.out.println("Pay: " + emp1.computePay(numHours)); ^ P.java:112: cannot find symbol symbol : variable emp1 location: class P System.out.println("Pay: " + emp1.computePay(numHours)); ^ 2 errors I'm trying to the get paycheck to print out but i'm having trouble with how to call the method. It should take the user inputed numHours and calculate it then print on the paycheck for each employee. Thanks!

    Read the article

  • Upload image from URL to FTP server using PHP

    - by user1807556
    I want to upload a picture from another site to my FTP server using PHP. Example: File to upload("http://page.mi.fu-berlin.de/krudolph/stuff/stackoverflow.png") FTP-path("pictures/") This is what I've already tried: 1 $image = file_get_contents("http://img.youtube.com/vi/Rz8KW4Tveps/1.jpg"); file_put_contents("imgfolder/imgID.jpg", $image); 2 copy('http://img.youtube.com/vi/Rz8KW4Tveps/1.jpg', 'imgfolder/imgID.jpg'); 3 <?php set_time_limit (24 * 60 * 60); if (!isset($_POST['submit'])) die(); $file = fopen ($url, "rb"); if ($file) { $newf = fopen ($newfname, "wb"); if ($newf) while(!feof($file)) { fwrite($newf, fread($file, 1024 * 2000 ), 1024 * 2000 ); } } if ($file) { fclose($file); } if ($newf) { fclose($newf); } ?> 4 http://www.teckdevil.com/php-server-to-server-transfer-script-to-remotely-transfer-files/ 5 (kinda the same as first linked) Download files directly to my server # I don't get any errors when I'm running the scripts and I have chmod the directory to 777.

    Read the article

  • Rails wont install at create Makefile stage

    - by mattc
    I am getting this error after running sudo gem install rails /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb creating Makefile make xcrun cc -I. - I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -DJSON_GENERATOR -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c generator.c xcrun: Error: failed to exec real xcrun. (No such file or directory) cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle generator.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl -lobjc i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory i686-apple-darwin11-llvm-gcc-4.2: generator.o: No such file or directory lipo: can't figure out the architecture type of: /var/tmp//ccHCNNwM.out make: *** [generator.bundle] Error 1 I have Homebrew installed, Xcode 4.4 with command line tools installed, Osx 10.6.2 I run gem env and get this but not sure what I'm looking for: RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - RUBYGEMS PLATFORMS: - ruby - universal-darwin-12 - GEM PATHS: - /Library/Ruby/Gems/1.8 - /Users/matthewcleghorn/.gem/ruby/1.8 - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ Any help greatly appreciated. Thanks.

    Read the article

  • jquery each to loop and animate

    - by medk
    I have some span tags: <span w="560"></span> <span w="340"></span> <span w="120"></span> With jQuery, I want to select EACH span, get the value inside its w attribute and animate it to that value + "px". I have a simple code that didn't work: $(document).ready(function(){ $('span').animate({width: $(this).attr('w') + 'px'}, 2000); }); Any Suggestions? Thanks.

    Read the article

  • Most efficient way of checking if Date object and Calendar object are in the same month

    - by Indigenuity
    I am working on a project that will run many thousands of comparisons between dates to see if they are in the same month, and I am wondering what the most efficient way of doing it would be. This isn't exactly what my code looks like, but here's the gist: List<Date> dates = getABunchOfDates(); Calendar month = Calendar.getInstance(); for(int i = 0; i < numMonths; i++) { for(Date date : dates) { if(sameMonth(month, date) .. doSomething } month.add(Calendar.MONTH, -1); } Creating a new Calendar object for every date seems like a pretty hefty overhead when this comparison will happen thousands of times, soI kind of want to cheat a bit and use the deprecated method Date.getMonth() and Date.getYear() public static boolean sameMonth(Calendar month, Date date) { return month.get(Calendar.YEAR) == date.getYear() && month.get(Calendar.MONTH) == date.getMonth(); } I'm pretty close to just using this method, since it seems to be the fastest, but is there a faster way? And is this a foolish way, since the Date methods are deprecated? Note: This project will always run with Java 7

    Read the article

  • no instance of overloaded function getline c++

    - by Dave
    I'm a bit confused as to what i have incorrect with my script that is causing this error. I have a function which calls a fill for game settings but it doesn't like my getline. Also i should mention these are the files i have included for it: #include <fstream> #include <cctype> #include <map> #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std;' This is what i have: std::map<string, string> loadSettings(std::string file){ ifstream file(file); string line; std::map<string, string> config; while(std::getline(file, line)) { int pos = line.find('='); if(pos != string::npos) { string key = line.substr(0, pos); string value = line.substr(pos + 1); config[trim(key)] = trim(value); } } return (config); } The function is called like this from my main.cpp //load settings for game std::map<string, string> config = loadSettings("settings.txt"); //load theme for game std::map<string, string> theme = loadSettings("theme.txt"); Where did i go wrong ? Please help! The error: settings.h(61): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::string'

    Read the article

  • How to make my WPF application as FAST as Outlook

    - by Raul Otaño
    The commons WPF applications take some time for loading medium complex views, once the view is loaded it works fine. For example in a Master - Detail view, if the Detail view is very complex and use different DataTemplates take some seconds (2-3 seconds) for load the view. When i open the Outlook application, for instance, it renders complex views and it is relative much more fast. Is there a way for increase the performance of my WPF application? Maybe a way for not loading the template's data every time that change the "master" item, and load it only one time in the app time live? i will appreciate any suggestion.

    Read the article

  • How to retrieve ID of button clicked within usercontrol on Asp.net page?

    - by Shawn Gilligan
    I have a page that I am working on that I'm linking multiple user controls to. The user control contains 3 buttons, an attach, clear and view button. When a user clicks on any control on the page, the resulting information is "dumped" into the last visible control on the page. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" MasterPageFile="DefaultPage.master" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <%@ Register tagName="FileHandler" src="FileHandling.ascx" tagPrefix="ucFile" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server"> <asp:UpdatePanel ID="upPanel" UpdateMode="Conditional" runat="server"> <ContentTemplate> <table> <tr> <td> <ucFile:FileHandler ID="fFile1" runat="server" /> </td> <td> <ucFile:FileHandler ID="fFile2" runat="server" /> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel> </asp:Content> All file handling and processing is handled within the control, with an event when the upload to the file server is complete via a file name that was generated. When either button is clicked, the file name is always stored internal to the control in the last control's text box. Control code: <table style="width: 50%;"> <tr style="white-space: nowrap;"> <td style="width: 1%;"> <asp:Label runat="server" ID="lblFile" /> </td> <td style="width: 20%;"> <asp:TextBox ID="txtFile" CssClass="backColor" runat="server" OnTextChanged="FileInformationChanged" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnUpload" CssClass="btn" Text="Attach" OnClick="UploadFile"/>--%> <input type="button" id="btnUpload" class="btn" tabindex="30" value="Attach" onclick="SetupUpload();" /> </td> <td style="width: 1%"> <%--<asp:Button runat="server" ID="btnClear" Text="Clear" CssClass="btn" OnClick="ClearTextValue"/>--%> <input type="button" id="btnClearFile" class="btn" value="Clear" onclick="document.getElementById('<%=txtFile.ClientID%>').value = '';document.getElementById('<%=hfFile.ClientID%>').value = '';" /> </td> <td style="width: 1%"> <a href="#here" onclick="ViewLink(document.getElementById('<%=hfFile.ClientID%>').value, '')">View</a> </td> <td style="width: 1%"> <asp:HiddenField ID="hfFile" runat="server" /> </td> </tr> </table> <script type="text/javascript"> var ItemPath = ""; function SetupUpload(File) { ItemPath = File; VersionAttach('<%=UploadPath%>', 'true'); } function UploadComplete(File) { document.getElementById('<%=txtFile.ClientID%>').value = File.substring(File.lastIndexOf("/") + 1); document.getElementById('<%=hfFile.ClientID%>').value = File; alert('<%=txtFile.Text %>'); alert('<%=ClientID %>') } function ViewLink(File, Alert) { if (File != "") { if (File.indexOf("../data/") != -1) { window.open(File, '_blank'); } else { window.open('../data/<%=UploadPath%>/' + File, '_blank'); } } else if (Alert == "") { alert('No file has been uploaded for this field.'); } } </script>

    Read the article

  • Ternary operator or chosing from two arrays with the boolean as index

    - by ajax333221
    Which of these lines is more understandable, faster jsPerf, easier to maintain?: arr = bol ? [[-2,1],[-1,2]] : [[-1,0],[-1,1]]; //or arr = [[[-1,0],[-1,1]], [[-2,1],[-1,2]]][bol*1]; I usually write code for computers (not for humans), but this is starting to be a problem when I am not the only one maintaining the code and work for a team. I am unsure, the first example looks neat but are two different arrays, and the second is a single array and seem to transmit what is being done easier. I also considered using an if-else, but I don't like the idea of writing two arr = .... Or are there better options? I need serious guidance, I have never worried about others seeing my code.

    Read the article

  • Select only the first rows for each unique value of a column in R

    - by dmvianna
    From a dataframe like this test <- data.frame('id'= rep(1:5,2), 'string'= LETTERS[1:10]) test <- test[order(test$id), ] rownames(test) <- 1:10 > test id string 1 1 A 2 1 F 3 2 B 4 2 G 5 3 C 6 3 H 7 4 D 8 4 I 9 5 E 10 5 J I want to create a new one with the first appearance of each id / string pair. If sqldf accepted R code within it, the query could look like this: res <- sqldf("select id, min(rownames(test)), string from test group by id, string") > res id string 1 1 A 3 2 B 5 3 C 7 4 D 9 5 E Is there a solution short of creating a new column like test$row <- rownames(test) and running the same sqldf query with min(row)?

    Read the article

  • Guru of the Week 2 no match for the operator==

    - by Adam
    From Guru of the Week 2. We have the function: string FindAddr(const list<Employee> l, string name) { for( list<Employee>::const_iterator i = l.begin(); i != l.end(); i++) { if( *i == name ) // here will be compilation error { return (*i).addr; } } return ""; } I added dummy Employee class to that: class Employee { string n; public: string addr; Employee(string name) : n(name) {} Employee() {} string name() const { return n; } operator string() { return n; } }; And got compilation error: error: no match for ‘operator==’ in ‘i.std::_List_iterator<_Tp>::operator* [with _Tp = Employee]() == name’ It works only if add operator== to Employee. But, Herb Sutter wrote that: The Employee class isn't shown, but for this to work it must either have a conversion to string or a conversion ctor taking a string. But Employee has a conversion function and conversion constructor as well. GCC version 4.4.3. Compiled normally, g++ file.cpp without any flags. There should be implicit conversion and it should work, why it doesn't?

    Read the article

  • Counting Values in R Vector

    - by GTyler
    I have a large vector of percentages (0-100) and I am trying to count how many of them are in specific 20% buckets (<20, 20-40, 40-60,60-80,80-100). The vector has length 129605 and there are no NA values. Here's my code: x<-c(0,0,0,0,0) for(i in 1: length(mail_return)) { if (mail_return[i]<=20) { x[1] = x[1] + 1 } if (mail_return[i]>20 && mail_return[i]<=40) { x[2] = x[2] + 1 } if (mail_return[i]>40 && mail_return[i]<=60) { x[3] = x[3] + 1 } if (mail_return[i]>60 && mail_return[i]<=80) { x[4] = x[4] + 1 } else { x[5] = x[5] + 1 } } But sum(x) is giving me length 133171. Shouldn't it be the length of the vector, 129605? What's wrong?

    Read the article

  • jQuery Code Only Fires On Hard Refresh?

    - by Rob Vanders
    The XFBML version of the Facebook Registration plugin only loads HTTPS. I need it to load HTTP so my form does not call a security error mismatch between domains. I wrote this code to get the SRC and rewrite it with out HTTPS It works fine on the first load, however on Chrome and Safari it only loads the first time and on HARD refreshes. It does not load on standard reloads or by pressing "enter" on the address bar. Here is the code $(window).load(function () { // Replace HTTPS with HTTP when frame has loaded $(".subscribe iframe").each(function(){ var source = $(this).attr("src"); //alert(source); var sourceNew = source.replace("https", "http"); // change https to http alert(sourceNew); $(this).attr("src", sourceNew); }); }); I have .HTACCESS set to disable server cache <Files *> Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0" Header set Expires: 0 Header set Pragma: no-cache </Files> What is causing this to not fire reliably? Thanks

    Read the article

  • When i add a bitmap to an array list the last element is duplicated in previous indexes

    - by saxofone2
    I'm trying to implement a personal way of undo/redo in a finger paint-like app. I have in synthesis three objects: the Main class (named ScorePadActivity), the relative Main Layout (with buttons, menus, etc, as well as a View object where I create my drawings), and a third object named ArrayList where i'm writing the undo/redo code. The problem is, when I press the undo button nothing happens, but if I draw anything again "one-time" and press undo, the screen is updated. If I draw many times, to see any changes happen on screen I have to press the undo button the same number of times I have drawn. Seems like (as in title) when I add a bitmap to the array list the last element is duplicated in previous indexes, and for some strange reason, everytime I press the Undo Button, the system is ok for one time, but starts to duplicate until the next undo. The index increase is verified with a series of System.out.println inserted in code. Now when I draw something on screen, the array list is updated with the code inserted after the invocation of touchup(); method in motionEvent touch_up(); } this.arrayClass.incrementArray(mBitmap); mPath.rewind(); invalidate(); and in ArrayList activity; public void incrementArray(Bitmap mBitmap) { this._mBitmap=mBitmap; _size=undoArray.size(); undoArray.add(_size, _mBitmap); } (All Logs removed for clear reading) The undo button in ScorePadActivity calls the undo method in View activity: Button undobtn= (Button)findViewById(R.id.undo); undobtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mView.undo(); } }); in View activity: public void undo() { this.mBitmap= arrayClass.undo(); mCanvas = new Canvas(mBitmap); mPath.rewind(); invalidate(); } that calls the relative undo method in ArrayList activity: public Bitmap undo() { // TODO Auto-generated method stub _size=undoArray.size(); if (_size>1) { undoArray.remove(_size-1); _size=undoArray.size(); _mBitmap = ((Bitmap) undoArray.get(_size-1)).copy(Bitmap.Config.ARGB_8888,true); } return _mBitmap; } return mBitmap and invalidate: Due to my bad English I have made a scheme to make the problem more clear: I have tried with HashMap, with a simple array, I have tried to change mPath.rewind(); with reset();, new Path(); etc but nothing. Why? Sorry for the complex answer, i want give you a great thanks in advance. Best regards

    Read the article

  • Racket list in struct

    - by Tim
    I just started programming with Racket and now I have the following problem. I have a struct with a list and I have to add up all prices in the list. (define-struct item (name category price)) (define some-items (list (make-item "Book1" 'Book 40.97) (make-item "Book2" 'Book 5.99) (make-item "Book3" 'Book 20.60) (make-item "Item" 'KitchenAccessory 2669.90))) I know that I can return the price with: (item-price (first some-items)) or (item-price (car some-items)). The problem is, that I dont know how I can add up all Items prices with this. Answer to Óscar López: May i filled the blanks not correctly, but Racket mark the code black when I press start and don't return anything. (define (add-prices items) (if (null? items) (+ 0 items) ; Here I don't really know what to write for a 0. ; I tried differnt thnigs like null and this version. (+ (item-price (first some-items)) (add-prices (item-price (rest some-items))))))

    Read the article

  • Entity Framework 5 upgrade from 4

    - by user1714591
    I'm having an issue with the Where clause in a search, in my original version EF4 I could add a Where clause with 2 parameters, the where clause (string predicate) and a ObjectParameter list such as var query = context.entities.Where(WhereClause.ToString(), Params.ToArray()); since my upgrade to EF5 I don't seem to have that option am I missing something? This was originally used to build dynamic where clause such as "it.entity_id = @entity_id" then holding the variable value in the ObjectParameter. I'm hoping I don't have to rewrite all the searches that have been built out this way, so any assistance would be greatly appreciated. Cheers

    Read the article

  • Optimum php.ini and my.cnf settings for a small Drupal 7 site on a virtual server

    - by the other dude
    I looking for advice on how to set up the default configuration of php.ini and my.cnf for a small site (100 pages) with very little traffic (300 visitors per day). All pages have a bit of text, some images, no video, no audio, no flash/silverlight, very little javascript and jquery. For tracking I'm using GA and Piwik. The main site database is around 50MB. The site is hosted on a virtual server with 20GB RAM and 6 vCPUs so there's hopefully a lot of muscle to make it run very fast. I don't know much about tweaking php and mysql settings and would appreciate it if your answers can be as detailed as possible. Thanks

    Read the article

  • Setting White balance and Exposure mode for iphone camera + enum default

    - by Spectravideo328
    I am using the back camera of an iphone4 and doing the standard and lengthy process of creating an AVCaptureSession and adding to it an AVCaptureDevice. Before attaching the AvCaptureDeviceInput of that camera to the session, I am testing my understanding of white balance and exposure, so I am trying this: [self.theCaptureDevice lockForConfiguration:nil]; [self.theCaptureDevice setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked]; [self.theCaptureDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure]; [self.theCaptureDevice unlockForConfiguration]; 1- Given that the various options for white balance mode are in an enum, I would have thought that the default is always zero since the enum Typedef variable was never assigned a value. I am finding out, if I breakpoint and po the values in the debugger, that the default white balance mode is actually set to 2. Unfortunately, the header files of AVCaptureDevice does not say what the default are for the different camera setting. 2- This might sound silly, but can I assume that once I stop the app, that all settings for whitebalance, exposure mode, will go back to their default. So that if I start another app right after, the camera device is not somehow stuck on those "hardware settings".

    Read the article

  • Why is the Dependency Property not returning its value?

    - by B-Rad
    I have a MyUserControl with the following Xaml: <TextBox Text="{Binding InputValueProperty}" /> In the MyUserControl.xaml.cs I have: public string InputValue { get { return (string)GetValue(InputValueProperty); } set { SetValue(InputValueProperty, value); } } public static readonly DependencyProperty InputValueProperty = DependencyProperty.Register("InputValueProperty", typeof(string), typeof(MyUserControl)); In my MainWindow.xaml I create a user control: <local:MyUserControl InputValue="My Input" /> Later on in my MainWindow.xaml.cs I am trying to access this string. All instances of MyUserControl are contained in a List and I access them with a foreach. string temp = userControl.InputValue; This is always null. In my MainWindow.xaml I can see the "My Input" in the text box of the user control but I can't ever seem to get it out of there.

    Read the article

  • Spring Data Neo4J @Indexed(unique = true) not working

    - by Markus Lamm
    I'm new to Neo4J and I have, probably an easy question. There're NodeEntitys in my application, a property (name) is annotated with @Indexed(unique = true) to achieve the uniqueness like I do in JPA with @Column(unique = true). My problem is, that when I persist an entity with a name that already exists in my graph, it works fine anyway. But I expected some kind of exception here...?! Here' s an overview over basic my code: @NodeEntity public abstract class BaseEntity implements Identifiable { @GraphId private Long entityId; ... } public class Role extends BaseEntity { @Indexed(unique = true) private String name; ... } public interface RoleRepository extends GraphRepository<Role> { Role findByName(String name); } @Service public class RoleServiceImpl extends BaseEntityServiceImpl<Role> implements { private RoleRepository repository; @Override @Transactional public T save(final T entity) { return getRepository().save(entity); } } And this is my test: @Test public void testNameUniqueIndex() { final List<Role> roles = Lists.newLinkedList(service.findAll()); final String existingName = roles.get(0).getName(); Role newRole = new Role.Builder(existingName).build(); newRole = service.save(newRole); } That's the point where I expect something to go wrong! How can I ensure the uniqueness of a property, without checking it for myself?? THANKS IN ADVANCE FOR ANY IDEAS!! P.S.: I'm using neo4j 1.8.M07, spring-data-neo4j 2.1.0.BUILD-SNAPSHOT and Spring 3.1.2.RELEASE.

    Read the article

  • Android x86 porting, unable to make it work

    - by Mr G
    I'm kind of new to the whole porting issue and I got to it because of the slowness in the emulator provided with the Android SDK. I downloaded the android-x86-3.2-RC2-eeepc and android-x86-3.2-RC2-tegav2 ISO-es (from this site) and tried them on the VirtualBox but have no internet connection on the eeepc version and the tegev2 wont event start. I tried the VirtualBoxHowTo but got nothing, on both Windows and Linux platforms. the only thing I managed to understand is that to use this on a VM you need to build it for VM. Can anyone help me on this? P.S.: I need the HoneyComb version (3.2) and the pc I have is a AMD 6 core on and Asus Crosshair Extreme motherboard, Windows 7 or Ubunutu 11.10. (both OS are 64bit)

    Read the article

  • How to speed up saving a UIImagePickerController image from the camera to the filesystem via UIImagePNGRepresentation()?

    - by kazuhito0000
    I'm making an applications that let users take a photo and show them both in thumbnail and photo viewer. I have NSManagedObject class called photo and photo has a method that takes UIImage and converts it to PNG using UIImagePNGRepresentation() and saves it to filesystem. After this operation, resize the image to thumbnail size and save it. The problem here is UIImagePNGRepresentation() and conversion of image size seems to be really slow and I don't know if this is a right way to do it. Tell me if anyone know the best way to accomplish what I want to do. Thank you in advance.

    Read the article

  • Is it possible to pass Calendar new date in the bean without listener?

    - by isabsent
    I am trying to pass new date from PrimeFaces p:calendar (placed in p:dataTable column) to the backing bean: <p:column > <p:calendar value="#{bean.date}">` <p:ajax /> </p:calendar> </p:column> It does not update bean.date. Variants with <p:ajax update="@this" event="change"/> <p:ajax update="@this" event="select"/> do not update bean.date too. The only way I have found is using of listener. However, I suppose, there should be a way without listener implementation like for simple facelets: <p:column> <h:inputText value="#{bean.note}" > <f:ajax/> </h:inputText> </p:column> that works fine for me. Does anybody know how to get it working!?

    Read the article

  • Using Private Extension Galleries in Visual Studio 2012

    - by Jakob Ehn
    Note: The installer and the complete source code is available over at CodePlex at the following location: http://inmetavsgallery.codeplex.com   Extensions and addins are everywhere in the Visual Studio ALM ecosystem! Microsoft releases new cool features in the form of extensions and the list of 3rd party extensions that plug into Visual Studio just keeps growing. One of the nice things about the VSIX extensions is how they are deployed. Microsoft hosts a public Visual Studio Gallery where you can upload extensions and make them available to the rest of the community. Visual Studio checks for updates to the installed extensions when you start Visual Studio, and installing/updating the extensions is fast since it is only a matter of extracting the files within the VSIX package to the local extension folder. But for custom, enterprise-specific extensions, you don’t want to publish them online to the whole world, but you still want an easy way to distribute them to your developers and partners. This is where Private Extension Galleries come into play. In Visual Studio 2012, it is now possible to add custom extensions galleries that can point to any URL, as long as that URL returns the expected content of course (see below).Registering a new gallery in Visual Studio is easy, but there is very little documentation on how to actually host the gallery. Visual Studio galleries uses Atom Feed XML as the protocol for delivering new and updated versions of the extensions. This MSDN page describes how to create a static XML file that returns the information about your extensions. This approach works, but require manual updates of that file every time you want to deploy an update of the extension. Wouldn’t it be nice with a web service that takes care of this for you, that just lets you drop a new version of your VSIX file and have it automatically detect the new version and produce the correct Atom Feed XML? Well search no more, this is exactly what the Inmeta Visual Studio Gallery Service does for you :-) Here you can see that in addition to the standard Online galleries there is an Inmeta Gallery that contains two extensions (our WIX templates and our custom TFS Checkin Policies). These can be installed/updated i the same way as extensions from the public Visual Studio Gallery. Installing the Service Download the installler (Inmeta.VSGalleryService.Install.msi) for the service and run it. The installation is straight forward, just select web site, application pool and (optional) a virtual directory where you want to install the service.   Note: If you want to run it in the web site root, just leave the application name blank Press Next and finish the installer. Open web.config in a text editor and locate the the <applicationSettings> element Edit the following setting values: FeedTitle This is the name that is shown if you browse to the service using a browser. Not used by Visual Studio BaseURI When Visual Studio downloads the extension, it will be given this URI + the name of the extension that you selected. This value should be on the following format: http://SERVER/[VDIR]/gallery/extension/ VSIXAbsolutePath This is the path where you will deploy your extensions. This can be a local folder or a remote share. You just need to make sure that the application pool identity account has read permissions in this folder Save web.config to finish the installation Open a browser and enter the URL to the service. It should show an empty Feed page:   Adding the Private Gallery in Visual Studio 2012 Now you need to add the gallery in Visual Studio. This is very easy and is done as follows: Go to Tools –> Options and select Environment –> Extensions and Updates Press Add to add a new gallery Enter a descriptive name, and add the URL that points to the web site/virtual directory where you installed the service in the previous step   Press OK to save the settings. Deploying an Extension This one is easy: Just drop the file in the designated folder! :-)  If it is a new version of an existing extension, the developers will be notified in the same way as for extensions from the public Visual Studio gallery: I hope that you will find this sever useful, please contact me if you have questions or suggestions for improvements!

    Read the article

  • AJI Report #17 | Javier Lozano on Cloud Development and ASP.NET

    - by Jeff Julian
    Javier Lozano opens up the conversation with John and Jeff about the importance of web applications in the cloud and we walk through some options for enterprise developers to consume today. Javier has been an ASP.NET MVP and ASP.NET Insider for years and is a great resource in the Midwest when it comes to ASP.NET. Javier is one of organizers of the ASP.NET conference, aspConf. Listen to the Show Site: http://lozanotek.com Conference: aspConf Twitter: @jglozano

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >