Search Results

Search found 675 results on 27 pages for 'pk'.

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

  • Get application names with specific permission

    - by rolling.stones
    I want list of all applications installed on the device which use a specific permission like INTERNET. i am using this code , but not able to retrieve results , please help . private ArrayList<String> getInstalledApps(Context context) { ArrayList<String> results = new ArrayList<String>(); PackageManager packageManager = context.getPackageManager(); List<PackageInfo> applist = packageManager.getInstalledPackages(0); Iterator<PackageInfo> it = applist.iterator(); while (it.hasNext()) { PackageInfo pk = (PackageInfo) it.next(); if (PackageManager.PERMISSION_GRANTED == packageManager.checkPermission(Manifest.permission.INTERNET, pk.packageName)) results.add("" + pk.applicationInfo.loadLabel(packageManager)); } for (int i = 0; i <= results.size(); i++) { Log.v("app using internet = ", results.toString()); } return results; } Thanks in advance. Any help accepted :)

    Read the article

  • Getting the list LocalAdmins for a set of Server

    - by PK
    I have a list of computers (stored in a database) and I want to find out the localadmins on those computers programmatically so that I can store that information in the database too. I understand this can be done using powershell. But looking for a way to do the same thing using C# how do I do that

    Read the article

  • VS 2010 SQL Update for SQL Statement

    - by Mike Tucker
    Please bear with me as I'm just beginning to learn this stuff. I have a VS 2010 Web project up and I'm trying to understand how I can make a custom UpdateCommand (Because I chose to write my own SQL statement, I do not have the option for VS 2010 to auto generate an update command for me.) Problem is: I don't know what the UpdateCommand should look like. Here is my Select: SELECT * FROM Dbo.MainAsset, dbo.Model, dbo.Hardware WHERE MainAsset.device = Hardware.DeviceID AND MainAsset.model = Model.DeviceID Which, VS 2010 turns into: SELECT MainAsset.pk, MainAsset.img, MainAsset.device, MainAsset.model, MainAsset.os, MainAsset.asset, MainAsset.serial, MainAsset.inyear, MainAsset.expyear, MainAsset.site, MainAsset.room, MainAsset.teacher, MainAsset.FirstName, MainAsset.LastName, MainAsset.Notes, MainAsset.Dept, MainAsset.AccountingCode, Model.Model AS Hardware, Model.pk AS Model, Model.DeviceID, Hardware.Computer, Hardware.pk AS Expr3, Hardware.DeviceID AS Expr4 FROM MainAsset INNER JOIN Hardware ON MainAsset.device = Hardware.DeviceID INNER JOIN Model ON MainAsset.model = Model.DeviceID How would I approach updating one column, say "MainAsset.site" if that's changed in the Gridview DDL? Any help constructive help would be appreciated. Thank you.

    Read the article

  • Getting the list LocalAdmins for a set of Server - C#

    - by PK
    I have a list of computers (stored in a database) and I want to find out the localadmins on those computers programmatically so that I can store that information in the database too. I understand this can be done using powershell. But looking for a way to do the same thing using C# how do I do that

    Read the article

  • Using a subset of GetHashCode() to increase AzureTable performance through partitioning

    - by makerofthings7
    Generally speaking, Azure Table IO performance improves as more partitions are used (with some tradeoffs in continuation tokens and batch updates I won't go into). Since the partition key is always a string I am considering using a "natural" load balancing technique based on a subset of the GetHashCode() of the partition key, and appending this subset to the partition key itself. This will allow all direct PK/RK queries to be computed with little overhead and with ease. Batch updates may just need an intermediate to group similar PKs together prior to submission. Question: Should I use GetHashCode() to compute the partition key? Is a better function available? If I use GetHashCode() does it matter which character I use for my PK? Is there an abstraction for Azure Table and Blob storage that does this for me already?

    Read the article

  • Cannot Install Wine Windows platform loader both from Terminal and software Center

    - by Muhammad Mansoor
    I recently installed Ubuntu 13.04 on my PC. I want to install Microsoft Visual Studio 2010, so I tried to install WINE. I tried to install from the Terminal and from the Software Center. Both times, it failed in the middle of process. This is the error. W:Failed to fetch http://pk.archive.ubuntu.com/ubuntu/dists/raring/main/source/Sources 404 Not Found W:Failed to fetch http://pk.archive.ubuntu.com/ubuntu/dists/raring/restricted/source/Sources 404 Not Found E:Some index files failed to download. They have been ignored, or old ones used instead. How can I fix this?

    Read the article

  • Q: Is it me or is ADO.NET **BACKWARDS**? (20 replies)

    To simplify the question, I create 2 tables in SQL. Table 1 has columns: ColumnA (PK), ColumnB and Type. Table 2 has columns: A (PK) and Description Now, I want to set things up so that Table 1.Type is of type Table 2.A. 1) I guess in SQL lingo, what I'm trying to say is that Table 1.Type is a FK to Table 2.A. Is that correct terminology? Is that backwards? It appears to me to be correct. 2) So I ...

    Read the article

  • Q: Is it me or is ADO.NET **BACKWARDS**? (20 replies)

    To simplify the question, I create 2 tables in SQL. Table 1 has columns: ColumnA (PK), ColumnB and Type. Table 2 has columns: A (PK) and Description Now, I want to set things up so that Table 1.Type is of type Table 2.A. 1) I guess in SQL lingo, what I'm trying to say is that Table 1.Type is a FK to Table 2.A. Is that correct terminology? Is that backwards? It appears to me to be correct. 2) So I ...

    Read the article

  • Trouble with Code First DatabaseGenerated Composite Primary Key

    - by Nick Fleetwood
    This is a tad complicated, and please, I know all the arguments against natural PK's, so we don't need to have that discussion. using VS2012/MVC4/C#/CodeFirst So, the PK is based on the date and a corresponding digit together. So, a few rows created today would be like this: 20131019 1 20131019 2 And one created tomorrow: 20131020 1 This has to be automatically generated using C# or as a trigger or whatever. The user wouldn't input this. I did come up with a solution, but I'm having problems with it, and I'm a little stuck, hence the question. So, I have a model: public class MainOne { //[Key] //public int ID { get; set; } [Key][Column(Order=1)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketDate { get; set; } [Key][Column(Order=2)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketNumber { get; set; } [StringLength(3, ErrorMessage = "Corp Code must be three letters")] public string CorpCode { get; set; } [StringLength(4, ErrorMessage = "Corp Code must be four letters")] public string DocketStatus { get; set; } } After I finish the model, I create a new controller and views using VS2012 scaffolding. Then, what I'm doing is debugging to create the database, then adding the following instead of trigger after Code First creates the DB [I don't know if this is correct procedure]: CREATE TRIGGER AutoIncrement_Trigger ON [dbo].[MainOnes] instead OF INSERT AS BEGIN DECLARE @number INT SELECT @number=COUNT(*) FROM [dbo].[MainOnes] WHERE [DocketDate] = CONVERT(DATE, GETDATE()) INSERT INTO [dbo].[MainOnes] (DocketDate,DocketNumber,CorpCode,DocketStatus) SELECT (CONVERT(DATE, GETDATE ())),(@number+1),inserted.CorpCode,inserted.DocketStatus FROM inserted END And when I try to create a record, this is the error I'm getting: The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: The object state cannot be changed. This exception may result from one or more of the primary key properties being set to null. Non-Added objects cannot have null primary key values. See inner exception for details. Now, what's interesting to me, is that after I stop debugging and I start again, everything is perfect. The trigger fired perfectly, so the composite PK is unique and perfect, and the data in other columns is intact. My guess is that EF is confused by the fact that there is seemingly no value for the PK until AFTER an insert command is given. Also, appearing to back this theory, is that when I try to edit on of the rows, in debug, I get the following error: The number of primary key values passed must match number of primary key values defined on the entity. Same error occurs if I try to pull the 'Details' or 'Delete' function. Any solution or ideas on how to pull this off? I'm pretty open to anything, even creating a hidden int PK. But it would seem redundant. EDIT 21OCT13 [HttpPost] public ActionResult Create(MainOne mainone) { if (ModelState.IsValid) { var countId = db.MainOnes.Count(d => d.DocketDate == mainone.DocketNumber); //assuming that the date field already has a value mainone.DocketNumber = countId + 1; //Cannot implicitly convert type int to string db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); } return View(mainone); } EDIT 21OCT2013 FINAL CODE SOLUTION For anyone like me, who is constantly searching for clear and complete solutions. if (ModelState.IsValid) { String udate = DateTime.UtcNow.ToString("yyyy-MM-dd"); mainone.DocketDate = udate; var ddate = db.MainOnes.Count(d => d.DocketDate == mainone.DocketDate); //assuming that the date field already has a value mainone.DocketNumber = ddate + 1; db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); }

    Read the article

  • Adding tables to a herd in bucardo

    - by Joseph the Dreamer
    Forgive my ignorance, I am a JS programmer given the task to do DB replication using bucardo. I understand the concept of how bucardo works, but setting it up is a bit confusing. The set-up is: Lubuntu Linux Two databases test_master and test_slave, using PostgreSQL Each DB has a table named test, containing 2 columns: id (PK) and test (int) I use pgAdmin3 I have already added them to bucardo's list of databases and added all tables. Table: public.test DB: test_slave PK: id (int4) Table: public.test DB: test_master PK: id (int4) As you see, due to the fact that the DBs are identical, even the schema names are identical. So when I do: bucardo_ctl add herd sample_herd public.test Ok, so it got added to the herd. But this command gets confused which database public.test comes from. So when I add a sync: $ bucardo_ctl add sync sample_sync source=sample_herd targetdb=test_slave type=fullcopy Failed to add sync: DBD::Pg::st execute failed: ERROR: Source and target databases cannot be the same: test_slave at line 118. at line 30. CONTEXT: PL/Perl function "validate_sync" at /usr/bin/bucardo_ctl line 3362. What does it mean that source and target cannot be the same? If it got confused as to which public.test to use as source, how do I differentiate?

    Read the article

  • Creating a test database with copied data *and* its own data

    - by Jordan Reiter
    I'd like to create a test database that each day is refreshed with data from the production database. BUT, I'd like to be able to create records in the test database and retain them rather than having them be overwritten. I'm wondering if there is a simple straightforward way to do this. Both databases run on the same server, so apparently that rules out replication? For clarification, here is what I would like to happen: Test database is created with production data I create some test records that I want to keep running on the test server (basically so I can have example records that I can play with) Next day, the database is completely refreshed, but the records I created that day are retained. Records that were untouched that day are replaced with records from the production database. The complication is if a record in the production database is deleted, I want it to be deleted on the test database too, so I do want to get rid of records in the test database that no longer exist in the production database, unless those records were created within the test database. Seems like the only way to do this would be to have some sort of table storing metadata about the records being created? So for example, something like this: CREATE TABLE MetaDataRecords ( id integer not null primary key auto_increment, tablename varchar(100), action char(1), pk varchar(100) ); DELETE FROM testdb.users WHERE NOT EXISTS (SELECT * from proddb.users WHERE proddb.users.id=testdb.users.id) AND NOT EXISTS (SELECT * from testdb.MetaDataRecords WHERE testdb.MetaDataRecords.pk=testdb.users.pk AND testdb.MetaDataRecords.action='C' AND testdb.MetaDataRecords.tablename='users' );

    Read the article

  • Linq 2 SQL One to Zero or One relationship possible?

    - by Mr. Flibble
    Is it possible to create a one to zero or one relationship in Linq2SQL? My understanding is that to create a one to one relationship you create a FK relationship on the PK of each table. But you cannot make the PK nullable, so I don't see how to make a one to zero or one relationship work? I'm using the designer to automatically create the model - so I would like to know how to set up the SQL tables to induce the relationship - not some custom ORM code.

    Read the article

  • POJOs for Composite Primary Key from Foreign Key

    - by Gaurav
    hi, I have table in database that has only two columns and these two colums are FK references. they have made these two colums as composite primarykey. table structure Table A [ A_id PK Description ] Table B [ B_Id PK Description ] Table A_B_Pemissiom [ A_id (FK table A) B_Id (FK table B) PrimaryKey ( A_id,B_Id ) ] Can anyone help , I tried several ways and none of them works. Can anyone tell a working Hibernate mapping solution using annotations ? Thanks, Gaurav

    Read the article

  • database----database normalization

    - by runeveryday
    someone told me the following table isn't fit for the second database normalization. but i don't know why? i am a newbie of database design, i have read some tutorials of the 3NF. but to the 2NF and 3NF, i can't understand them well. expect someone can explain it for me. thank you, +------------+-----------+-------------------+ pk pk row +------------+-----------+-------------------+ A B C +------------+-----------+-------------------+ A D C +------------+-----------+-------------------+ A E C +------------+-----------+-------------------+

    Read the article

  • Questions on SQL Server 2008 Full-Text Search

    - by Eddie
    I have some questions about SQL 2K8 integrated full-text search. Say I have the following tables: Car with columns: id (int - pk), makeid (fk), description (nvarchar), year (int), features (int - bitwise value - 32 features only) CarMake with columns: id (int - pk), mfgname (nvarchar) CarFeatures with columns: id (int - 1, 2, 4, 8, etc.), featurename (nvarchar) If someone searches "red honda civic 2002 4 doors", how would I parse the input string so that I could also search in the "CarMake" and "CarFeatures" tables?

    Read the article

  • Facebook database design?

    - by Marin
    I have always wondered how Facebook designed the friend <- user relation. I figure the user table is something like this: user_email PK user_id PK password I figure the table with user's data (sex, age etc connected via user email I would assume). How does it connect all the friends to this user? Something like this? user_id friend_id_1 friend_id_2 friend_id_3 friend_id_N Probably not. Because the number of users is unknown and will expand.

    Read the article

  • i have some problem with left join JPQL

    - by Dora
    there is something wrong with ths way i use left join, and i dont understand what am i doing wrong. can you see it? select distinct r.globalRuleId, r.ruleId, sv.validFrom, pm.moduleId, nvl(min(rai.failedOnRegistration),0) from TRules r, TSlaVersions sv, TModuleFormulas mv, TPendingModule pm, left join TRulesAdditionalInfo rai on r.ruleId = rai.ruleId where r.slaVersionId = sv.slaVersionId and r.formulaId = mv.pk.formulaId and mv.pk.moduleId = pm.moduleId group by r.globalRuleId, r.ruleId, sv.validFrom, pm.moduleId order by pm.moduleId

    Read the article

  • Multiprogramming in Django, writing to the Database

    - by Marcus Whybrow
    Introduction I have the following code which checks to see if a similar model exists in the database, and if it does not it creates the new model: class BookProfile(): # ... def save(self, *args, **kwargs): uniqueConstraint = {'book_instance': self.book_instance, 'collection': self.collection} # Test for other objects with identical values profiles = BookProfile.objects.filter(Q(**uniqueConstraint) & ~Q(pk=self.pk)) # If none are found create the object, else fail. if len(profiles) == 0: super(BookProfile, self).save(*args, **kwargs) else: raise ValidationError('A Book Profile for that book instance in that collection already exists') I first build my constraints, then search for a model with those values which I am enforcing must be unique Q(**uniqueConstraint). In addition I ensure that if the save method is updating and not inserting, that we do not find this object when looking for other similar objects ~Q(pk=self.pk). I should mention that I ham implementing soft delete (with a modified objects manager which only shows non-deleted objects) which is why I must check for myself rather then relying on unique_together errors. Problem Right thats the introduction out of the way. My problem is that when multiple identical objects are saved in quick (or as near as simultaneous) succession, sometimes both get added even though the first being added should prevent the second. I have tested the code in the shell and it succeeds every time I run it. Thus my assumption is if say we have two objects being added Object A and Object B. Object A runs its check upon save() being called. Then the process saving Object B gets some time on the processor. Object B runs that same test, but Object A has not yet been added so Object B is added to the database. Then Object A regains control of the processor, and has allready run its test, even though identical Object B is in the database, it adds it regardless. My Thoughts The reason I fear multiprogramming could be involved is that each Object A and Object is being added through an API save view, so a request to the view is made for each save, thus not a single request with multiple sequential saves on objects. It might be the case that Apache is creating a process for each request, and thus causing the problems I think I am seeing. As you would expect, the problem only occurs sometimes, which is characteristic of multiprogramming or multiprocessing errors. If this is the case, is there a way to make the test and set parts of the save() method a critical section, so that a process switch cannot happen between the test and the set?

    Read the article

  • PHP Doctrine: generation problem?

    - by ropstah
    I'm generating models from my Mysql db. It generates a foreign key collection properly, but not the other way around... Is this supposed to be 'by-design', or am i doing something wrong? pseudo code alert User: UserId pk LocationId fk //User location Location LocationId pk UserId fk //Location owner Generated code: class User() { hasMany('Location') //for locations owned by the user //BUT NOT THIS ONE: //hasOne('Location_1') //for current location of user } class Location() { hasMany('User') //for users which are on that location //AND NOT THIS ONE //hasOne('User_1') //for location owner }

    Read the article

  • Composite keys as Foreign Key?

    - by paulio
    I have the following table... TABLE: Accounts ID (int, PK, Identity) AccountType (int, PK) Username (varchar) Password (varchar) I have created a composite key out of ID and AccountType columns so that people can have the same username/password but different AccountTypes. Does this mean that for each foreign table that I try and link to I'll have to create two columns? I’m using SQL Server 2008

    Read the article

  • SQL Query Help - Return row in table which relates to another table row with max(column)

    - by Seth
    I have two tables: Table1 = Schools Columns: id(PK), state(nvchar(100)), schoolname Table2 = Grades Columns: id(PK), id_schools(FK), Year, Reading, Writing... I would like to develop a query to find the schoolname which has the highest grade for Reading. So far I have the following and need help to fill in the blanks: SELECT Schools.schoolname, Grades.Reading FROM Schools, Grades WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)

    Read the article

  • Recursive COUNT Query (MS SQL)

    - by Cosmo
    Hello Guys! I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories. Category Id : bigint (PK) Name : nvarchar(255) AcceptQuestions : bit IdParent : bigint (FK) Question Id : bigint (PK) Title : nvarchar(255) ... IdCategory : bigint (FK) How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(

    Read the article

  • Recursive COUNT Query (SQL Server)

    - by Cosmo
    Hello Guys! I've two MS SQL tables: Category, Question. Each Question is assigned to exactly one Category. One Category may have many subcategories. Category Id : bigint (PK) Name : nvarchar(255) AcceptQuestions : bit IdParent : bigint (FK) Question Id : bigint (PK) Title : nvarchar(255) ... IdCategory : bigint (FK) How do I recursively count all Questions for a given Category (including questions in subcategories). I've tried it already based on several tutorials but still can't figure it out :(

    Read the article

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