Search Results

Search found 1685 results on 68 pages for 'no more guessing'.

Page 51/68 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • handling java exception

    - by Noona
    This questions is related to java exception, why are there some cases that when an exception thrown the program exits even though the exception was caught and there was no exit() statement? my code looks something like this void bindProxySocket(DefaultHttpClientConnection proxyConnection, String hostName, HttpParams params) { if (!proxyConnection.isOpen()) { Socket socket = null; try { socket = new Socket(hostName, 80); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { proxyConnection.bind(socket, params); } catch(IOException e) { System.err.println ("couldn't bind socket"); e.printStackTrace(); } } } and then I call this method like this: bindProxySocket(proxyConn, hostName, params1); but, the program exits, although I want to handle the exception by doing something else, can it be because I didn't enclose the method call within a try catch clause? what happens if I catch the exception again even though it's already in the method? and what should I do if i want to clean resources only if an exception occurs and otherwise I want to continue with the program? I am guessing in this case I have to include the whole piece of code until I can clean the resources with in a try statement or can I do it in the handle exception statement? some of these questions are on this specific case, but I would like to get a thorough answer to all my questions for future reference. thanks

    Read the article

  • Tips on managing dependencies for a release?

    - by Andrew Murray
    Our system comprises many .NET websites, class libraries, and a MSSQL database. We use SVN for source control and TeamCity to automatically build to a Test server. Our team is normally working on 4 or 5 projects at a time. We try to lump many changes into a largish rollout every 2-4 weeks. My problem is with keeping track of all the dependencies for a rollout. Example: Website A cannot go live until we've rolled out Branch X of Class library B, built in turn against the Trunk of Class library C, which needs Config Updates Y and Z and Database Update D, which needs Migration Script E... It gets even more complex - like making sure each developer's project is actually compatible with the others and are building against the same versions. Yes, this is a management issue as much as a technical issue. Currently our non-optimal solution is: a whiteboard listing features that haven't gone live yet relying on our memory and intuition when planning the rollout, until we're pretty sure we've thought of everything... a dry-run on our Staging environment. It's a good indication but we're often not sure if Staging is 100% in sync with Live - part of the problem I'm hoping to solve. some amount of winging it on rollout day. So far so good, minus a few close calls. But as our system grows, I'd like a more scientific release management system allowing for more flexibility, like being able to roll out a single change or bugfix on it's own, safe in the knowledge that it won't break anything else. I'm guessing the best solution involves some sort of version numbering system, and perhaps using a project management tool. We're a start-up, so we're not too hot on religiously sticking to rigid processes, but we're happy to start, providing it doesn't add more overhead than it's worth. I'd love to hear advice from other teams who have solved this problem.

    Read the article

  • Android SQLite database locale, locking, and version

    - by gdoten
    In some books and online I see these method calls being made after a database is created: db.setLocale(Locale.getDefault()); db.setLockingEnabled(true); db.setVersion(DB_VERSION); Why is this done? As far as I can tell, after creating a new database, the system adds a table named android_metadata with one field named locale and that table has one row with the locale field set to "en_US". Now I assume the column has that value because I am using a U.S. phone, and if I were using a phone from a different region then the locale field would be set appropriately. Can anyone confirm this? I'm guessing that the setLocale method would only be useful in the case that you install a pre-built database onto a phone and then want to change the locale to match the phone's locale. Sound right? The documentation for setLockingEnabled says it defaults to true so there's no need to make that call, right? Lastly, what's with the call to setVersion? I can't find a table that contains this information so I've been assuming that the database file itself stores the version number somewhere. So when I create a database, which requires you to have already specified the version number in the call to the SQLiteOpenHelper constructor, there's no point in calling setVersion. Again, perhaps this method exists for the case of installing a pre-built database to a device and you then wish to change the database's version (though I can't think of when doing this would make sense). Thanks for any insight!

    Read the article

  • How to cast sockaddr_storage and avoid breaking strict-aliasing rules

    - by sinoth
    I'm using Beej's Guide to Networking and came across an aliasing issue. He proposes a function to return either the IPv4 or IPv6 address of a particular struct: 1 void *get_in_addr( struct sockaddr *sa ) 2 { 3 if (sa->sa_family == AF_INET) 4 return &(((struct sockaddr_in*)sa)->sin_addr); 5 else 6 return &(((struct sockaddr_in6*)sa)->sin6_addr); 7 } This causes GCC to spit out a strict-aliasing error for sa on line 3. As I understand it, it is because I call this function like so: struct sockaddr_storage their_addr; ... inet_ntop(their_addr.ss_family, get_in_addr((struct sockaddr *)&their_addr), connection_name, sizeof connection_name); I'm guessing the aliasing has to do with the fact that the their_addr variable is of type sockaddr_storage and another pointer of a differing type points to the same memory. Is the best way to get around this sticking sockaddr_storage, sockaddr_in, and sockaddr_in6 into a union? It seems like this should be well worn territory in networking, I just can't find any good examples with best practices. Also, if anyone can explain exactly where the aliasing issue takes place, I'd much appreciate it.

    Read the article

  • Natural language grammar and user-entered names

    - by Owen Blacker
    Some languages, particularly Slavic languages, change the endings of people's names according to the grammatical context. (For those of you who know grammar or studied languages that do this to words, such as German or Russian, and to help with search keywords, I'm talking about noun declension.) This is probably easiest with a set of examples (in Polish, to save the whole different-alphabet problem): Dorothy saw the cat — Dorota zobaczyla kota The cat saw Dorothy — Kot zobaczyl Dorote It is Dorothy’s cat — To jest kot Doroty I gave the cat to Dorothy — Dalam kota Dorotie I went for a walk with Dorothy — Poszlam na spacer z Dorota “Hello, Dorothy!” — “Witam, Doroto!” Now, if, in these examples, the name here were to be user-entered, that introduces a world of grammar nightmares. Importantly, if I went for Katie (Kasia), the examples are not directly comparable — 3 and 4 are both Kasi, rather than *Kasy and *Kasie — and male names will be wholly different again. I'm guessing someone has dealt with this situation before, but my Google-fu appears to be weak today. I can find a lot of links about natural-language processing, but I don'think that's quite what I want. To be clear: I'm only ever gonna have one user-entered name per user and I'm gonna need to decline them into known configurations — I'll have a localised text that will have placeholders something like {name nominative} and {name dative}, for the sake of argument. I really don't want to have to do lexical analysis of text to work stuff out, I'll only ever need to decline that one user-entered name. Anyone have any recommendations on how to do this, or do I need to start calling round localisation agencies ;o) Further reading (all on Wikipedia) for the interested: Declension Grammatical case Declension in Polish Declension in Russian Declension in Czech nouns and pronouns Disclaimer: I know this happens in many other languages; highlighting Slavic languages is merely because I have a project that is going to be localised into some Slavic languages.

    Read the article

  • Matching a Repeating Sub Series using a Regular Expression with PowerShell

    - by Hinch
    I have a text file that lists the names of a large number of Excel spreadsheets, and the names of the files that are linked to from the spreadsheets. In simplified form it looks like this: "Parent File1.xls" Link: ChildFileA.xls Link: ChildFileB.xls "ParentFile2.xls" "ParentFile3.xls" Blah Link: ChildFileC.xls Link: ChildFileD.xls More Junk Link: ChildFileE.xls "Parent File4.xls" Link: ChildFileF.xls In this example, ParentFile1.xls has embedded links to ChildFileA.xls and ChildFileB.xls, ParentFile2.xls has no embedded links, and ParentFile3.xls has 3 embedded links. I am trying to write a regular expression in PowerShell that will parse the text file producing output in the following form: ParentFile1.xls:ChildFileA.xls,ChildFileB.xls ParentFile3.xls:ChildFileC.xls,ChildFileD.xls,ChildFileE.xls etc The task is complicated by the fact that the text file contains a lot of junk between each of the lines, and a parent may not always have a child. Furthermore, a single file name may pass over multiple lines. However, it's not as bad as it sounds, as the parent and child file names are always clearly demarcated (the parent with quotes and the child with a prefix of Link: ). The PowerShell code I've been using is as follows: $content = [string]::Join([environment]::NewLine, (Get-Content C:\Temp\text.txt)) $regex = [regex]'(?im)\s*\"(.*)\r?\n?\s*(.*)\"[\s\S]*?Link: (.*)\r?\n?' $regex.Matches($content) | %{$_.Groups[1].Value + $_.Groups[2].Value + ":" + $_.Groups[3].Value} Using the example above, it outputs: ParentFile1.xls:ChildFileA.xls ParentFile2.xls""ParentFile3.xls:ChildFileC.xls ParentFile4.xls:ChildFileF.xls There are two issues. Firstly, the inclusion of the "" instead of a newline whenever a Parent without a Child is processed. And the second issue, which is the most important, is that only a single child is ever shown for each parent. I'm guessing I need to somehow recursively capture and display the multiple child links that exist for each parent, but I'm totally stumped as to how to do this with a regular expression. Amy help would be greatly appreciated. The file contains 100's of thousands of lines, and manual processing is not an option :)

    Read the article

  • How to avoid serializing zero values with Simple Xml

    - by Bram Vandenbussche
    I'm trying to serialise an object using simple xml (http://simple.sourceforge.net/). The object setup is pretty simple: @Root(name = "order_history") public class OrderHistory { @Element(name = "id", required = false) public int ID; @Element(name = "id_order_state") public int StateID; @Element(name = "id_order") public int OrderID; } The problem is when I create a new instance of this class without an ID: OrderHistory newhistory = new OrderHistory(); newhistory.OrderID = _orderid; newhistory.StateID = _stateid; and I serialize it via simple xml: StringWriter xml = new StringWriter(); Serializer serializer = new Persister(); serializer.write(newhistory, xml); it still reads 0 in the resulting xml: <?xml version='1.0' encoding='UTF-8'?> <order_history> <id>0</id> <id_order>2</id_order> <id_order_state>8</id_order_state> </order_history> I'm guessing the reason for this is that the ID property is not null, since integers can't be null. But I really need to get rid of this node, and I'd rather not remove it manually. Any clues anyone?

    Read the article

  • how to push different local git branches to heroku/master

    - by lsiden
    Heroku has a policy of ignoring all branches but 'master'. While I'm sure Heroku's designers have excellent reasons for for this policy (I'm guessing for storage and performance optimization), the consequence to me as a developer is that whatever local topic branch I may be working on, I would like an easy way to switch Heroku's master to that local topic branch and do a "git push heroku -f" to over-write master on Heroku. What I got from reading the "Pushing Refspecs" section of http://progit.org/book/ch9-5.html is git push -f heroku local-topic-branch:refs/heads/master What I'd really like is a way to set this up in the config file so that "git push heroku" always does the above, replacing local-topic-branch with the name of whatever my current branch happens to be. If anyone knows how to accomplish that, please let me know! The caveat for this, of course, is that this is only sensible if I am the only one who can push to that Heroku app/repository. A test or QA team might manage such a repository to try out different candidate branches, but they would have to coordinate so that they all agree on what branch they are pushing to it on any given day. Needless to say, it would also be a very good idea to have a separate remote repository (like Github) without this restriction for backing everything up to. I'd call that one "origin" and use "heroku" for Heroku so that "git push" always backs up everything to origin, and "git push heroku" pushes whatever branch I'm currently on to Heroku's master branch, overwriting it if necessary. Can anybody tell me if this would work? [remote "heroku"] url = [email protected]:my-app.git push = +refs/heads/*:refs/heads/master I'd like to hear from someone more experienced before I begin to experiment, although I suppose I could create a dummy app on Heroku and experiment with that. As for fetching, I don't really care if the Heroku repository is write-only. I still have a separate repository, like Github, for backup and cloning of all my work. Footnote: This question is similar to, but not quite the same as http://stackoverflow.com/questions/1489393/good-git-deployment-using-branches-strategy-with-heroku

    Read the article

  • How to install OpenCV 2.0 on win32

    - by Jive Dadson
    I need to install OpenCV on Win32. I do not have it installed currently. I downloaded OpenCV-2.0.0a-win32.exe and ran it. What the heck do I do now? There are no .lib's and whatnot. I found some instructions for building the release using cmake at http://opencv.willowgarage.com/wiki/InstallGuide . I downloaded the latest and greatest cmake, and tried to follow the instructions, but I was guessing. No joy. I specified VC++9 when I did the "configure," but cmake built a VC++ 6 dsw file. No vcproj. I converted the dsw into a vc++9 vcproj anyway, just to see if it would work. Nope. It compiled lots of files, but many failed because it could not find omp.h. Sure enough, it's not there, anywhere. The build log said, 'A tool returned an error code from "Performing Custom Build Step".' I am lost. Ideally, I would like to find a full installation with all the files pre-built for Win32 vc++ 2008. Failing that, I need instructions that even I can follow. Short sentences and small words, but lots of them. Please help! UPDATE: I tried to build just CXCORE. It complained, "cannot open file 'VCOMPD.lib'" There's that OMP again.

    Read the article

  • Print a string that contains a certain pattern in Java

    - by jjpotter
    I am trying to find a regular expression within a line of a .csv file, so I can eventually save all the matches to another file, and lose all the other junk. So a line in my file might look like: MachineName,User,IP,VariableData,Location The VariableData is what I want to match, and if there's a match, print the line. I am using a pattern for this because I only want 3 out of 10 of variations of VariableData, and out of those 3, they are numbered differently(example, "pc104, pccrt102, pccart65"). I am trying to do this using the Scanner Class and keeping it simple as possible so I can understand it. Here is where I was heading with this...(the pattern isn't complete, just have it like this for testing). import java.io.File; import java.util.Scanner; import java.util.regex.Pattern; public class pcv { public static void main(String[] args) { File myFile = new File("c:\\temp\\report.csv"); Pattern myPat = Pattern.compile("pc"); try{ Scanner myScan = new Scanner(myFile); while(myScan.hasNext()){ if(myScan.hasNext(myPat)){ System.out.println("Test"); } } }catch(Exception e){ } } } This code loops, im guessing the .hasNext() methods are resetting themselves. I've played around with the Matcher class a little bit, but only found a way to match the expression but not get the whole line. My other throught was maybe somehow count the line that contains the pattern, then go back and print the line that corresponds to the counts.

    Read the article

  • jackson failing to map empty array with No content to map to Object due to end of input

    - by ijabz
    I send a query to an api and map the json results to my classes using Jackson. When I get some results it works fine, but when there are no results it fails with java.io.EOFException: No content to map to Object due to end of input at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2766) at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2709) at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854) at com.jthink.discogs.query.DiscogsServerQuery.mapQuery(DiscogsServerQuery.java:382) at com.jthink.discogs.query.SearchQuery.mapQuery(SearchQuery.java:37)* But the thing is the api isn't returning nothing at all, so I dont see why it is failing. Here is the query: http://api.discogs.com/database/search?page=1&type=release&release_title=nude+and+rude+the+best+of+iggy+pop this is what I get back { "pagination": { "per_page": 50, "pages": 1, "page": 1, "urls": {}, "items": 0 }, "results": [] } and here is the top level object Im trying to map to public class Search { private Pagination pagination; private Result[] results; public Pagination getPagination() { return pagination; } public void setPagination(Pagination pagination) { this.pagination = pagination; } public Result[] getResults() { return results; } public void setResults(Result[] results) { this.results = results; } } Im guessing the problem is something to do with the results array being returned being blank, but cant see what Im doing wrong EDIT: The comment below was correct, although I usually receive { "pagination": { "per_page": 50, "pages": 1, "page": 1, "urls": {}, "items": 0 }, "results": [] } and in these cases there is no problem but sometimes I seem to just get an empty String. Now Im wondering if the problem is how I read from the inputstream if (responseCode == HttpURLConnection.HTTP_OK) InputStreamReader in= new InputStreamReader(uc.getInputStream()); BufferedReader br= new BufferedReader(in); while(br.ready()) { String next = br.readLine(); sb.append(next); } return sb.toString(); } although I dont read until I get the response code, is it possible that the first time I call br.ready() that I call it before it is ready, and therefore I don't read the input EDIT 2: Changing above code to simply String line; while ((line = br.readLine()) != null) { sb.append(line); } resolved the issue.

    Read the article

  • SQL query using information from 4 tables (not all directly linked)

    - by Yvonne
    I'm developing a simple classroom system, where teachers manage classes and their subjects. I have 2 levels of access in my teachers table, assigned by an integer (1 = admin, 2 = user)... Meaning that the headteacher is the admin :) A teacher (of level 1) can have have many classes and a class can have many teachers (so I have 'TeachersClasses' table). A class can have many subjects, and a teacher can have many subjects. Basically, I'm attempting a query to display the admin teacher's (level 1) subjects. However, only teachers with a level of 2, are directly related to a subject, which is set by the admin user. The headteacher can view all of their subjects via the classroom, but I cannot get all of the subjects to be displayed on one page, instead I can only get the subjects to appear under a specific classroom right now... This is what I have so far, which is returning nothing. (I'm guessing this may require an SQL clause more advanced that 'INNER JOIN' which is the only join type I am familiar with, and thought it would be enough! $query = "SELECT subjects.subjectid, subjects.subjectname, subjects.subjectdetails, classroom.classid, classroom.classname FROM subjects INNER JOIN classroom ON subjects.subjectid = classroom.classid INNER JOIN teacherclasses ON classroom.classid = teacherclasses.classid INNER JOIN teachers ON teacherclasses.teacherid = teachers.teacherid WHERE teachers.teacherid = '".intval( $_SESSION['SESS_TEACHERID'] )."'"; In order for all subjects related to the headteachers class to be displayed, I'm gathering that all of my tables will need to be called up here? Thanks for any help! Example output: subject name: maths // teacher: mr smith // classroom: DG99 x10 for all the subjects associated with the headteachers classrooms :)

    Read the article

  • PostgreSQL insert on primary key failing with contention, even at serializable level

    - by Steven Schlansker
    I'm trying to insert or update data in a PostgreSQL db. The simplest case is a key-value pairing (the actual data is more complicated, but this is the smallest clear example) When you set a value, I'd like it to insert if the key is not there, otherwise update. Sadly Postgres does not have an insert or update statement, so I have to emulate it myself. I've been working with the idea of basically SELECTing whether the key exists, and then running the appropriate INSERT or UPDATE. Now clearly this needs to be be in a transaction or all manner of bad things could happen. However, this is not working exactly how I'd like it to - I understand that there are limitations to serializable transactions, but I'm not sure how to work around this one. Here's the situation - ab: => set transaction isolation level serializable; a: => select count(1) from table where id=1; --> 0 b: => select count(1) from table where id=1; --> 0 a: => insert into table values(1); --> 1 b: => insert into table values(1); --> ERROR: duplicate key value violates unique constraint "serial_test_pkey" Now I would expect it to throw the usual "couldn't commit due to concurrent update" but I'm guessing since the inserts are different "rows" this does not happen. Is there an easy way to work around this?

    Read the article

  • How to improve performance of non-scalar aggregations on denormalized tables

    - by The Lazy DBA
    Suppose we have a denormalized table with about 80 columns, and grows at the rate of ~10 million rows (about 5GB) per month. We currently have 3 1/2 years of data (~400M rows, ~200GB). We create a clustered index to best suit retrieving data from the table on the following columns that serve as our primary key... [FileDate] ASC, [Region] ASC, [KeyValue1] ASC, [KeyValue2] ASC ... because when we query the table, we always have the entire primary key. So these queries always result in clustered index seeks and are therefore very fast, and fragmentation is kept to a minimum. However, we do have a situation where we want to get the most recent FileDate for every Region, typically for reports, i.e. SELECT [Region] , MAX([FileDate]) AS [FileDate] FROM HugeTable GROUP BY [Region] The "best" solution I can come up to this is to create a non-clustered index on Region. Although it means an additional insert on the table during loads, the hit isn't minimal (we load 4 times per day, so fewer than 100,000 additional index inserts per load). Since the table is also partitioned by FileDate, results to our query come back quickly enough (200ms or so), and that result set is cached until the next load. However I'm guessing that someone with more data warehousing experience might have a solution that's more optimal, as this, for some reason, doesn't "feel right".

    Read the article

  • How to get a UIScrollView embedded within a UITableCellView to scroll?

    - by Zan
    I have a scroll view containing several images embedded within a custom cell view, it sometimes scrolls horizontally if I keep holding the cell for a while. I tried a lot of things and it doesn't seem to work, please help? Here's part of the CustomCell : UITableViewCell code: -(void) layoutSubviews { CGRect scrollViewFrame = CGRectMake(0, 0, 320, 200); self.scrollView.frame = scrollViewFrame; self.scrollView.backgroundColor = [UIColor whiteColor]; self.scrollView.contentSize = CGSizeMake((320*3), 200); self.scrollView.scrollEnabled = YES; self.scrollView.clipsToBounds = YES; self.scrollView.pagingEnabled = YES; self.scrollView.showsHorizontalScrollIndicator = NO; self.scrollView.showsVerticalScrollIndicator = NO; self.scrollView.scrollsToTop = NO; self.scrollView.delegate = self; self.scrollView.userInteractionEnabled = YES; // add 3 images to subview here pageControl.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7]; pageControl.frame = CGRectMake(0, 170, 320, 30); pageControl.numberOfPages = 8;} I tested the code on a UIViewController and it works just fine, I'm guessing that this is caused by cell selection and I tried returning nil when the cell gets selected and that didn't work. I also tried passing touches to the scrollview and that didn't work either, please help?

    Read the article

  • Problem Writing Linq2Xml Query

    - by Gavin Draper
    I'm trying to write a Linq2XML query to query the following XML. I need it to pull back all photos for a given GalleryID. <Albums> <Album GalleryId="1" Cover="AlbumCover1.jpg" Title="Album 1"> <Photos> <Photo Title="Image1" URL="img1.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image2" URL="img2.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image3" URL="img3.jpg" DateAdded="01/01/2010 09:20"/> </Photos> </Album> <Album GalleryId="2" Cover="AlbumCover1.jpg" Title="Album 2"> <Photos> <Photo Title="Image1" URL="img1.jpg" DateAdded="01/01/2010 09:20"/> <Photo Title="Image2" URL="img2.jpg" DateAdded="01/01/2010 09:20"/> </Photos> </Album> </Albums> The best I've come up with is XDocument xmlDoc = XDocument.Load(GalleryFilePath); var x = from c in xmlDoc.Descendants("Album") where c.Attribute("GalleryId").Equals(GalleryId) orderby c.Attribute("Title").Value descending select new { Title = c.Element("Photo").Attribute("Title"), URL = c.Element("Photo").Attribute("URL"), DateAdded = c.Element("Photo").Attribute("DateAdded") }; This returns nothing, I'm guessing this is because I'm telling it to query the Album element then trying to loop through the photo elements. Any tips as to how this should be done? Thanks

    Read the article

  • Log4Net GetLogger creates rolling files even for the unreferenced files

    - by ybastiand
    Hi, I have a C# solution that contains three executables. I have each of these three executables sharing the same log4net configuration file. At startup of each of the executable, they retrieve a logger (one logger per executable, as per configuration file further below). When one of the executable performs Log.GetLogger(), it creates all the rolling files instead of only the one rolling file that is referred to as appender-ref in the executable's logger configuration. For instance, when I startup my sending daemon executable, it performs Log.GetLogger("SendingDaemonLogger") which creates 3 files Log/RuleScheduler.txt, Log/NotificationGenerator.txt and Log/NotificationSender.txt instead of only the desired Log/NotificationSender.txt. Then when I startup another of the executables, for instance the rule scheduler daemon, this other process cannot write in Log/RuleScheduler.txt because it has been created and locked by the sending daemon process. I am guessing that there may be three different solutions to my problem: The GetLogger should only create the rolling file appenders that are referenced in the config I should have one config file per executable, this way each config file could list only one rolling file appender and starting each of the executable would not create the rolling files of the other daemons. I am however reluctant to do this because some of the configuration (SMTP appender, console appender) is shared between the daemons and I don't want to have duplicate copies to maintain. Unless there is a way to have a config file including another one? Maybe there is a way to configure the rolling file so that concurrent access across processes is allowed? This solution still isn't perfect in my opinion because any of the daemons should not be creating the rolling files of some other daemons. Thanks in advance for your help! I have difficulties for posting the config file properly here (this website interprets as HTML). Please go to the following link for seeing my log4net configuration file: log4Net configuration file

    Read the article

  • Designing secure consumer blackberry application

    - by Kiran Kuppa
    I am evaluating a requirement for a consumer blackberry application that places high premium on security of user's data. Seems like it is an insurance company. Here are my ideas on how I could go about it. I am sure this would be useful for others who are looking for similar stuff Force the user to use device password. (I am guessing that this would be possible - though not checked it yet). Application can request notifications when the device is about to be locked and just after it has been unlocked. Encryption of application specific data can be managed at those times. Application data would be encrypted with user's password. User's credentials would be encrypted with device password. Remote backup of the data could be done over HTTPS (any better ideas are appreciated) Questions: What if the user forgets his device password. If the user forgets his application password, what is the best and secure way to reset the password? If the user losses the phone, remote backup must be done and the application data must be cleaned up. I have some ideas on how to achieve (3) and shall share them. There must be an off-line verification of the user's identity and the administrator must provide a channel using which the user must be able to send command to the device to perform the wiping of application data. The idea is that the user is ALWAYS in control of his data. Without the user's consent, even the admin must not be able to do activities such as cleaning up the data. In the above scheme of things, it appears as if the user's password need not be sent over the air to server. Am I correct? Thanks, --Kiran Kumar

    Read the article

  • Insert multiple line breaks into a JavaScript string (regex) (CodeMirror)

    - by PJH
    I have a few strings and I would like to insert some line breaks into them at certain points. I figured out a few of the logistics but as a whole I can't seem to crack this problem, probably because I have limited experience with regex. Basically I have a long string of XML tags that is all on one line. I want to add line breaks at certain points to get the data more formatted and looking nice. I am using CodeMirror to display this data on a webpage but for some reason its all on line #1. So I need to go from something like this: <Sample><Name></Name><PhoneNumber><AreaCode></AreaCode><Number></Number></PhoneNumber></Sample> To something like this: <Sample> <Name></Name> <PhoneNumber> <AreaCode></AreaCode> <Number></Number> </PhoneNumber> </Sample> CodeMirror will take care of the rest of the formatting all I need to do is insert the line breaks in the right spot using regex or a loop of some sort. The Tags will or can change so I am guessing regex has to be used. I have had success inserting line breaks with \n and &#xD but can't seem to get regex to detect the proper locations. Any help would be greatly appreciated. Thanks. UPDATE I overlooked this but the brackets are in fact being sent as < and > So example tag would look like: &lt;PhoneNumber&gt; or &lt;/PhoneNumber&gt; So basically need to insert a \n after every &gt; that is a closing tag or a beginning tag that contains children tags.

    Read the article

  • New NSData with range of old NSData maintaining bytes.

    - by umop
    I have a fairly large NSData (or NSMutableData if necessary) object which I want to take a small chunk out of and leave the rest. Since I'm working with large amounts of NSData bytes, I don't want to make a big copy, but instead just truncate the existing bytes. Basically: NSData *source: < a few bytes I want to discard + < big chunk of bytes I want to keep NSData *destination: < big chunk of bytes I want to keep There are truncation methods in NSMutableData, but they only truncate the end of it, whereas I want to truncate the beginning. My thoughts are to do this with the methods: - getBytes:range: and - initWithBytesNoCopy:length:freeWhenDone: However, I'm trying to figure out how to manage memory with these. I'm guessing the process will be like this (I've placed ????s where I don't know what to do): void *buffer // Get range of bytes [source getBytes:buffer range:NSMakeRange(myStart, myLength)]; // Somehow (m)alloc the memory which will be freed up in the following step ????? // Release the source, now that I've allocated the bytes [source release]; // Create a new data, recycling the bytes so they don't have to be copied NSData destination = [[NSData alloc] initWithBytesNoCopy:buffer length:myLength freeWhenDone:YES]; Thanks for the help!

    Read the article

  • Creating a Facebook session for getting page info

    - by Marty Haught
    I am trying to get info on a page that my user is admin for. This user has granted my fb_connect app offline access. I have saved the session_key that allows offline access (it has the user's id in it). I am able to publish to this fan page with this session key. But when I try to access the page's info I get an SessionExpired error. This doesn't make sense. Look at the code and output below: p is is a 'profile' object that holds the three pieces of relevant fb data (user_id, session_key and page id) fb_session = Facebooker::Session.create = # fb_session.secure_with!(p.fb_session_key, p.fb_user_id, 0) = nil fb_session.user.has_permission?("offline_access") = true fb_session.user.has_permission?("publish_stream") = true fb_session.user.has_permission?("read_stream") = true pages = fb_session.fql_query("select fan_count from page where page_id = #{p.fb_page_id}") Facebooker::Session::SessionExpired: Session key invalid or no longer valid ... pages = fb_session.pages(:fields = {:page_ids = p.fb_page_id}) Facebooker::Session::SessionExpired: Session key invalid or no longer valid ... pages = Facebooker::Session.create.fql_query("select fan_count from page where page_id = #{p.fb_page_id}") = [#] Perhaps I'm not creating the session right or maybe offline access doesn't give me access to the user's page even though I have permissions to push to it. As you can see when I just use an anon session I'm able to get the fan count, which I'm guessing is publicly available. Does anyone have an idea on this?

    Read the article

  • How can I add a "Loading...Please wait..." feature?

    - by Rob
    I have a very simple table on my website, that displays different URL's. I have an input field where I can type in a URL and click 'Submit' to add additional URL's. However, I want to add an MD5 grabbing feature to this, using @md5_file(); to grab the MD5 of the URL and check to make sure it's the MD5 it should be, before adding it to the database. However it may take a few seconds for it to grab the MD5 and compare it, so I would like to add a little bit of text, like "Processing...Please wait..." while it does the comparing, and then once it's compared I want that text to go away. I've never done this before, or even though about doing it so I have no idea where to start. I'll go ahead and put javascript as a tag for this, since I'm guessing it would be done with javascript, but I really have no idea. I don't think it's possible with PHP, but again, I have no idea. Any suggestions?

    Read the article

  • Publish failed using Ant publisher (Eclipse/datanucleus).

    - by aronp
    Dear All, I am being driven mad the following (apparently hard) error from eclipse. Publish failed using Ant publisher Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'. I have seen comments on similar errors where refreshing eclipses view of the project helps but it is not helping me. Have tried cleaning the project, removing it from the webserver, deleting war files but cant seem to clear it. I have reset my TMPDIR variable so that it uses a directory on the same filesystem as that appeared to be another possible cause. The error occurs on classes which have been enhanced by datanuculeus. I have auto-enhance on the project. The other references to this problem indicate that it is due to Eclipses view of the project being out of step with the filesystem, and I am guessing that this has something to do with thedata nucleus enhancement. Any ideas? Thanks. I am using Eclipse 3.5.2 with latest datanucleus pluggins. Stack trace org.eclipse.core.runtime.CoreException: Resource is out of sync with the file system: '/MyServlet/build/classes/com/inver/hotzones/database/BaseNetworkData.class'. at org.eclipse.jst.server.generic.core.internal.publishers.AbstractModuleAssembler.copyModule(AbstractModuleAssembler.java:172) at org.eclipse.jst.server.generic.core.internal.publishers.WarModuleAssembler.assemble(WarModuleAssembler.java:31) at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.assembleModule(AntPublisher.java:167) at org.eclipse.jst.server.generic.core.internal.publishers.AntPublisher.publish(AntPublisher.java:128) at org.eclipse.jst.server.generic.core.internal.GenericServerBehaviour.publishModule(GenericServerBehaviour.java:82) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModule(ServerBehaviourDelegate.java:949) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publishModules(ServerBehaviourDelegate.java:1039) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:872) at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:708) at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2731) at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:278) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    Read the article

  • Hardware acceleration issue with WPF application - Analyzing crash dumps

    - by Appu
    I have a WPF application crashing on the client machine. My initial analysis shows that this is because of H/W acceleration and disabling H/W acceleration at a registry level solves the issue. Now I have to make sure that this is caused because of H/W acceleration. I have the crash dumps available which has a stack trace, 9c52b020 80636ac7 9c52b0bc e1174818 9c52b0c0 nt!_SEH_prolog+0x1a 9c52b038 806379d6 e10378a4 9c52b0bc e1174818 nt!CmpQuerySecurityDescriptorInfo+0x23 9c52b084 805bfe5b e714b160 00000001 9c52b0bc nt!CmpSecurityMethod+0xce 9c52b0c4 805c01c8 e714b160 9c52b0f0 e714b15c nt!ObpGetObjectSecurity+0x99 9c52b0f4 8062f28f e714b160 8617f008 00000001 nt!ObCheckObjectAccess+0x2c 9c52b140 8062ff30 e1038008 0066a710 cde2b714 nt!CmpDoOpen+0x2d5 9c52b340 805bf488 0066a710 0066a710 8617f008 nt!CmpParseKey+0x5a6 9c52b3b8 805bba14 00000000 9c52b3f8 00000240 nt!ObpLookupObjectName+0x53c 9c52b40c 80625696 00000000 8acad448 00000000 nt!ObOpenObjectByName+0xea 9c52b508 8054167c 9c52b828 82000000 9c52b5ac nt!NtOpenKey+0x1c8 9c52b508 80500699 9c52b828 82000000 9c52b5ac nt!KiFastCallEntry+0xfc 9c52b58c 805e701e 9c52b828 82000000 9c52b5ac nt!ZwOpenKey+0x11 9c52b7fc 805e712a 00000002 805e70a0 00000000 nt!RtlpGetRegistryHandleAndPath+0x27a 9c52b844 805e73e3 9c52b864 00000014 9c52bbb8 nt!RtlpQueryRegistryGetBlockPolicy+0x2e 9c52b86c 805e79eb 00000003 e8af79dc 00000014 nt!RtlpQueryRegistryDirect+0x4b 9c52b8bc 805e7f10 e8af79dc 00000003 9c52b948 nt!RtlpCallQueryRegistryRoutine+0x369 9c52bb58 b8f5bca4 00000005 e6024b30 9c52bbb8 nt!RtlQueryRegistryValues+0x482 WARNING: Stack unwind information not available. Following frames may be wrong. 9c52bc00 b8f20a5b 00000005 85f4204c 85f4214c igxpmp32+0x44ca4 9c52c280 b8f1cc7b 890bd358 9c52c2b0 00000000 igxpmp32+0x9a5b 9c52c294 b8f11729 890bd358 9c52c2b0 00000a0c igxpmp32+0x5c7b 9c52c358 804ef19f 890bd040 86d2dad0 0000080c VIDEOPRT!pVideoPortDispatch+0xabf 9c52c368 bf85e8c2 9c52c610 bef6ce84 00000014 nt!IopfCallDriver+0x31 9c52c398 bf85e93c 890bd040 00232150 9c52c3f8 win32k!GreDeviceIoControl+0x93 9c52c3bc bebafc7b 890bd040 00232150 9c52c3f8 win32k!EngDeviceIoControl+0x1f 9c52d624 bebf3fa9 890bd040 bef2a28c bef2a284 igxpdx32+0x8c7b 9c52d6a0 8054167c 9c52da28 b915d000 9c52d744 igxpdx32+0x4cfa9 9c52d6a0 00000000 9c52da28 b915d000 9c52d744 nt!KiFastCallEntry+0xfc How do I ensure that crash is caused by H/W acceleration issue by looking at the above data? I am guessing VIDEOPRT!pVideoPortDispatch+0xabf indicates some error with the rendering. Is that correct? I am using WinDebug to view the crash dump.

    Read the article

  • What's correct way to remove a boost::shared_ptr from a list?

    - by Catskul
    I have a std::list of boost::shared_ptr<T> and I want to remove an item from it but I only have a pointer of type T* which matches one of the items in the list. However I cant use myList.remove( tPtr ) I'm guessing because shared_ptr does not implement == for its template argument type. My immediate thought was to try myList.remove( shared_ptr<T>(tPtr) ) which is syntactically correct but it will crash from a double delete since the temporary shared_ptr has a separate use_count. std::list< boost::shared_ptr<T> > myList; T* tThisPtr = new T(); // This is wrong; only done for example code. // stand-in for actual code in T using // T's actual "this" pointer from within T { boost::shared_ptr<T> toAdd( tThisPtr ); // typically would be new T() myList.push_back( toAdd ); } { //T has pointer to myList so that upon a certain action, // it will remove itself romt the list //myList.remove( tThisPtr); //doesn't compile myList.remove( boost::shared_ptr<T>(tThisPtr) ); // compiles, but causes // double delete } The only options I see remaining are to use std::find with a custom compare, or to loop through the list brute force and find it myself, but it seems there should be a better way. Am I missing something obvious, or is this just too non-standard a use to be doing a remove the clean/normal way?

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >