Daily Archives

Articles indexed Tuesday July 10 2012

Page 7/18 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • push(ing)_back objects pointers within a loop

    - by Jose Manuel Albornoz
    Consider the following: I have a class CDevices containing, amongst others, a string member class CDevice { public: CDevice(void); ~CDevice(void); // device name std::string Device_Name; etc... } and somewhere else in my code I define another class that contains a vector of pointers to CDevices class CDevice; class CServers { public: CServers(void); ~CServers(void); // Devices vector vector<CDevice*> Devices; etc... } The problem appears in the following lines in my main.c pDevice = new CDevice; pDevice->Device_Name = "de"; Devices.push_back(pDevice); pDevice->Device_Name = " revolotiunibus"; Devices.push_back(pDevice); pDevice->Device_Name = " orbium"; Devices.push_back(pDevice); pDevice->Device_Name = " coelestium"; Devices.push_back(pDevice); for(int i = 0; i < (int)Devices.size(); ++i) cout << "\nLoad name = " << Devices.at(i)->Device_Name << endl; The output I get is " coelestium" repeated four times: each time I push_back a new element into the vector all of the already existing elements take the value of the one which has just been added. I have also tried using iterators to recover each element in the vector with the same results. Could someone please tell me what's wrong here? Thankx

    Read the article

  • Show image on hover with PHP

    - by Sorosh
    I have a small problem with my PHP code and It would be very nice if someone could help me. I want to display an image when hovering over a link. This is the link with the PHP code that I have now: <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) {the_post_thumbnail();} else if ( has_post_video() ) {the_post_video_image();}?></a> This code shows a image, but I want to execute this code when hovering over the link with the image: <?php echo print_image_function(); ?> The code also shows a image that belongs to a category. I don't want the initial image to disappear I simply want to show the second image on top off the first image when hovering over the first image. I don't know if it is helpful but I use Wordpress and I am not a PHP expert. I even don't know if this is going to work. Thats why I am asking if somebody can help me with this. Thanks in advance

    Read the article

  • Layering of CSS with z-index

    - by Matt Hintzke
    I have a created a 3 circle venn diagram using pure CSS3 and each circle has a :hover event attached to it. I also have an image of an arrow which is pointing to the center of the venn diagram. I want the arrow to visually appear to be on top of the circles, so I put the z-index higher on the arrow than the circles. The problem now, is that the :hover event does not trigger on half of the venn diagram now because the arrow image is on top, which causes the hover to be on top of the arrow rather than the circle that I want it to be over. So is it possible to make an element have a high z-index visually but not programmatically?

    Read the article

  • Is there a difference between starting an application from the OS or from adb

    - by aruwen
    I do have a curious error in my application. My app crashes (don't mind the crash, I roughly know why - classloader) when I start the application from the OS directly, then kill it from the background via any Task Killer (this is one of the few ways to reproduce the crash consistently - simulating the OS freeing memory and closing the application) and try to restart it again. The thing is, if I start the application via adb shell using the following command: adb shell am start -a android.intent.action.MAIN -n com.my.packagename/myLaunchActivity I cannot reproduce the crash. So is there any difference in how Android OS calls the application as opposed to the above call? EDIT: added the manifest (just changed names) <?xml version="1.0" ?> <manifest android:versionCode="5" android:versionName="1.05" package="com.my.sample" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-sdk android:minSdkVersion="7"/> <application android:icon="@drawable/square_my_logo" android:label="@string/app_name"> <activity android:label="@string/app_name" android:name="com.my.InfoActivity" android:screenOrientation="landscape"></activity> <activity android:label="@string/app_name" android:name="com.my2.KickStart" android:screenOrientation="landscape"/> <activity android:label="@string/app_name" android:name="com.my2.Launcher" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/></manifest> starting the com.my2.Launcher from the adb shell

    Read the article

  • Custom UIProgressView drawing weirdness

    - by Werner
    I am trying to create my own custom UIProgressView by subclassing it and then overwrite the drawRect function. Everything works as expected except the progress filling bar. I can't get the height and image right. The images are both in Retina resolution and the Simulator is in Retina mode. The images are called: "[email protected]" (28px high) and "[email protected]" (32px high). CustomProgressView.h #import <UIKit/UIKit.h> @interface CustomProgressView : UIProgressView @end CustomProgressView.m #import "CustomProgressView.h" @implementation CustomProgressView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, 16); UIImage *progressBarTrack = [[UIImage imageNamed:@"progressBarTrack"] resizableImageWithCapInsets:UIEdgeInsetsZero]; UIImage *progressBar = [[UIImage imageNamed:@"progressBar"] resizableImageWithCapInsets:UIEdgeInsetsMake(4, 4, 5, 4)]; [progressBarTrack drawInRect:rect]; NSInteger maximumWidth = rect.size.width - 2; NSInteger currentWidth = floor([self progress] * maximumWidth); CGRect fillRect = CGRectMake(rect.origin.x + 1, rect.origin.y + 1, currentWidth, 14); [progressBar drawInRect:fillRect]; } @end The resulting ProgressView has the right height and width. It also fills at the right percentage (currently set at 80%). But the progress fill image isn't drawn correctly. Does anyone see where I go wrong?

    Read the article

  • C++: how serialize/deserialize objects without any library?

    - by Winte Winte
    I try to understand how serializing/deserializing works in c++, so I want to do that without any libs. But I really stuck with that. I start with simple objects but when I try to deserilize a vector I understand that I can't get a vector without if I don't write it size before. Moreover, I don't know which format of file I should choose because if digits will be existed before size of vector I haven't chance to read it right. However it is only the vector but I also want to do that with classes and map container. My task is serialize/deserialize a objects as this: PersonInfo { unsigned int age_; string name_; enum { undef, man, woman } sex_; } Person : PersonInfo { vector<Person> children_; map<string, PersonInfo> addrBook_; } Currently I know how to serialize simple objects in way as this: vector<PersonInfo> vecPersonInfo; vecPersonInfo.push_back(*personInfo); vecPersonInfo.push_back(*oneMorePersonInfo); ofstream file("file", ios::out | ios::binary); if (!file) { cout<<"can not open file"; } else { vector<PersonInfo>::const_iterator iterator = vecPersonInfo.begin(); for (; iterator != vecPersonInfo.end(); iterator++) { file<<*iterator; } Could you please suggest how I can do this for this conplex object or a good tutorial that explain it clearly?

    Read the article

  • stick button to bottom of element

    - by dzona
    Is there any way to stick child button element to bottom of parent element when number of child elements vary? Parent element is fixed height, and could be scrolled vertically in case of child overflow. In that case, button should be at the end of child list, but in case there is no children, or children size don't push parent element to overflow, it should be at bottom of parent element. Is there pure css solution for this? Thanks

    Read the article

  • Facebook "->api" permissions

    - by Matthieu Marcé
    I have trouble using Facebook auth on my website... I'm using the PHP Sdk and I don't understand why I can use some functions like "getLoginUrl"/"getLoginStatusUrl"/"getUser" (with right answers : the facebook session is started, i get the user's facebook ID) and when I want to use something like $me = $facebook->api("/me/permissions"); or just $me = $facebook->api("/me"); there's always an exception and nothing works ... I guess it has something to do with permissions or token maybe, but I don't know what. When the user sign up on my website, I ask permissions I need with this scope : "email,user_about_me,user_location,read_friendlists,publish_stream" A clue that the permissions seem to be ok is that when the exception occures, I ask the user to sign in again (facebook connect) and no window appears as if everything's ok, but still, the page is reloaded and the exception appears again and again... Please help, Thank you !

    Read the article

  • Ajax.BeginForm is submitting disabled form elements

    - by Fiffe
    Using MVC3 and Ajax.BeginForm I surprisingly discovered that mvc ajax forms submits elements with the attribute disabled="disabled". I have tested both select and text inputs. I was suprised because they should not be submited and they will not when using Html.BeginForm. Is there some hidden option or a workaround for this? [EDIT example] @using (Ajax.BeginForm("Action", "Control", new AjaxOptions() { HttpMethod = "POST" })) { <input type="text" name="_enabled" value="_enabled" /> <input type="text" name="_disabled" value="_disabled" disabled="disabled" /> <input type="submit" value="POST" /> }

    Read the article

  • Force close error expecting irregulary

    - by user1506019
    I have problem. I created an application which loads random layour from resources and I have problem because program shows random layout and closes , sometimes after 2 times and sometimes after a dozen, and I dont know where is a problem, I tried to run it on my phone and I added in the manifest write_external_storage permission, and still the same error.Please help me, and try to resolve this problem. here is my code in : java : package ka.ka.ka; import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class KAMASActivity extends Activity implements OnClickListener { Button button1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this); } @Override public void onClick(View v) { int min = 1; int max = 6; int i1=0; Random r = new Random(); i1 = r.nextInt(max - min + 1) + min; if(i1==1){setContentView(R.layout.image1); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this);} if(i1==2){setContentView(R.layout.image2); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this);} if(i1==3){setContentView(R.layout.image3); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this);} if(i1==4){setContentView(R.layout.image4); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this);} if(i1==5){setContentView(R.layout.image5); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this);} if(i1==6){setContentView(R.layout.image6); button1 = (Button) findViewById(R.id.button1) ; button1.setOnClickListener(this); } } Android Manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ka.ka.ka" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="7" /> <uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:icon="@drawable/ikona" android:label="@string/app_name" > <activity android:name=".KAMASActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> And he is logcat : 07-10 10:58:51.062: D/ddm-heap(218): Got feature list request 07-10 10:58:51.311: D/dalvikvm(218): GC freed 506 objects / 46032 bytes in 122ms 07-10 10:59:30.081: D/AndroidRuntime(218): Shutting down VM 07-10 10:59:30.081: W/dalvikvm(218): threadid=3: thread exiting with uncaught exception (group=0x4001b188) 07-10 10:59:30.081: E/AndroidRuntime(218): Uncaught handler: thread main exiting due to uncaught exception 07-10 10:59:30.102: E/AndroidRuntime(218): java.lang.NullPointerException 07-10 10:59:30.102: E/AndroidRuntime(218): at ka.ka.ka.KAMASActivity.onClick(KAMASActivity.java:32) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.View.performClick(View.java:2364) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.View.onTouchEvent(View.java:4179) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.widget.TextView.onTouchEvent(TextView.java:6541) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.View.dispatchTouchEvent(View.java:3709) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 0 7-10 10:59:30.102: E/AndroidRuntime(218): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 07-10 10:59:30.102: E/AndroidRuntime(218): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow. java:1659) 07-10 10:59:30.102: E/AndroidRuntime(218): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 07-10 10:59:30.102: E/AndroidRuntime(218): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.os.Handler.dispatchMessage(Handler.java:99) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.os.Looper.loop(Looper.java:123) 07-10 10:59:30.102: E/AndroidRuntime(218): at android.app.ActivityThread.main(ActivityThread.java:4363) 07-10 10:59:30.102: E/AndroidRuntime(218): at java.lang.reflect.Method.invokeNative(Native Method) 07-10 10:59:30.102: E/AndroidRuntime(218): at java.lang.reflect.Method.invoke(Method.java:521) 07-10 10:59:30.102: E/AndroidRuntime(218): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 07-10 10:59:30.102: E/AndroidRuntime(218): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 07-10 10:59:30.102: E/AndroidRuntime(218): at dalvik.system.NativeStart.main(Native Method) 07-10 10:59:30.121: I/dalvikvm(218): threadid=7: reacting to signal 3 07-10 10:59:30.121: E/dalvikvm(218): Unable to open stack trace file '/data/anr/traces.txt': Permission denied 07-10 10:59:32.562: I/Process(218): Sending signal. PID: 218 SIG: 9

    Read the article

  • Google Analytics V2 SDK for Android EasyTracker giving errors

    - by Prince
    I have followed the tutorial for the new Google Analytics V2 SDK for Android located here: https://developers.google.com/analytics/devguides/collection/android/v2/ Unfortunately whenever I go to run the application the reporting is not working and this is the messages that logcat gives me: 07-09 09:13:16.978: W/Ads(13933): No Google Analytics: Library Incompatible. 07-09 09:13:16.994: I/Ads(13933): To get test ads on this device, call adRequest.addTestDevice("2BB916E1BD6BE6407582A429D763EC71"); 07-09 09:13:17.018: I/Ads(13933): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"7925570029955749351","u_sd":2,"seq_num":"1","slotname":"a14fd91432961bd","u_w":360,"msid":"com.mysampleapp.sampleapp","js":"afma-sdk-a-v6.0.1","mv":"8013013.com.android.vending","isu":"2BB916E1BD6BE6407582A429D763EC71","cipa":1,"format":"320x50_mb","net":"wi","app_name":"1.android.com.mysampleapp.sampleapp","hl":"en","u_h":592,"carrier":"311480","ptime":0,"u_audio":3});</script></head><body></body></html> 07-09 09:13:17.041: W/ActivityManager(220): Unable to start service Intent { act=com.google.android.gms.analytics.service.START (has extras) }: not found 07-09 09:13:17.049: W/GAV2(13933): Thread[main,5,main]: Connection to service failed 1 07-09 09:13:17.057: W/GAV2(13933): Thread[main,5,main]: Need to call initializea() and be in fallback mode to start dispatch. 07-09 09:13:17.088: D/libEGL(13933): loaded /system/lib/egl/libGLES_android.so 07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 07-09 09:13:17.096: D/libEGL(13933): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so Here is my code (I have redacted some of the code that had to do with httppost, etc.): package com.mysampleapp.sampleapp; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONObject; import com.google.analytics.tracking.android.EasyTracker; import android.app.Activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.TextView; public class viewRandom extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.viewrandom); uservote.setVisibility(View.GONE); new randomViewClass().execute(); } public void onStart() { super.onStart(); EasyTracker.getInstance().activityStart(this); } public void onStop() { super.onStop(); EasyTracker.getInstance().activityStop(this); } }

    Read the article

  • JavaFx 2.1, 2.2 TableView update issue

    - by Lewis Liu
    My application uses JPA read data into TableView then modify and display them. The table refreshed modified record under JavaFx 2.0.3. Under JavaFx 2.1, 2.2, the table wouldn't refresh the update anymore. I found other people have similar issue. My plan was to continue using 2.0.3 until someone fixes the issue under 2.1 and 2.2. Now I know it is not a bug and wouldn't be fixed. Well, I don't know how to deal with this. Following are codes are modified from sample demo to show the issue. If I add a new record or delete a old record from table, table refreshes fine. If I modify a record, the table wouldn't refreshes the change until a add, delete or sort action is taken. If I remove the modified record and add it again, table refreshes. But the modified record is put at button of table. Well, if I remove the modified record, add the same record then move the record to the original spot, the table wouldn't refresh anymore. Below is a completely code, please shine some light on this. import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle; public class Main extends Application { private TextField firtNameField = new TextField(); private TextField lastNameField = new TextField(); private TextField emailField = new TextField(); private Stage editView; private Person fPerson; public static class Person { private final SimpleStringProperty firstName; private final SimpleStringProperty lastName; private final SimpleStringProperty email; private Person(String fName, String lName, String email) { this.firstName = new SimpleStringProperty(fName); this.lastName = new SimpleStringProperty(lName); this.email = new SimpleStringProperty(email); } public String getFirstName() { return firstName.get(); } public void setFirstName(String fName) { firstName.set(fName); } public String getLastName() { return lastName.get(); } public void setLastName(String fName) { lastName.set(fName); } public String getEmail() { return email.get(); } public void setEmail(String fName) { email.set(fName); } } private TableView<Person> table = new TableView<Person>(); private final ObservableList<Person> data = FXCollections.observableArrayList( new Person("Jacob", "Smith", "[email protected]"), new Person("Isabella", "Johnson", "[email protected]"), new Person("Ethan", "Williams", "[email protected]"), new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]")); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Table View Sample"); stage.setWidth(535); stage.setHeight(535); editView = new Stage(); final Label label = new Label("Address Book"); label.setFont(new Font("Arial", 20)); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setCellValueFactory( new PropertyValueFactory<Person, String>("firstName")); firstNameCol.setMinWidth(150); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setCellValueFactory( new PropertyValueFactory<Person, String>("lastName")); lastNameCol.setMinWidth(150); TableColumn emailCol = new TableColumn("Email"); emailCol.setMinWidth(200); emailCol.setCellValueFactory( new PropertyValueFactory<Person, String>("email")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); //--- create a edit button and a editPane to edit person Button addButton = new Button("Add"); addButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { fPerson = null; firtNameField.setText(""); lastNameField.setText(""); emailField.setText(""); editView.show(); } }); Button editButton = new Button("Edit"); editButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (table.getSelectionModel().getSelectedItem() != null) { fPerson = table.getSelectionModel().getSelectedItem(); firtNameField.setText(fPerson.getFirstName()); lastNameField.setText(fPerson.getLastName()); emailField.setText(fPerson.getEmail()); editView.show(); } } }); Button deleteButton = new Button("Delete"); deleteButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (table.getSelectionModel().getSelectedItem() != null) { data.remove(table.getSelectionModel().getSelectedItem()); } } }); HBox addEditDeleteButtonBox = new HBox(); addEditDeleteButtonBox.getChildren().addAll(addButton, editButton, deleteButton); addEditDeleteButtonBox.setAlignment(Pos.CENTER_RIGHT); addEditDeleteButtonBox.setSpacing(3); GridPane editPane = new GridPane(); editPane.getStyleClass().add("editView"); editPane.setPadding(new Insets(3)); editPane.setHgap(5); editPane.setVgap(5); Label personLbl = new Label("Person:"); editPane.add(personLbl, 0, 1); GridPane.setHalignment(personLbl, HPos.LEFT); firtNameField.setPrefWidth(250); lastNameField.setPrefWidth(250); emailField.setPrefWidth(250); Label firstNameLabel = new Label("First Name:"); Label lastNameLabel = new Label("Last Name:"); Label emailLabel = new Label("Email:"); editPane.add(firstNameLabel, 0, 3); editPane.add(firtNameField, 1, 3); editPane.add(lastNameLabel, 0, 4); editPane.add(lastNameField, 1, 4); editPane.add(emailLabel, 0, 5); editPane.add(emailField, 1, 5); GridPane.setHalignment(firstNameLabel, HPos.RIGHT); GridPane.setHalignment(lastNameLabel, HPos.RIGHT); GridPane.setHalignment(emailLabel, HPos.RIGHT); Button saveButton = new Button("Save"); saveButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (fPerson == null) { fPerson = new Person( firtNameField.getText(), lastNameField.getText(), emailField.getText()); data.add(fPerson); } else { int k = -1; if (data.size() > 0) { for (int i = 0; i < data.size(); i++) { if (data.get(i) == fPerson) { k = i; } } } fPerson.setFirstName(firtNameField.getText()); fPerson.setLastName(lastNameField.getText()); fPerson.setEmail(emailField.getText()); data.set(k, fPerson); table.setItems(data); // The following will work, but edited person has to be added to the button // // data.remove(fPerson); // data.add(fPerson); // add and remove refresh the table, but now move edited person to original spot, // it failed again with the following code // while (data.indexOf(fPerson) != k) { // int i = data.indexOf(fPerson); // Collections.swap(data, i, i - 1); // } } editView.close(); } }); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { editView.close(); } }); HBox saveCancelButtonBox = new HBox(); saveCancelButtonBox.getChildren().addAll(saveButton, cancelButton); saveCancelButtonBox.setAlignment(Pos.CENTER_RIGHT); saveCancelButtonBox.setSpacing(3); VBox editBox = new VBox(); editBox.getChildren().addAll(editPane, saveCancelButtonBox); Scene editScene = new Scene(editBox); editView.setTitle("Person"); editView.initStyle(StageStyle.UTILITY); editView.initModality(Modality.APPLICATION_MODAL); editView.setScene(editScene); editView.close(); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.getChildren().addAll(label, table, addEditDeleteButtonBox); vbox.setPadding(new Insets(10, 0, 0, 10)); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); } }

    Read the article

  • How to pre-populate the Facebook status message through an URL similar to pre-populating a tweet?

    - by Crashalot
    This question has been asked before on SO, but most of those questions were asked a long time ago. Essentially, we want a simple way to pre-populate the Facebook status message through the URL much like you can with Twitter. We're aware of the Facebook APIs, but are wondering if there is a more lightweight approach. We don't need programmatically to post a message, but just provide some default text that the user can edit before sharing.

    Read the article

  • How can I create a rules engine without using eval() or exec()?

    - by Angela
    I have a simple rules/conditions table in my database which is used to generate alerts for one of our systems. I want to create a rules engine or a domain specific language. A simple rule stored in this table would be..(omitting the relationships here) if temp > 40 send email Please note there would be many more such rules. A script runs once daily to evaluate these rules and perform the necessary actions. At the beginning, there was only one rule, so we had the script in place to only support that rule. However we now need to make it more scalable to support different conditions/rules. I have looked into rules engines , but I hope to achieve this in some simple pythonic way. At the moment, I have only come up with eval/exec and I know that is not the most recommended approach. So, what would be the best way to accomplish this?? ( The rules are stored as data in database so each object like "temperature", condition like "/=..etc" , value like "40,50..etc" and action like "email, sms, etc.." are stored in the database, i retrieve this to form the condition...if temp 50 send email, that was my idea to then use exec or eval on them to make it live code..but not sure if this is the right approach )

    Read the article

  • The shell dotfile cookbook

    - by Jason Baker
    I constantly hear from other people about how much of the stuff they've used to customize their *nix setup they've shamelessly stolen from other people. So in that spirit, I'd like to start a place to share that stuff here on SO. Here are the rules: DON'T POST YOUR ENTIRE DOTFILE. Instead, just show us the cool stuff. One recipe per answer You may, however, post multiple versions of your recipe in the same answer. For example, you may post a version that works for bash, a version that works for zsh, and a version that works for csh in the same answer. State what shells you know your recipe will work with in the answer. Let's build this cookbook as a team. If you find out that an answer works with other shells other than the one the author posted, edit it in. If you like an idea and rewrite it to work with another shell, edit the modified version in to the original post. Give credit where credit is due. If you got your idea from someone else, give them credit if possible. And for those of you (justifiably) asking "Why do we need another one of these threads?": Most of what I've seen is along the lines of "post your entire dotfile." Personally, I don't want to try to parse through a person's entire dotfile to figure out what I want. I just want to know about all the cool parts of it. It's helpful to have a single dotfile thread. I think most of the stuff that works in bash will work in zsh and it may be adapted to work with csh fairly easily.

    Read the article

  • Custom Gridview Paging on ASP.NET

    - by OscarRibbeck
    Hello again :).There is an interesting entry about Custom Gridview Paging on ASP.NET 2.0 subject on here: http://forums.asp.net/t/1069129.aspx I tweaked the original code for my own convenience and posted it on this thread but I noticed yesterday that some people had some questions on it that I didn't notice. Hence I uploaded an small sample available on here:http://www.mediafire.com/?2a8c34zn4495mq8Try it out and if you have any questions please let me know.Cheers!

    Read the article

  • Self Welcoming Post on geekswithblogs.net

    - by OscarRibbeck
    Hello!.As you may notice :), this is my first post on geekswithblogs.com . I  have been using the .Net Framework mainly to develop ASP.NET WebApps for some years now and I am moving from using the .Net Framework 2.0 to using the latest features on the 4.x Frameworks, I am planning to document whenever is possible some of the stuff I learn using this space kindly given by the staff of the site. The feedback I get will also be very important for my progress and my plan is to learn a lot from what you guys can teach me with your comments on here.I also found myself with the necessity of putting somewhere code samples because sometimes when you post on forums the entries get locked and you can't do anything to add relevant details on them. The code will either be explained on its entirety or will be posted on a link that has an explained working sample for you guys to test and learn from.My posts will be in English, and I am an intermediate English speaker/writer so bare with me if it's not perfect sometimes, I am always learning something new though.I hope this get to be a useful resource for anyone interested. Cheers and Happy Coding for everyone!,Oscar

    Read the article

  • Browser Statistics for Geekswithblogs.net

    - by Jeff Julian
    I love Google Analytics!  It helps me so much during my day-to-day maintenance of Geekswithblogs.net and our other sites.  I can see so much data about our visitors and come up with new ways of delivering more content to our readers so they can really get the most out of our community.  Browsers and Browser Versions is a big indicator for me to help decide what we can support and what we need to be testing with.  The clear browsers of choice right now are Chrome, IE, and Firefox taking up 94.1%.  The next browser is Safari at 2.71%.  What this really brings to my attention besides I better test well with Chrome, Firefox, and IE is that we are definitely missing an opportunity with Mobile devices.  We really need to kick up the heat when it comes to a mobile presence with Geekswithblogs.net as a community and the blogs that are on this site.  We need easy discovery of new content and easy tracking of what I like.  I am definitely on mission to make this happen and it will be a phased approach, but I want to see these numbers changes since most of us have 2 or 3 mobile devices we use for Social activities, but tools are lacking for interacting with technical data besides RSS readers. Technorati Tags: Mobile,Geekswithblogs.net,Browsers

    Read the article

  • How to change the Target URL of EditForm.aspx, DispForm.aspx and NewForm.aspx

    - by Jayant Sharma
    Hi All, To changing the URL of ListForms we have very limited options. On Inernet if you search you will lots of article about Customization of List Forms using SharePoint Desinger, but the disadvantage of SharePoint Desinger is, you cannot create wsp of the customization means what ever changes you have done in UAT environment you need to repeat the same at Production. This is the main reason I donot like SharePoint Desinger more. I always prefer to create WSP file and Deployment of WSP file will do all of my work. Now, If you want to change the ListForm URL using Visual Studio, either you have create new List Defintion or Create New Content Type. I found some very good article and want to share.. http://www.codeproject.com/Articles/223431/Custom-SharePoint-List-Forms http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2011/05/12/sharepoint-2010-cookbook-how-to-create-a-customized-list-edit-form-for-development-in-visual-studio-2010.aspx Whenever you create, either List Defintion or Content type and specify the URL for List Forms it will automatically add ListID and ItemID (No ItemID in case of NewForm.aspx) in the URL as Querystring, so if you want to redirect it or do some logic you can, as you got the ItemID as well as ListID.

    Read the article

  • How to Implement Single Sign-On between Websites

    - by hmloo
    Introduction Single sign-on (SSO) is a way to control access to multiple related but independent systems, a user only needs to log in once and gains access to all other systems. a lot of commercial systems that provide Single sign-on solution and you can also choose some open source solutions like Opensso, CAS etc. both of them use centralized authentication and provide more robust authentication mechanism, but if each system has its own authentication mechanism, how do we provide a seamless transition between them. Here I will show you the case. How it Works The method we’ll use is based on a secret key shared between the sites. Origin site has a method to build up a hashed authentication token with some other parameters and redirect the user to the target site. variables Status Description ssoEncode required hash(ssoSharedSecret + , + ssoTime + , + ssoUserName) ssoTime required timestamp with format YYYYMMDDHHMMSS used to prevent playback attacks ssoUserName required unique username; required when a user is logged in Note : The variables will be sent via POST for security reasons Building a Single Sign-On Solution Origin Site has function to 1. Create the URL for your Request. 2. Generate required authentication parameters 3. Redirect to target site. using System; using System.Web.Security; using System.Text; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string postbackUrl = "http://www.targetsite.com/sso.aspx"; string ssoTime = DateTime.Now.ToString("yyyyMMddHHmmss"); string ssoUserName = User.Identity.Name; string ssoSharedSecret = "58ag;ai76"; // get this from config or similar string ssoHash = FormsAuthentication.HashPasswordForStoringInConfigFile(string.Format("{0},{1},{2}", ssoSharedSecret, ssoTime, ssoUserName), "md5"); string value = string.Format("{0}:{1},{2}", ssoHash,ssoTime, ssoUserName); Response.Clear(); StringBuilder sb = new StringBuilder(); sb.Append("<html>"); sb.AppendFormat(@"<body onload='document.forms[""form""].submit()'>"); sb.AppendFormat("<form name='form' action='{0}' method='post'>", postbackUrl); sb.AppendFormat("<input type='hidden' name='t' value='{0}'>", value); sb.Append("</form>"); sb.Append("</body>"); sb.Append("</html>"); Response.Write(sb.ToString()); Response.End(); } } Target Site has function to 1. Get authentication parameters. 2. Validate the parameters with shared secret. 3. If the user is valid, then do authenticate and redirect to target page. 4. If the user is invalid, then show errors and return. using System; using System.Web.Security; using System.Text; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (User.Identity.IsAuthenticated) { Response.Redirect("~/Default.aspx"); } } if (Request.Params.Get("t") != null) { string ticket = Request.Params.Get("t"); char[] delimiters = new char[] { ':', ',' }; string[] ssoVariable = ticket.Split(delimiters, StringSplitOptions.None); string ssoHash = ssoVariable[0]; string ssoTime = ssoVariable[1]; string ssoUserName = ssoVariable[2]; DateTime appTime = DateTime.MinValue; int offsetTime = 60; // get this from config or similar try { appTime = DateTime.ParseExact(ssoTime, "yyyyMMddHHmmss", null); } catch { //show error return; } if (Math.Abs(appTime.Subtract(DateTime.Now).TotalSeconds) > offsetTime) { //show error return; } bool isValid = false; string ssoSharedSecret = "58ag;ai76"; // get this from config or similar string hash = FormsAuthentication.HashPasswordForStoringInConfigFile(string.Format("{0},{1},{2}", ssoSharedSecret, ssoTime, ssoUserName), "md5"); if (string.Compare(ssoHash, hash, true) == 0) { if (Math.Abs(appTime.Subtract(DateTime.Now).TotalSeconds) > offsetTime) { //show error return; } else { isValid = true; } } if (isValid) { //Do authenticate; } else { //show error return; } } else { //show error } } } Summary This is a very simple and basic SSO solution, and its main advantage is its simplicity, only needs to add a single page to do SSO authentication, do not need to modify the existing system infrastructure.

    Read the article

  • How to Change System Application Pages (Like AccessDenied.aspx, Signout.aspx etc)

    - by Jayant Sharma
    An advantage of SharePoint 2010 over SharePoint 2007 is, we can programatically change the URL of System Application Pages. For Example, It was not very easy to change the URL of AccessDenied.aspx page in SharePoint 2007 but in SharePoint 2010 we can easily change the URL with just few lines of code. For this purpose we have two methods available: GetMappedPage UpdateMappedPage: returns true if the custom application page is successfully mapped; otherwise, false. You can override following pages. Member name Description None AccessDenied Specifies AccessDenied.aspx. Confirmation Specifies Confirmation.aspx. Error Specifies Error.aspx. Login Specifies Login.aspx. RequestAccess Specifies ReqAcc.aspx. Signout Specifies SignOut.aspx. WebDeleted Specifies WebDeleted.aspx. ( http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.spcustompage.aspx ) So now Its time to implementation, using (SPSite site = new SPSite(http://testserver01)) {   //Get a reference to the web application.   SPWebApplication webApp = site.WebApplication;   webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, "/_layouts/customPages/CustomAccessDenied.aspx");   webApp.Update(); } Similarly, you can use  SPCustomPage.Confirmation, SPCustomPage.Error, SPCustomPage.Login, SPCustomPage.RequestAccess, SPCustomPage.Signout and SPCustomPage.WebDeleted to override these pages. To  reset the mapping, set the Target value to Null like webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.AccessDenied, null);webApp.Update();One restricted to location in the /_layouts folder. When updating the mapped page, the URL has to start with “/_layouts/”. Ref: http://msdn.microsoft.com/en-us/library/gg512103.aspx#bk_spcustapp http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.updatemappedpage.aspx

    Read the article

  • Multiple instances of Intellitrace.exe process

    - by Vincent Grondin
    Not so long ago I was confronted with a very bizarre problem… I was using visual studio 2010 and whenever I opened up the Test Impact view I would suddenly see my pc perf go down drastically…  Investigating this problem, I found out that hundreds of “Intellitrace.exe” processes had been started on my system and I could not close them as they would re-start as soon as I would close one.  That was very weird.  So I knew it had something to do with the Test Impact but how can this feature and Intellitrace.exe going crazy be related?  After a bit of thinking I remembered that a teammate (Etienne Tremblay, ALM MVP) had told me once that he had seen this issue before just after installing a MOCKING FRAMEWORK that uses the .NET Profiler API…  Apparently there’s a conflict between the test impact features of Visual Studio and some mocking products using the .NET profiler API…  Maybe because VS 2010 also uses this feature for Test Impact purposes, I don’t know… Anyways, here’s the fix…  Go to your VS 2010 and click the “Test” menu.  Then go to the “Edit Test Settings” and choose EACH test setting file applying the following actions (normally 2 files being “Local” and TraceAndTestImpact”: -          Select the Data And Diagnostic option on the left -          Make sure that the ASP.NET Client Proxy for Intellitrace and Test Impact option is NOT SELECTED -          Make sure that the Test Impact option is NOT SELECTED -          Save and close   Edit Test Settings   Problem solved…  For me having to choose between the “Test Impact” features and the “Mocking Framework” was a no brainer, bye bye test impact…  I did not investigate much on this subject but I feel there might be a way to have them both working by enabling one after the other in a precise sequence…  Feel free to leave a comment if you know how to make them both work at the same time!   Hope this helps someone out there !

    Read the article

  • The Iron Bird Approach

    - by David Paquette
    It turns out that designing software is not so different than designing commercial aircraft.  I just finished watching a video that talked about the approach that Bombardier is taking in designing the new C Series aircraft.  I was struck by the similarities to agile approaches to software design.  In the video, Bombardier describes how they are using an Iron Bird to work through a number of design questions in advance of ever having a version of the aircraft that can ever be flown.  The Iron Bird is a life size replica of the plane.  Based on the name, I would assume the plane is built in a very heavy material that could never fly.  Using this replica, Bombardier is able to valid certain assumptions such as the length of each wire in the electric system.  They are also able to confirm that some parts are working properly (like the rudders).  They even go as far as to have a complete replica of the cockpit.  This allows Bombardier to put pilots in the cockpit to run through simulated take-off and landing sequences. The basic tenant of the approach seems to be Validate your design early with working prototypes Get feedback from users early, well in advance of finishing the end product   In software development, we tend to think of ourselves as special.  I often tell people that it is difficult to draw comparisons to building items in the physical world (“Building software is nothing like building a sky scraper”).  After watching this video, I am wondering if designing/building software is actually a lot like designing/building commercial aircraft.   Watch the video here (http://www.theglobeandmail.com/report-on-business/video/video-selling-the-c-series/article4400616/)

    Read the article

  • 10 steps to enable &lsquo;Anonymous Access&rsquo; for your SharePoint 2010 site

    - by KunaalKapoor
    What’s Anonymous Access? Anonymous access to your SharePoint site enables all visitors to view your SharePoint site anonymously without having to log in. With this blog I’d like to go through an easy step wise procedure to enable/set up anonymous access. Before you actually enable anonymous access on the site, you’ll have to change some settings at the web app level. So let’s start with that: Prerequisite(s): 1. A hosted SharePoint 2010 farm/server. 2. An existing SharePoint site. I just thought I’d mention the above pre-reqs, since the steps mentioned below would’nt be valid or a different type of a site. Step 1: In Central Administration, under Application Management, click on the Manage web applications. Step 2: Now select the site you want to enable anonymous access and click on the Authentication Providers icon. Step 3: On the modal window click on the Default zone. Step 4: Now under the Edit Authentication section, check Enable anonymous access and click Save. This is basically to make the Anonymous Access authentication mechanism available at the web app level @ IIS. Now, web application will allow anonymous access to be set. 5. Going back to Web Application Management click on the Anonymous Policy icon. Step 6: Also before we proceed any further, under the Anonymous Access Restrictions (@ web app mgmt.) select your Zone and set the Permissions to None – No policy and click Save. Step 7:  Now lets navigate to your top level site collection for the web application. Click the Site Actions > Site Settings. Under Users and Permissions click Site permissions. Step 8: Under Users and Permissions, click on Site Permissions. Step 9: Under the Edit tab, click on Anonymous Access. Step 10: Choose whether you want Anonymous users to have access to the entire Web site or to lists and libraries only, and then click on OK. You should now be able to see the view as below under your permissions Also keep in mind: If you are trying to access the site from a browser within the domain, then you’ll need to change some browser settings to see the after affects. Normally this is because the browsers (Internet Explorer) is set to log in automatically to intranet zone only , not sure if you have explicitly changed the zones and added it to trusted sites. If this is from a box within your domain please try to access the site by temporarily changing the Internet Explorer setting to Anonymous Logon on the zone that the site is added example "Intranet" and try . You will find the same settings by clicking on Tools > Internet Options > Security Tab.

    Read the article

  • Connect to QuickBooks from PowerBuilder using RSSBus ADO.NET Data Provider

    - by dataintegration
    The RSSBus ADO.NET providers are easy-to-use, standards based controls that can be used from any platform or development technology that supports Microsoft .NET, including Sybase PowerBuilder. In this article we show how to use the RSSBus ADO.NET Provider for QuickBooks in PowerBuilder. A similar approach can be used from PowerBuilder with other RSSBus ADO.NET Data Providers to access data from Salesforce, SharePoint, Dynamics CRM, Google, OData, etc. In this article we will show how to create a basic PowerBuilder application that performs CRUD operations using the RSSBus ADO.NET Provider for QuickBooks. Step 1: Open PowerBuilder and create a new WPF Window Application solution. Step 2: Add all the Visual Controls needed for the connection properties. Step 3: Add the DataGrid control from the .NET controls. Step 4:Configure the columns of the DataGrid control as shown below. The column bindings will depend on the table. <DataGrid AutoGenerateColumns="False" Margin="13,249,12,14" Name="datagrid1" TabIndex="70" ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=ID}" Header="ID" Width="SizeToHeader" /> <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=Name}" Header="Name" Width="SizeToHeader" /> ... </DataGrid.Columns> </DataGrid> Step 5:Add a reference to the RSSBus ADO.NET Provider for QuickBooks assembly. Step 6:Optional: Set the QBXML Version to 6. Some of the tables in QuickBooks require a later version of QuickBooks to support updates and deletes. Please check the help for details. Connect the DataGrid: Once the visual elements have been configured, developers can use standard ADO.NET objects like Connection, Command, and DataAdapter to populate a DataTable with the results of a SQL query: System.Data.RSSBus.QuickBooks.QuickBooksConnection conn conn = create System.Data.RSSBus.QuickBooks.QuickBooksConnection(connectionString) System.Data.RSSBus.QuickBooks.QuickBooksCommand comm comm = create System.Data.RSSBus.QuickBooks.QuickBooksCommand(command, conn) System.Data.DataTable table table = create System.Data.DataTable System.Data.RSSBus.QuickBooks.QuickBooksDataAdapter dataAdapter dataAdapter = create System.Data.RSSBus.QuickBooks.QuickBooksDataAdapter(comm) dataAdapter.Fill(table) datagrid1.ItemsSource=table.DefaultView The code above can be used to bind data from any query (set this in command), to the DataGrid. The DataGrid should have the same columns as those returned from the SELECT statement. PowerBuilder Sample Project The included sample project includes the steps outlined in this article. You will also need the QuickBooks ADO.NET Data Provider to make the connection. You can download a free trial here.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >