Search Results

Search found 1817 results on 73 pages for 'corina 123'.

Page 55/73 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Use MySQL trigger to update another table when duplicate key found

    - by Jason
    Been scratching my head on this one, hoping one of you kind people and direct me towards solving this problem. I have a mysql table of customers, it contains a lot of data, but for the purpose of this question, we only need to worry about 4 columns 'ID', 'Firstname', 'Lastname', 'Postcode' Problem is, the table contains a lot of duplicated customers. A new table is being created where each customer is unique and for us, we decide a unique customer is based on 'Firstname', 'Lastname' and 'Postcode' However, (this is the important bit) we need to ensure each new "unique" customer record also can be matched to the original multiple entries of that customer in the original table. I believe the best way to do this is to have a third table, that has 'NewUniqueID', 'OldCustomerID'. So we can search this table for 'NewUniqueID' = '123' and it would return multiple 'OldCustomerID' values where appropriate. I am hoping to make this work using a trigger and the on duplicate key syntax. So what would happen is as follows: An query is run taking the old customer table and inserting it in to the new unique table. (A standard Insert Select query) On duplicate key continue adding records, but add one entry in to the third table noting the 'NewUniqueID' that duped along with the 'OldCustomerID' of the record we were trying to insert. Hope this makes sense, my apologies if it isn't clear. I welcome and appreciate any thoughts on this one! Many thanks Jason

    Read the article

  • Publish Git repository to SVN

    - by Ken Williams
    I and my small team work in Git, and the larger group uses Subversion. I'd like to schedule a cron job to publish our repositories current HEADs every hour into a certain directory in the SVN repo. I thought I had this figured out, but the recipe I wrote down previously doesn't seem to be working now: git clone ssh://me@gitserver/git-repo/Projects/ProjX px2 cd px2 svn mkdir --parents http://me@svnserver/svn/repo/play/me/fromgit/ProjX git svn init -s http://me@svnserver/svn/repo/play/me/fromgit/ProjX git svn fetch git rebase trunk master git svn dcommit Here's what happens when I attempt: % git clone ssh://me@gitserver/git-repo/Projects/ProjX px2 Cloning into 'ProjX'... ... % cd px2 % svn mkdir --parents http://me@svnserver/svn/repo/play/me/fromgit/ProjX Committed revision 123. % git svn init -s http://me@svnserver/svn/repo/play/me/fromgit/ProjX Using higher level of URL: http://me@svnserver/svn/repo/play/me/fromgit/ProjX => http://me@svnserver/svn/repo % git svn fetch W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/play/me/fromgit/ProjX' W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. This may take a while on large repositories % git rebase trunk master fatal: Needed a single revision invalid upstream trunk I could have sworn this worked previously, anyone have any suggestions? Thanks.

    Read the article

  • Android App crashing on Back Button (performResumeActivity)

    - by Rutger
    My App consists of 2 Activities at the moment. . the MAIN activity with a Gallery View . a FriendsListActivity with a ListView When the user moves away from the FriendsListActivity with the back button, and returns to the MAIN activity the following error keeps popping up in debug mode. DalvikVM[localhost:8676] Thread [<1 main] (Suspended (exception RuntimeException)) ActivityThread.performResumeActivity(IBinder, boolean) line: 2095 ActivityThread.handleResumeActivity(IBinder, boolean, boolean) line: 2110 BinderProxy(ActivityThread$H).handleMessage(Message) line: 954 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3647 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 507 ZygoteInit$MethodAndArgsCaller.run() line: 839 ZygoteInit.main(String[]) line: 597 NativeStart.main(String[]) line: not available [native method] Thread [<8 Binder Thread #2] (Running) Thread [<7 Binder Thread #1] (Running) With the LogCat 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): FATAL EXCEPTION: main 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): java.lang.RuntimeException: Unable to resume activity {com.package.MAIN/com.package.MAIN.MAIN}: java.lang.NullPointerException 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2095) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2110) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:954) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.os.Handler.dispatchMessage(Handler.java:99) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.os.Looper.loop(Looper.java:123) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.ActivityThread.main(ActivityThread.java:3647) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at java.lang.reflect.Method.invokeNative(Native Method) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at java.lang.reflect.Method.invoke(Method.java:507) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at dalvik.system.NativeStart.main(Native Method) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): Caused by: java.lang.NullPointerException 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at com.package.MAIN.MAIN.onResume(MAIN.java:91) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.Activity.performResume(Activity.java:3833) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2085) 03-13 22:01:10.972: ERROR/AndroidRuntime(1038): ... 10 more Further info in the Variables panel states: this: ActivityThread e: NullPointerException cause: NullPointerException detailMessage: null stackTrace: null r: ActivityThread$ActivityClientRecord activity: MAIN detailMessage after one Eclipse Resume: Unable to resume activity (MAIN) The code from the FriendsListActivity looks like this public class FriendsListActivity extends ListActivity { // =========================================================== // Fields // =========================================================== private ArrayList<Friend> friends = new ArrayList<Friend>(); private FriendsArrayAdapter friendsArrayAdapter; private ListView listView; // =========================================================== // onCreate // =========================================================== @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.friends_list); registerForContextMenu(getListView()); setButtonNewFriendClickListener(); } public void generateFriendsList() { FriendsService fs = new FriendsService(this); friends = fs.getFriendsList(); listView = (ListView) findViewById(android.R.id.list); friendsArrayAdapter = new FriendsArrayAdapter( this, R.layout.friend_list_item, friends); listView.setAdapter(friendsArrayAdapter); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.friends_context_menu, menu); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); FriendsService fs = new FriendsService(this); Friend f = new Friend(); f = friends.get(info.position); switch (item.getItemId()) { case R.id.edit: Intent i = new Intent(this, FriendEditActivity.class); i.putExtra("userid", f.userId); startActivity(i); return true; case R.id.delete: fs.deleteFriend(f.userId); generateFriendsList(); return true; default: return super.onContextItemSelected(item); } } // =========================================================== // onPause // =========================================================== protected void onPause() { super.onPause(); finish(); } // =========================================================== // onResume // =========================================================== protected void onResume() { super.onResume(); generateFriendsList(); } // =========================================================== // onStop // =========================================================== protected void onStop() { super.onStop(); } // =========================================================== // onDestroy // =========================================================== @Override protected void onDestroy() { super.onDestroy(); } // =========================================================== // Activity methods // =========================================================== private void setButtonNewFriendClickListener() { Button clickButton = (Button)findViewById(R.id.button_add_friend); clickButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(v.getContext(), FriendNewActivity.class); startActivity(i); } }); } The AndroidManifest looks like this <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.package.mypackage"> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name="com.package.mypackage.mypackage" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".FriendsListActivity"></activity> <activity android:name=".FriendEditActivity"></activity> <activity android:name=".FriendNewActivity"></activity> <activity android:name=".TakePictureActivity"></activity> <activity android:name=".FriendsService"></activity> <activity android:name=".MyService"></activity> </application> <uses-sdk android:minSdkVersion="9" /> The MAIN activity looks like this: package com.package.mypackage; import java.util.ArrayList; import com.package.domain.Domain; import com.package.service.MyService; import com.package.viewadapter.myImageAdapter; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.Button; import android.widget.Gallery; import android.widget.Toast; public class myActivity extends Activity { // =========================================================== // Fields // =========================================================== private MyImageAdapter myImageAdapter; private ArrayList<Domain> domain = new ArrayList<Domain>(); // =========================================================== // onCreate // =========================================================== @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); /* Set Buttons to listen for any click event. */ setButtonFriendsClickListener(); setButtonCameraClickListener(); setButtonPreferencesClickListener(); } // =========================================================== // onStart // =========================================================== @Override public void onStart() { super.onStart(); /* Find the gallery defined in the main.xml */ Gallery g = (Gallery) findViewById(R.id.gallery); /* Show a Toast message when image is clicked */ g.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { MyImageAdapter image_ID = new MyImageAdapter(myActivity.this, position, null); if (image_ID.getItemId(position) == 0) { Toast test_toast = Toast.makeText(myActivity.this, "This is the New Image click", Toast.LENGTH_SHORT); test_toast.show(); } else { Toast test_toast = Toast.makeText(myActivity.this, "The clicked image has image number " + image_ID.getItemId(position) + " in the imageadapter.", Toast.LENGTH_SHORT); test_toast.show(); } } }); g.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View v, int position, long id) { MyImageAdapter image_ID = new MyImageAdapter(myActivity.this, position, null); Toast test_toast = Toast.makeText(myActivity.this, "The long clicked image has image number " + image_ID.getItemId(position) + " in the imageadapter.", Toast.LENGTH_SHORT); test_toast.show(); return true; } }); } // =========================================================== // onPause // =========================================================== protected void onPause() { super.onPause(); } // =========================================================== // onResume // =========================================================== protected void onResume() { super.onResume(); generateMyGallery(); } // =========================================================== // onStop // =========================================================== protected void onStop() { super.onStop(); } // =========================================================== // onDestroy // Is also called when user changes from horizontal // to vertical orientation and back // =========================================================== @Override protected void onDestroy() { super.onDestroy(); } // =========================================================== // Save and Restore UI states // =========================================================== @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); } protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); } // =========================================================== // Main Activity methods // =========================================================== public void generateMyGallery() { MyService cs = new MyService(this); domain = cs.getDomainList(); // Add the new_image drawable to the ArrayList Domain d = new Domain(); d.photoLocation = "drawable"; d.photoName = "new_image"; d.extra1 = "no_text"; d.extra2 = "no_text"; domain.add(0, d); myImageAdapter = new MyImageAdapter(this, R.layout.text_overlay_image_view, domain); /* Find the gallery defined in the main.xml */ Gallery g = (Gallery) findViewById(R.id.gallery); g.setSpacing(10); /* Apply a new (custom) ImageAdapter to it. */ g.setAdapter(myImageAdapter); g.setSelection(1); } private void setButtonFriendsClickListener() { Button clickButton = (Button)findViewById(R.id.button_friends_list); clickButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { setContentView(R.layout.friends_list); Intent myIntent = new Intent(v.getContext(), FriendsListActivity.class); startActivity(myIntent); } }); } private void setButtonCameraClickListener() { Button clickButton = (Button)findViewById(R.id.button_take_picture); clickButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { setContentView(R.layout.take_picture); Intent myIntent = new Intent(v.getContext(), TakePictureActivity.class); startActivity(myIntent); } }); } private void setButtonPreferencesClickListener() { Button clickButton = (Button)findViewById(R.id.button_preferences); clickButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(v.getContext(), MyPreferencesActivity.class); startActivity(myIntent); } }); } }; Anyone has an idea why the App crashes. Any help is much appreciated. I did find out that, when I finish() the MAIN activity when I start the FriendListActivity and restart the MAIN activity when closing the FriendListActivity, that the crash does not occur. However, this basically restarts the App and that is not the intention. Thanks all, I got the problem solved. This is what I did. . When moving all gallery related actions to the onCreate, the creash didn't happen anymore. But then after returning to the MAIN activity, the activity wasn't shown. . I then moved all the onCreate (except the super), the generateGallery, and the onStart() to the onResume. Now it works fine!

    Read the article

  • How to direct link to an attribute set?

    - by monocat
    I have created attributes; “Shop by Type” and “Shop by Color”. They work great within the layered navigation and extended search. I’ve designed graphics and placed them in the home page and would like to link to the respective attribute’s assigned products. Been searching the webs, but so far have been unsuccessful. If there’s no direct possible way, the next method would be creating cms pages and linking to it directly. How can I display products that are assigned to a specific attribute? Specifically “Multiple Select” types. I know you guys prefer at least some attempts, but as mentioned, been playing with it with no luck. I would appreciate some kind of starting point. Happy Holidays! Edit: I was able to put together this code that lists all the products assigned to said category id. Tried to filter it down where it only displays products that have an assigned same attribute with no luck yet. Any ideas? <?php $cat_id = 123; // category id $category = Mage::getModel('catalog/category')->load($cat_id); $_products = $category->getProductCollection() ->addAttributeToSelect('shop_by_color'); if (($this->getProductCollection()) && $_products->getSize()): ?> By the way, $cat_id is a sub category of root. Is there an easier way to point to it instead of using direct id number?

    Read the article

  • T-SQL Query, combine columns from multiple rows into single column

    - by Shayne
    I have seeen some examples of what I am trying to do using COALESCE and FOR XML (seems like the better solution). I just can't quite get the syntax right. Here is what I have (I will shorten the fields to only the key ones): Table Fields ------ ------------------------------- Requisition ID, Number IssuedPO ID, Number Job ID, Number Job_Activity ID, JobID (fkey) RequisitionItems ID, RequisitionID(fkey), IssuedPOID(fkey), Job_ActivityID (fkey) I need a query that will list ONE Requisition per line with its associated Jobs and IssuedPOs. (The requisition number start with "R-" and the Job Number start with "J-"). Example: R-123 | "PO1; PO2; PO3" | "J-12345; J-6780" Sure thing Adam! Here is a query that returns multiple rows. I have to use outer joins, since not all Requisitions have RequisitionItems that are assigned to Jobs and/or IssuedPOs (in that case their fkey IDs would just be null of course). SELECT DISTINCT Requisition.Number, IssuedPO.Number, Job.Number FROM Requisition INNER JOIN RequisitionItem on RequisitionItem.RequisitionID = Requisition.ID LEFT OUTER JOIN Job_Activity on RequisitionItem.JobActivityID = Job_Activity.ID LEFT OUTER JOIN Job on Job_Activity.JobID = Job.ID LEFT OUTER JOIN IssuedPO on RequisitionItem.IssuedPOID = IssuedPO.ID

    Read the article

  • Get top 2 rows from each unique field in a column

    - by Sai
    I have a table named tblItemResources in which I want to get the only 2 rows from each unique field in a column named effectiveDate (order by: ascending): tblItemResources Table |   empID   |   effectiveDate    |    Company   |    Description |   0-123    |    2014-01-23     |   DFD Comp  |   Analyst |   0-234    |    2014-01-23     |   ABC Comp   |  Manager |   0-222    |    2012-02-19     |   CDC Comp  |  Janitor |   0-213    |    2012-03-13     |   CBB Comp  |  Teller and so on. Any help would be much appreciated.

    Read the article

  • Google appEngine: 404 when accesing /_ah/api

    - by jfu
    I try to build a very simple GAE application, using eclipse and the Google Plugin for Eclipse. I've generated some Endpoint from an @Entity class, then I've generated Cloud Endpoint Client library. After that I've started the appEngine project (within eclipse, on the embedded jetty server). When I try to access /_ah/api I get the following issue: HTTP ERROR 500 Problem accessing /_ah/api/. Reason: Failed to retrieve API configs with status: 404 Caused by: java.io.IOException: Failed to retrieve API configs with status: 404 at com.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources(ApiServlet.java:102) at com.google.api.server.spi.tools.devserver.ApiServlet.initConfigsIfNecessary(ApiServlet.java:67) at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:368) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:351) at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) What am I doing wrong?

    Read the article

  • C++ BigInt multiplication conceptual problem

    - by Kapo
    I'm building a small BigInt library in C++ for use in my programming language. The structure is like the following: short digits[ 1000 ]; int len; I have a function that converts a string into a bigint by splitting it up into single chars and putting them into digits. The numbers in digits are all reversed, so the number 123 would look like the following: digits[0]=3 digits[1]=3 digits[2]=1 I have already managed to code the adding function, which works perfectly. It works somewhat like this: overflow = 0 for i ++ until length of both numbers exceeded: add numberA[ i ] to numberB[ i ] add overflow to the result set overflow to 0 if the result is bigger than 10: substract 10 from the result overflow = 1 put the result into numberReturn[ i ] (Overflow is in this case what happens when I add 1 to 9: Substract 10 from 10, add 1 to overflow, overflow gets added to the next digit) So think of how two numbers are stored, like those: 0 | 1 | 2 --------- A 2 - - B 0 0 1 The above represents the digits of the bigints 2 (A) and 100 (B). - means uninitialized digits, they aren't accessed. So adding the above number works fine: start at 0, add 2 + 0, go to 1, add 0, go to 2, add 1 But: When I want to do multiplication with the above structure, my program ends up doing the following: Start at 0, multiply 2 with 0 (eek), go to 1, ... So it is obvious that, for multiplication, I have to get an order like this: 0 | 1 | 2 --------- A - - 2 B 0 0 1 Then, everything would be clear: Start at 0, multiply 0 with 0, go to 1, multiply 0 with 0, go to 2, multiply 1 with 2 How can I manage to get digits into the correct form for multiplication? I don't want to do any array moving/flipping - I need performance!

    Read the article

  • I need Selenium to open it's web browser in a larger resolution ( preferably maximized)

    - by user1854271
    I am using Selenium WebDriver and coding in Python I have looked all over the place and the best I could find were things written in different languages. I also tried to use the export tool on Selenium IDE but when I look at the data says that the function is not supported for export. EDIT: The reason I need the browser to open up with a larger resolution is because the web application that I am testing is supporting tablet resolution as so elements are different depending on the resolution of the browser window. This is the script I exported from the IDE with a couple of modifications. from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException import unittest, time, re from Funk_Lib import RS class CreatingEditingDeletingVault(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://cimdev-qa40/" self.verificationErrors = [] def test_creating_editing_deleting_vault(self): driver = self.driver driver.get(self.base_url + "/Login?contoller=Home") driver.find_element_by_id("UserName").click() driver.find_element_by_id("UserName").clear() driver.find_element_by_id("UserName").send_keys("[email protected]") driver.find_element_by_name("Password").click() driver.find_element_by_name("Password").clear() driver.find_element_by_name("Password").send_keys("Codigo#123") driver.find_element_by_id("fat-btn").click() driver.get(self.base_url + "/Content/Vaults/") driver.find_element_by_link_text("Content").click() driver.find_element_by_link_text("Vaults").click() driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() driver.find_element_by_link_text("New vault").click() driver.find_element_by_name("Name").clear() driver.find_element_by_name("Name").send_keys("Test Vault") driver.find_element_by_xpath("//button[@onclick=\"vault_action('createvault', null, $('#CreateVault [name=\\'Name\\']').val())\"]").click() driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() driver.find_element_by_link_text("Rename vault").click() driver.find_element_by_name("Id").click() Select(driver.find_element_by_name("Id")).select_by_visible_text("Test Vault") driver.find_element_by_css_selector("option[value=\"2\"]").click() driver.find_element_by_name("Name").clear() driver.find_element_by_name("Name").send_keys("Test Change") driver.find_element_by_xpath("//button[@onclick=\"vault_action('renamevault', $('#RenameVault [name=\\'Id\\']').val(), $('#RenameVault [name=\\'Name\\']').val())\"]").click() driver.find_element_by_css_selector("button.btn.dropdown-toggle").click() driver.find_element_by_link_text("Delete vault").click() driver.find_element_by_name("Id").click() Select(driver.find_element_by_name("Id")).select_by_visible_text("Test Change") driver.find_element_by_css_selector("option[value=\"2\"]").click() driver.find_element_by_xpath("//button[@onclick=\"vault_action('deletevault', $('#DeleteVault [name=\\'Id\\']').val(), '')\"]").click() def is_element_present(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException, e: return False return True def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main()

    Read the article

  • Is it possible to return a list of numbers from a Sybase function?

    - by ps_rs4
    I'm trying to overcome a very serious performance issue in which Sybase refuses to use the primary key index on a large table because one of the required fields is specified indirectly through another table - or, in other words; SELECT ... FROM BIGTABLE WHERE KFIELD = 123 runs in ms but SELECT ... FROM BIGTABLE, LTLTBL WHERE KFIELD = LTLTBL.LOOKUP AND LTLTBL.UNIQUEID = 'STRINGREPOF123' takes 30 - 40 seconds. I've managed to work around this first problem by using a function that basically lets me do this; SELECT ... FROM BIGTABLE WHERE KFIELD = MYFUNC('STRINGREPOF123') which also runs in ms. The problem, however, is that this approach only works when there is a single value returned by MYFUNCT but I have some cases where it may return 2 or 3 values. I know that the SQL SELECT ... FROM BIGTABLE WHERE KFIELD IN (123,456,789) also returns in millis so I'd like to have a function that returns a list of possible values rather than just a single one - is this possible? Sadly the application is running on Sybase ASA 9. Yes I know it is old and is scheduled to be refreshed but there's nothing I can do about it now so I need logic that will work with this version of the DB. Thanks in advance for any assistance on this matter.

    Read the article

  • Grouping arrays with consecutive keys

    - by KPL
    Hello people, I've an array like this - Array ( [16] => 424 [17] => 404 [18] => 416 [21] => 404 [22] => 456 [23] => 879 [28] => 456 [29] => 456 [32] => 123 [35] => 465 ) The output of this array would be Array ( [0] => Array ( ['start'] => 16 ['stop'] => 18 ) [1] => Array ( ['start'] => 21 ['stop'] => 23 ) [2] => Array ( ['start'] => 28 ['stop'] => 29 ) [3] => Array ( ['start'] => 32 ['stop'] => 33 ) [4] => Array ( ['start'] => 35 ['stop'] => 36 ) ) I don't really need the values. Just grouping the keys. And if consecutive integer doesn't exist for a particular key(like for [32] and [35]), 'stop' should be the consecutive integer. Thank you all for help.

    Read the article

  • Is it true that in most Object Oriented Programming Languages, an "i" in an instance method always r

    - by Jian Lin
    In the following code: <script type="text/javascript"> var i = 10; function Circle(radius) { this.r = radius; this.i = radius; } Circle.i = 123; Circle.prototype.area = function() { alert(i); } var c = new Circle(1); var a = c.area(); </script> What is being alerted? The answer is at the end of this question. I found that the i in the alert call either refers to any local (if any), or the global variable. There is no way that it can be the instance variable or the class variable even when there is no local and no global defined. To refer to the instance variable i, we need this.i, and to the class variable i, we need Circle.i. Is this actually true for almost all Object oriented programming languages? Any exception? Are there cases that when there is no local and no global, it will look up the instance variable and then the class variable scope? (or in this case, are those called scope?) the answer is: 10 is being alerted.

    Read the article

  • Android :WindowManager$BadTockenException on Spinner Click

    - by Miya
    Hi, I have a spinner in my home.class. When I click on the spinner, the process is stopped showing exception that WindowManager$BadTockenException is caught. I am calling this home.class from main.class which extends ActivityGroup. If I am simply run only the home.class, the spinner is showing all items. But the problem is only with calling home.class from main.class. The following are my code. Please tell me why this is happened. main.class public class main extends ActivityGroup { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent=new Intent(this,home.class); View view=getLocalActivityManager().startActivity("1", intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); setContentView(view); } } home.class String[] country={"Please selects","US","INDIA","UK"}; Spinner s2 = (Spinner) findViewById(R.id.spinnerCountry); ArrayAdapter<CharSequence> adapterCountry=new ArrayAdapter(this,android.R.layout.simple_spinner_item,country); adapterCountry.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s2.setAdapter(adapterCountry); s2.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected( AdapterView<?> parent, View view, int position, long id) { countryName=country[position]; } public void onNothingSelected(AdapterView<?> parent) { countryName=country[0]; } }); Stack Thread [<1 main] (Suspended (exception WindowManager$BadTokenException)) AlertDialog(Dialog).show() line: 245 AlertDialog$Builder.show() line: 802 Spinner.performClick() line: 260 View$PerformClick.run() line: 9080 ViewRoot(Handler).handleCallback(Message) line: 587 ViewRoot(Handler).dispatchMessage(Message) line: 92 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3647 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 507 ZygoteInit$MethodAndArgsCaller.run() line: 839 ZygoteInit.main(String[]) line: 597 NativeStart.main(String[]) line: not available [native method] Thank You....

    Read the article

  • Using C# to parse a SOAP Response

    - by Gavin
    I am trying to get the values for faultcode, faultstring, and OrderNumber from the SOAP below <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <faultcode>1234</faultcode> <faultstring>SaveOrder:SetrsOrderMain:Cannot change OrderDate if GLPeriod is closed, new OrderDate is 3/2/2010:Ln:1053</faultstring> <detail> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body UserGUID="test"> <m:SaveOrder xmlns:m="http://www.test.com/software/schema/" UserGUID="test"> <Order OrderNumber="1234-1234-123" Caller="" OrderStatus="A" xmlns="http://www.test.com/software/schema/"> Here is my code in C# XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("XMLexample.xml")); var errorDetail = new EcourierErrorDetail { FaultCode = from fc in doc.Descendants("faultcode") select fc.Value, FaultString = from fs in c.Descendants("faultstring") select fs.Value, OrderNumber = from o in doc.Descendants("detail").Elements("Order").Attributes("OrderNumber") select o.Value }; return errorDetail; I am able to get the values for both faultcode and faultstring but not the OrderNumber. I am getting "Enumeration yielded no results." Can anyone help? Thanks.

    Read the article

  • HTML5 on iPhone Safari - data stored by localStorage does not always persist. Why?

    - by Aerodyne
    Hi, I write a simple iPhone web app using HTML5's localStorage. Tests on a 2G device show that data stored using localStorage does not persist after the Safari process is killed although the opened Safari windows are remembered. The data is also lost in a case where I am on a different site on a different Safari window, then I change the window to where the web app in subject is shown. When Safari loads the page it automatically refreshes the page. Then the data is lost. This is a simple test code: <html> <head> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> </head> <body> <script> alert("1:" + localStorage.getItem("test")); localStorage.setItem("test", "123"); alert("2:" + localStorage.getItem("test")); </script> </body> As far as I understand the data should persist! Can anyone shed some light on this behavior? What should I do to get the persistence to work? Thanks! Tom.

    Read the article

  • How to call Java code from Javascript and assign a value to a JSP page?

    - by Frank
    I have the following "form.jsp" program, it generates a drop down list, below the list is a textarea to show the display_name of a selected item, now when user selected a item, it shows the selected item id in the textarea, how to call the DB from my code and get the display_name in the javascript so the result display_name will be shown in the textarea ? <%@ taglib prefix="s" uri="/struts-tags"%> <script type="text/javascript"> function callme(Display_Name) { alert('callme : Display_Name = '+Display_Name); var v=document.getElementById('hiddenValue').value; alert('hiddenValue : v = '+v); document.getElementById('defaultDisplayName').value=Display_Name; } </script> <s:hidden id="pricelist.id" name="pricelist.id" value="%{pricelist.id}"/> <div class="dialog"> <table> <tbody> <s:if test="%{enableProductList}"> <tr class="prop"> <td valign="top" class="name required"><label for="description">Product:</label></td> <td valign="top"> <s:select id="productPrice.product" name="productPrice.product" headerKey="0" headerValue="-- Select Product --" list="products" listKey="id" listValue="name" value="productPrice.product.id" theme="simple" displayName1='value' onchange="callme(value)" /> <s:hidden id="hiddenValue" name="hiddenValue" value="123"/> </td> </tr> </s:if> <tr class="prop"> <td valign="top" class="name"><label for="description">Default Display Name:</label></td> <td valign="top"><s:textarea id="defaultDisplayName" name="defaultDisplayName" theme="simple" readonly="true"/></td> </tr> See attached image for details, in the DB, a product table has the product Id and display_name, I know the Id, how to use Java to get the display_name and plug it into the jsp ?

    Read the article

  • I need a fast runtime expression parser

    - by Chris Lively
    I need to locate a fast, lightweight expression parser. Ideally I want to pass it a list of name/value pairs (e.g. variables) and a string containing the expression to evaluate. All I need back from it is a true/false value. The types of expressions should be along the lines of: varA == "xyz" and varB==123 Basically, just a simple logic engine whose expression is provided at runtime. UPDATE At minimum it needs to support ==, !=, , =, <, <= Regarding speed, I expect roughly 5 expressions to be executed per request. We'll see somewhere in the vicinity of 100/requests a second. Our current pages tend to execute in under 50ms. Usually there will only be 2 or 3 variables involved in any expression. However, I'll need to load approximately 30 into the parser prior to execution. UPDATE 2012/11/5 Update about performance. We implemented nCalc nearly 2 years ago. Since then we've expanded it's use such that we average 40+ expressions covering 300+ variables on post backs. There are now thousands of post backs occurring per second with absolutely zero performance degradation. We've also extended it to include a handful of additional functions, again with no performance loss. In short, nCalc met all of our needs and exceeded our expectations.

    Read the article

  • Convert enumerated records to php object

    - by Matt H
    I have a table containing a bunch of records like this: +-----------+--------+----------+ | extension | fwd_to | type | +-----------+--------+----------+ | 800 | 11111 | noanswer | | 800 | 12345 | uncond | | 800 | 22222 | unavail | | 800 | 54321 | busy | | 801 | 123 | uncond | +-----------+--------+----------+ etc The query looks like this: select fwd_to, type from forwards where extension='800'; Now I get back an array containing objects which look like the following when printed with Kohana::debug: (object) stdClass Object ( [fwd_to] => 11111 [type] => noanswer ) (object) stdClass Object ( [fwd_to] => 12345 [type] => uncond ) (object) stdClass Object ( [fwd_to] => 22222 [type] => unavail ) (object) stdClass Object ( [fwd_to] => 54321 [type] => busy ) What I'd like to do is convert this to an object of this form: (object) stdClass Object ( [busy] => 54321 [uncond] => 12345 [unavail] => 22222 [noanswer] => 11111 ) The reason being I want to then call json_encode on it. This will allow me to use jquery populate to populate a form. Is there a suggested way I can do this nicely? I'm fairly new to PHP and I'm sure this is easy but it's eluding me at the moment.

    Read the article

  • drawing graphs in php

    - by user434885
    i am using php to generate graphs from arrays. I wish to create multiple graphs on the same page as i need to design a summary report from answers extracted from a database. Currently i am using this code and am only able to get one single graph. what additions to the code do i need to make to get multiple graphs? <?php function draw_graph($values) { // Get the total number of columns we are going to plot $columns = count($values); // Get the height and width of the final image $width = 300; $height = 200; // Set the amount of space between each column $padding = 5; // Get the width of 1 column $column_width = $width / $columns ; // Generate the image variables $im = imagecreate($width,$height); $gray = imagecolorallocate ($im,0xcc,0xcc,0xcc); $gray_lite = imagecolorallocate ($im,0xee,0xee,0xee); $gray_dark = imagecolorallocate ($im,0x7f,0x7f,0x7f); $white = imagecolorallocate ($im,0xff,0xff,0xff); // Fill in the background of the image imagefilledrectangle($im,0,0,$width,$height,$white); $maxv = 0; // Calculate the maximum value we are going to plot for($i=0;$i<$columns;$i++)$maxv = max($values[$i],$maxv); // Now plot each column for($i=0;$i<$columns;$i++) { $column_height = ($height / 100) * (( $values[$i] / $maxv) *100); $x1 = $i*$column_width; $y1 = $height-$column_height; $x2 = (($i+1)*$column_width)-$padding; $y2 = $height; imagefilledrectangle($im,$x1,$y1,$x2,$y2,$gray_dark); } header ("Content-type: image/png"); imagepng($im); imagedestroy($im); } $values = array("23","32","35","57","12"); $values2 = array("123","232","335","157","102"); draw_graph($values2); draw_graph($values);//no output is coming draw_graph($values2);//no output is coming draw_graph($values);//no output is coming ?>

    Read the article

  • are there requirements for Struts setters beyond variable name matching?

    - by slk
    I have a model-driven Struts Web action: public class ModelDrivenAction<T extends Object> implements ModelDriven<T>, Preparable { protected Long id; protected T model; @Override public void prepare() {} public void setId(Long id) { this.id = id; } @Override public T getModel() { return model; } public void setModel(T model) { this.model = model; } } I have another action which is not currently model-driven: public class OtherAction implements Preparable { private ModelObj modelObj; private Long modelId; @Override public void prepare() { modelObj = repoService.retrieveModelById(modelId); } public void setModelId(Long modelId) { this.modelId = modelId; } } I wish to make it so, and would like to avoid having to track down all the instances in JavaScript where the action is passed a "modelId" parameter instead of "id" if at all possible. I thought this might work, so either modelId or id could be passed in: public class OtherAction extends ModelDrivenAction<ModelObj> { @Override public void prepare() { model = repoService.retrieveModelById(id); } public void setModelId(Long modelId) { this.id = modelId; } } However, server/path/to/other!method?modelId=123 is failing to set id. I thought so long as a setter matched a parameter name the Struts interceptor would call it on action invocation. Am I missing something here?

    Read the article

  • Getting JSON object from php authentication objective c

    - by iError
    I am trying to authenticate using the below code NSString *urlAsString =[NSString stringWithFormat:@"http://www.myurl.com/abc/authenticate.php"]; NSURL *url = [NSURL URLWithString:urlAsString]; NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url]; [urlRequest setTimeoutInterval:30.0f]; [urlRequest setHTTPMethod:@"POST"]; [urlRequest addValue:@"test" forHTTPHeaderField:@"m_username" ]; [urlRequest addValue:@"123" forHTTPHeaderField:@"m_password" ]; [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self]; NSOperationQueue *queue = [[NSOperationQueue alloc] init]; [NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response,NSData *data, NSError *error) { if ([data length] >0 && error == nil){ html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"HTML = %@", html); receivedData = [NSMutableData data]; } else if ([data length] == 0 && error == nil){ NSLog(@"Nothing was downloaded."); } else if (error != nil){ NSLog(@"Error happened = %@", error); } }]; // Start loading data NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self]; if (theConnection) { // Create the NSMutableData to hold the received data receivedData = [NSMutableData data]; } else { // Inform the user the connection failed. } My username password is correct, I think I am not making the proper call thats why I dont get the desired results and the web service is receiving the null parameters. What can be the issue? Any help appreciated.

    Read the article

  • Anything wrong with this MySQL quert? takes 10 seconds+ to load

    - by user345426
    I have a search that is taking 10 seconds+ to execute! Keep in mind it is also searching over 200,000 products in the database. I posted the explain and MySQL query here. 1 SIMPLE p ref PRIMARY,products_status,prod_prodid_status,product... products_status 1 const 9048 Using where; Using temporary; Using filesort 1 SIMPLE v ref PRIMARY,vendors_id,vendors_vendorid vendors_vendorid 4 rhinomar_rhinomartnew.p.vendors_id 1 1 SIMPLE s ref products_id products_id 4 rhinomar_rhinomartnew.p.products_id 1 1 SIMPLE pd ref PRIMARY,products,prod_desc_prodid_prodname prod_desc_prodid_prodname 4 rhinomar_rhinomartnew.p.products_id 1 1 SIMPLE p2c ref PRIMARY,ptc_catidx PRIMARY 4 rhinomar_rhinomartnew.p.products_id 1 Using where; Using index 1 SIMPLE c eq_ref PRIMARY PRIMARY 4 rhinomar_rhinomartnew.p2c.categories_id 1 Using where MySQL Query: select p.products_id, p.products_image, p.products_price, p.products_weight, p.products_unit_quantity, s.specials_new_products_price, s.status, pd.products_name, pd.products_img_alt from products p left join vendors v ON v.vendors_id = p.vendors_id left join specials s on s.products_id = p.products_id left join products_description pd on pd.products_id = p.products_id left join products_to_categories p2c on p2c.products_id = p.products_id left join categories c on c.categories_id = p2c.categories_id where ( ( pd.products_name like '%apparel%' ) or p2c.categories_id IN (773, 132, 135, 136, 119, 122, 124, 125, 126, 1749, 1753, 1747, 123, 127, 130, 131, 178, 137, 140, 164, 165, 166, 167, 168, 169, 832, 2045 ) or p.products_id = 'apparel' or p.products_model = 'apparel' or CONCAT(v.vendors_prefix, '-') = 'apparel' or CONCAT( v.vendors_prefix, '-', p.products_id ) = 'apparel' ) and p.products_status = '1' and c.categories_status = '1' group by p.products_id order by pd.products_name

    Read the article

  • Many tables for many users?

    - by Seagull
    I am new to web programming, so excuse the ignorance... ;-) I have a web application that in many ways can be considered to be a multi-tenant environment. By this I mean that each user of the application gets their own 'custom' environment, with absolutely no interaction between those users. So far I have built the web application as a 'single user' environment. In other words, I haven't actually done anything to support multi-users, but only worked on the functionality I want from the app. Here is my problem... What's the best way to build a multi-user environment: All users point to the same 'core' backend. In other words, I build the logic to separate users via appropriate SQL queries (eg. select * from table where user='123' and attribute='456'). Each user points to a unique tablespace, which is built separately as they join the system. In this case I would simply generate ALL the relevant SQL tables per user, with some sort of suffix for the user. (eg. now a query would look like 'select * from table_ where attribute ='456'). In short, it's a difference between "select * from table where USER=" and "select * from table_USER".

    Read the article

  • Sql Alchemy Duplicated Commit

    - by PythonWolf
    Good Morning i'm currently facing a problem in my Cherrypy application. Im my own custom session module , anyway when performing session.add() The exact same object gets updated Twice. cherrypy.request.SessionManager.user_data = user try: db_session.add(cherrypy.request.SessionManager) db_session.commit() Will Return 2011-06-21 09:16:48,991 INFO sqlalchemy.engine.base.Engine.0x...04cL BEGIN (implicit) 2011-06-21 09:16:49,015 INFO sqlalchemy.engine.base.Engine.0x...04cL SELECT ..... FROM "Clients_Users" WHERE "Clients_Users".username = %(username_1)s AND "Clients_Users".password = %(password_1)s LIMIT 1 OFFSET 0 2011-06-21 09:16:49,015 INFO sqlalchemy.engine.base.Engine.0x...04cL {'password_1': '123', 'username_1': u'1'} 2011-06-21 09:16:49,047 INFO sqlalchemy.engine.base.Engine.0x...04cL UPDATE "SYS_Sessions" SET user_data=%(user_data)s WHERE "SYS_Sessions".id = %(SYS_Sessions_id)s 2011-06-21 09:16:49,067 INFO sqlalchemy.engine.base.Engine.0x...04cL {'SYS_Sessions_id': 92L, 'user_data': } 2011-06-21 09:16:49,071 INFO sqlalchemy.engine.base.Engine.0x...04cL COMMIT 2011-06-21 09:16:49,093 INFO sqlalchemy.engine.base.Engine.0x...04cL BEGIN (implicit) 2011-06-21 09:16:49,095 INFO sqlalchemy.engine.base.Engine.0x...04cL UPDATE "SYS_Sessions" SET user_data=%(user_data)s WHERE "SYS_Sessions".id = %(SYS_Sessions_id)s 2011-06-21 09:16:49,095 INFO sqlalchemy.engine.base.Engine.0x...04cL {'SYS_Sessions_id': 92L, 'user_data': } 2011-06-21 09:16:49,108 INFO sqlalchemy.engine.base.Engine.0x...04cL COMMIT As Anyone seen this before ? P.S This doesn't happen in the rest of the modules i have made.

    Read the article

  • How to understand "if ( obj.length === +obj.length )" Javascript condition statement?

    - by humanityANDpeace
    I have run across a condition statement which I have some difficulties to understand. It looks like (please note the +-sign on the right-hand-side) this: obj.length === +obj.length. Can this condition and its purpose/syntax be explained? Looking at the statement (without knowing it) provokes the impression that it is a dirty hack of some sort, but I am almost certain that underscore.js is rather a well designed library, so there must be a better explanation. Background I found this statement used in some functions of the underscore.js library (underscore.js annotated source). My guesswork is that this condition statement is somehow related to testing for a variable obj to be of Array type? (but I am totally unsure). I have tried to test this using this code. var myArray = [1,2,3]; testResult1 = myArray.length === +myArray.length; console.log( testResult1 ); //prints true var myObject = { foo : "somestring", bar : 123 }; testResult2 = myObject.length === +myObject.length; console.log( testResult2 ); //prints false

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >