Daily Archives

Articles indexed Friday June 24 2011

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

  • UDP Code client server architecture

    - by GameBuilder
    Hi I have developed a game on android.Now I want to play it on wifi or 3G. I have game packets which i want to send it form client(mobile) to server then to another client2(mobile). I don't know how to write code in Java to send the playPackets continuously to server and receive the playPacket continuously from the server to the clients. I guess i have to use two thread one for sending and one for receiving. Can someone help me with the code, or the procedure to write code for it. Thanks in advance.

    Read the article

  • How to speed this kind of for-loop?

    - by wok
    I would like to compute the maximum of translated images along the direction of a given axis. I know about ordfilt2, however I would like to avoid using the Image Processing Toolbox. So here is the code I have so far: imInput = imread('tire.tif'); n = 10; imMax = imInput(:, n:end); for i = 1:(n-1) imMax = max(imMax, imInput(:, i:end-(n-i))); end Is it possible to avoid using a for-loop in order to speed the computation up, and, if so, how?

    Read the article

  • How do i loop an ajax request (using jquery) and jsp

    - by Mrshll187
    <script> //when page is ready do the following $(document).ready(function() { //set interval of refresh setInterval(doAjaxMethod, 1000); }); function doAjaxMethod(id) { $.ajax({ url: "getStatus/"+id, dataType: "json", success: function(json) { $('#ajaxStatus').html(json.status); } }); </script> <% //How can I do something like this int n = object.size(); for(int i=0; i<n; i++) { doAjaxMethod(object.getId()); } %> <div id=ajaxStatus> status updates here </div>

    Read the article

  • how to check if a data exist on a table using hibernate

    - by David
    im using hibernate with my jsp page and mySQL ,how can i do that select * from student wher userName = *** with HQL and how i chek if that username exist in 'Student' table ? in my sql i use that ResultSet resultat = statement.executeQuery(); if (resultat.next()) { ....} i try this Session hibernateSession = MyDB.HibernateUtil.currentSession(); hibernateSession.find("select xxx from Etudinat where p.Nom=xxxx"); thats give an exception so how can i do that ? i have a login form send me a username and password i want to chek if that username exist in the table Student to set the user on a session what is the safty way to do that

    Read the article

  • What's the meaning of 'char (*p)[5];'?

    - by jpmelos
    people. I'm trying to grasp the differences between these three declarations: char p[5]; char *p[5]; char (*p)[5]; I'm trying to find this out by doing some tests, because every guide of reading declarations and stuff like that has not helped me so far. I wrote this little program and it's not working (I've tried other kinds of use of the third declaration and I've ran out of options): #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { char p1[5]; char *p2[5]; char (*p3)[5]; strcpy(p1, "dead"); p2[0] = (char *) malloc(5 * sizeof(char)); strcpy(p2[0], "beef"); p3[0] = (char *) malloc(5 * sizeof(char)); strcpy(p3[0], "char"); printf("p1 = %s\np2[0] = %s\np3[0] = %s\n", p1, p2[0], p3[0]); return 0; } The first and second works alright, and I've understood what they do. What is the meaning of the third declaration and the correct way to use it? Thank you!

    Read the article

  • [PHP] Check Valid date type

    - by yukou
    may be this question had been asked, I've searched but still not confident about my problem.. my problem is checking valid date from string $a='23-June-11'; //valid $b='Normal String';//invalid I want to convert $a and $b using strtotime() before I do that, of course i want to validate whether $a or $b is a valid date format From $a i can get 23, 11 using explode function, but how about 'June'? using function above, 'June' is not numeric

    Read the article

  • ls output changing when used through exec()

    - by user359650
    I'm using the ls command via PHP and exec() and I get a different output than when I run the same command via the shell. When running ls through PHP the year and month of the date get changed into the month name: Running the command through the shell: $ ls -lh /path/to/file -rw-r--r-- 1 sysadmin sysadmin 36M 2011-05-18 13:25 file Running the command via PHP: <?php exec("ls -lh /path/to/file", $output); print_r($output); /* Array ( [0] => -rw-r--r-- 1 sysadmin sysadmin 36M May 18 13:25 file ) */ Please note that: -the issue doesn't occur when I run the PHP script via the cli (it only occurs when run through apache) -I checked the source code of the page to make sure that what I was seeing was what I was getting (and I do get the month name instead of the proper date) -I also run the ls command through the shell as the www-data user to see if ls was giving different output depending on the user (the output is the always the same from the shell, that is I get the date in yyyy-mm-dd instead of the month name)

    Read the article

  • Java - jar with librairies included

    - by kozher
    I am currently trying to make a Jar with all my librairies included. What I have done. I have created folders like this : - main folder - class (which contain all my classes) - ressources (containing all my librairies : mongo, jedis...) - MANIFEST.MF My main class is named process. My manifest is like this : Main-Class: processEAN Class-Path: ressources\commons-pool-1.5.6.jar ressources\jedis-2.0.0.jar resources\mongo-2.6.3.jar class - I have generated the JAR with this command : jar cvmf MANIFEST.MF processEAN.jar class/*.class ressources/*.jar My problem : When executing the JAR I have still the message "Exception in thread "main" java.lang.NoClassDefFoundError: processEAN" Any ideas ? Thanks

    Read the article

  • Javascript: how to access anonymous object within object?

    - by Caballero
    I have a string generated by php's json_encode() that looks like this: [ { "key1":"value1", "key2":"value2", "key3":"value3" }, { "key1":"value1", "key2":"value2", "key3":"value3" } ] I use Javascript function to convert the string to Javascript object: var jsonObj=JSON.parse(string); How do I access the data inside since the inner objects have no names? I tried something like: alert(jsonObj.firstChild.key1); It gives me "undefined". Why is that so?

    Read the article

  • SQL Alchemy: Relationship with grandson

    - by giomasce
    I'm building a SQL Alchemy structure with three different levels of objects; for example, consider a simple database to store information about some blogs: there are some Blog object, some Post object and some Comment objects. Each Post belongs to a Blog and each Comment belongs to a Post. Using backref I can automatically have the list of all Posts belonging to a Blog and similarly for Comments. I drafted a skeleton for such a structure. What I would like to do now is to have directly in Blog an array of all the Comments belonging to that Blog. I've tried a few approaches, but they don't work or even make SQL Alchemy cry in ways I can't fix. I'd think that mine is quite a frequent need, but I couldn't find anything helpful. Colud someone suggest me how to do that? Thanks.

    Read the article

  • The risk of granting to IUSR* NTFS permissions on a folder on the server

    - by vtortola
    I have two web applications that must share a file in the server file system. Both apps are inside of "Inetpub\wwwroot". The file cannot be accessed freely from outside, so it is in a folder out of "Inetpub". I have granted full NTFS permissions to the user "IUSR_whatever" (is the user that runs IIS in anonymous requests) in that folder. The folder has only that file, and has no other use. It works so far :) But, what is the risk? what should I be afraid of? As I see it, as long the folder is out of the "InetPub" cannot be accessed, and as long the apps don't have any security flaw like "path traversal" or server side code injection, it should be safe enough.... But I'm always keen to be wrong :) What do you think? May the file or even the server itself get compromised because of this? Thanks.

    Read the article

  • Extensionless URLs in IIS 6

    - by Jason Marsell
    My client has asked me to build a personalized URL system so that they can send out really short URLs in postcards to customers like this: www.client.com/JasonSmith03 www.client.com/TonyAdams With these URLs, I need IIS 6 to trap the incoming request and pass that “JasonSmith03” token to my database to determine which landing page to redirect them to. I’d love to use an HttpHandler or HttpModule but they both look like they require an file extension (.aspx) in the URL. Wildcard mapping will chew up every incoming request and that’s ridiculous. ISAPI filters are just text routing files, so I can’t employ logic to call the database. According to Scott Guthrie, this would be cake if I had IIS 7, but I don’t. Can this be done using MVC? I’ve been working with MVP for the last few years, so I haven’t done any MVC and routing. I thought I remembered that MVC has the ability to use REST-style extensionless URLs. I’d be more than happy to have these personalized URLs land on a site that’s built in MVC, if it will work. Thank you!

    Read the article

  • Thread 1: Program received signal:"Sigbart"

    - by user813678
    When i try to run my app on my iPhone, I get " Thread 1: Program received signal:"Sigbart" xCode say that points to [self.navigationController pushViewController:detailViewController animated:YES]; import "RootViewController.h" import "global.h" import "golfbaner.h" @implementation RootViewController @synthesize banenavn; (void)viewDidLoad { [super viewDidLoad]; NSArray *temp = [[NSArray alloc] initWithObjects: @"Alsten Golfklubb", @"Arendal og Omegn Golfklubb", @"Asker Golfklubb", @"Askim Golfklubb", @"Atlungstad Golfklubb", @"Aurskog Golfpark", @"Ballerud Golfklubb", @"Bamble Golfklubb", @"Bergen Golfklubb", @"Bjorli Golfklubb", @"Bjørnefjorden Golfklubb", @"Bjaavann Golfklubb", @"Bodø Golfbane", @"Borre Golfbane", @"Borregaard Golfklubb", @"Brønnøysund Golfklubb", @"Byneset Golfklubb", @"Bærum Golfklubb", @"Drammen Golfklubb", @"Drøbak Golfklubb", @"Egersund Golfklubb", @"Eidskog Golfklubb", @"Eiker Golfklubb", @"Ekholt Golfklubb", @"Elverum Golfklubb", @"Fana Golfklubb", @"Fet Golfklubb", @"Frosta Golfklubb", @"Geilo Golfklubb", @"Giske Golfklubb", @"Gjerdrum Golfpark", @"Gjersjøen Golfklubb", @"Gjøvik og Toten Golfklubb", @"Gran Golfklubb", @"Grenland Golfklubb", @"Grimstad Golfklubb", @"Grini Golfklubb", @"Groruddalen Golfklubb", @"Grønmo Golfklubb", @"Hafjell Golfklubb", @"Haga Golfpark", @"Hakadal Golfklubb", @"Halden Golfklubb", @"Hallingdal Golfklubb", @"Hammerfest og Kvalsund Golfklubb", @"Hardanger Golfklubb", @"Harstad Golfklubb", @"Haugaland Golfklubb", @"Hauger Golf", @"Haugesund Golfklubb", @"Helgeland Golfklubb", @"Hemsedal Golfklubb", @"Herdla Golfklubb", @"Hitra Golfklubb", @"Hof Golfklubb", @"Holtsmark Golfklubb", @"Hovden Golfklubb", @"Hurum Golfklubb", @"Huseby og Hankø Golfklubb", @"Hvaler Golfklubb", @"Hvam Golfklubb", @"Jæren Golfklubb", @"Karasjok Golfklubb", @"Karmøy Golfklubb", @"Kjekstad Golfklubb", @"Klæbu Golfklubb", @"Kongsberg Golfklubb", @"Kongsvinger Golfklubb", @"Kragerø Golfklubb", @"Kristiansand Golfklubb", @"Kristiansund og Omegn Golfklubb", @"Krokhol Golfklubb", @"Kvinesdal og Omegn Golfklubb", @"Kvinnherad Golfklubb", @"Kvitfjell", @"Larvik Golfklubb", @"Lillehammer Golf Park", @"Lillestrøm Golfklubb", @"Lofoten Golf Links", @"Lommedalen Golfklubb", @"Losby Golfklubb", @"Lærdal Golfklubb", @"Lønne Golfklubb", @"Mandal Golfklubb", @"Meland Golfklubb", @"Midt-Troms Golfklubb", @"Miklagard Golfklubb", @"Mjøsen Golfklubb", @"Moa Golfklubb", @"Modum Golfklubb", @"Molde Golfklubb", @"Moss og Rygge Golfklubb", @"Mørk Golfklubb", @"Namdal Golfklubb", @"Namsos Golfklubb", @"Narvik Golfklubb", @"Nes Golfklubb", @"Nittedal Golfklubb", @"Nordfjord Golfklubb", @"Nordvegen Golfklubb", @"Norefjell Golfklubb", @"Norsjø og Omegn Golfklubb", @"North Cape Golf Club", @"Nærøysund Golfklubb", @"Nøtterøy Golfklubb", @"Odda Golfklubb", @"Ogna Golfklubb", @"Onsøy Golfklubb", @"Oppdal Golfklubb", @"Oppegård Golfklubb", @"Oslo Golfklubb", @"Oustøen Country Club", @"Polarsirkelen Golf", @"Preikestolen Golfklubb", @"Randaberg Golfklubb", @"Randsfjorden Golfklubb", @"Rauma Golfklubb", @"Re Golfklubb", @"Ringerike Golfklubb", @"Rygge Flystasjon Golf Club", @"Røros Golfklubb", @"Salten Golfklubb", @"Sandane Golfklubb", @"Sande Golfklubb", @"Sandefjord Golfklubb", @"Sandnes Golfklubb", @"Sauda Golfklubb", @"Selbu Golfklubb", @"Selje Golfklubb", @"Setesdal Golfklubb", @"Skei Golfklubb", @"Ski Golfklubb", @"Skjeberg Golfklubb", @"Smøla Golfklubb", @"Sola Golfklubb", @"Solastranden Golfklubb", @"Solum Golfklubb", @"Soon Golfklubb", @"Sorknes Golfklubb", @"Sotra Golfklubb", @"Stavanger Golfklubb", @"Steinkjer Golfklubb", @"Stiklestad Golfklubb", @"Stjørdal Golfklubb", @"Stord Golfklubb", @"Stranda Golfklubb", @"Stryn Golfklubb", @"Sunndal Golfklubb", @"Sunnfjord Golfklubb", @"Sunnmøre Golfklubb", @"Surnadal Golfklubb", @"Tjøme Golfklubb", @"Tromsø Golfklubb", @"Trondheim Golfklubb", @"Trysil Golfklubb", @"Tyrifjord Golfklubb", @"Ullensaker Golfklubb", @"Valdres Golfklubb", @"Vanylven Golfklubb", @"Varanger Golfklubb", @"Vesterålen Golfklubb", @"Vestfold Golfklubb", @"Vildmarken Golfklubb", @"Volda Golfklubb", @"Voss Golfklubb", @"Vrådal Golfklubb", @"Østmarka Golfklubb", @"Øya Golfpark", @"Ålesund Golfklubb", nil]; self.banenavn = temp; [temp release]; self.title = @"Golfbaner i Norge"; self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; } (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; } (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations. return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ // Customize the number of sections in the table view. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [banenavn count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } cell.textLabel.text = [banenavn objectAtIndex:indexPath.row]; return cell; } /* // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } */ /* // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source. [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. } } */ /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */ /* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { golf = [banenavn objectAtIndex:indexPath.row]; golfbaner *detailViewController = [[golfbaner alloc] initWithNibName:@"Golfbaner" bundle:nil]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Relinquish ownership any cached data, images, etc that aren't in use. } (void)viewDidUnload { [super viewDidUnload]; // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand. // For example: self.myOutlet = nil; } (void)dealloc { [super dealloc]; } @end

    Read the article

  • Setting custom HTTP request headers in an URL object doesn't work.

    - by Blagovest Buyukliev
    I am trying to fetch an image from an IP camera using HTTP. The camera requires HTTP basic authentication, so I have to add the corresponding request header: URL url = new URL("http://myipcam/snapshot.jpg"); URLConnection uc = url.openConnection(); uc.setRequestProperty("Authorization", "Basic " + new String(Base64.encode("user:pass".getBytes()))); // outputs "null" System.out.println(uc.getRequestProperty("Authorization")); I am later passing the url object to ImageIO.read(), and, as you can guess, I am getting an HTTP 401 Unauthorized, although user and pass are correct. What am I doing wrong? I've also tried new URL("http://user:pass@myipcam/snapshot.jpg"), but that doesn't work either.

    Read the article

  • Playing .swf file in MediaPlayer?

    - by Omar
    I'm having some issues in playing .swf files on my application. On my PC, using Media Player Classic, they work normally, but on my phone they dont, all I hear is weird sounds.. the code I use to play: mediaplayer = MediaPlayer.create(getBaseContext(), Uri.parse(CurrentAyaSoundPath)); Can anyone tell me why I cant play .swf files normally? Is there another way to play them? Edit1: the .swf are sound only.. no video

    Read the article

  • How to call AJAX API function from Windows App?

    - by stiopa
    Some company is providing me with web-based API for using their services. I have no problem calling this API functions from within web brower: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://someaddress.com?&key=somekey"></script> <script type="text/javascript"> var object = new SomeObject(); object.SomeFunction(); </script> </head> I am interested in return value of SomeFunction(). How would I get this return value from windows application?

    Read the article

  • DuplicateKeyException in LINQ, but I've set auto increment and auto sync

    - by Fritos
    I'm getting a DuplicateKeyException error in my C# code. I've set Auto Generated = true, and Auto-Sync = OnInsert in my dbml. I'm not even touching the PK field in any manually written code (as seen below [My primary key field is actually called PK]). using (DeviceExerciseDataDataContext context = new DeviceExerciseDataDataContext()) { foreach(Data tgudData in data.Data) { tgd = new tableData(); tgd.FK = key; tgd.Time = tgudData.TimeStamp; tgd.Calories = Convert.ToInt32(tgudData.Calories); tgd.HeartRate = tgudData.AvgHr; tgd.BenchAngle = tgudData.Angle; tgd.WorkoutTarget = 0; tgd.Reps = tgudData.Reps; context.tableDatas.InsertOnSubmit(tgd); } context.SubmitChanges(); } This is the code for the column in the designer (columns are named PK and FK) [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PK", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)] public int PK { get { return this._PK; } set { if ((this._PK != value)) { this.OnPKChanging(value); this.SendPropertyChanging(); this._PK = value; this.SendPropertyChanged("PK"); this.OnPKChanged(); } } } [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FK", DbType="Int")] public System.Nullable<int> FK { get { return this._FK; } set { if ((this._FK != value)) { this.OnFKChanging(value); this.SendPropertyChanging(); this._FK = value; this.SendPropertyChanged("FK"); this.OnFKChanged(); } } }

    Read the article

  • java /TableModel of Objects/Update Object"

    - by Tomás Ó Briain
    I've a collection of Stock objects that I'm updating about 10/15 variables for in real-time. I'm accessing each Stock by its ID in the collection. I'm also trying to display this in a JTable and have implemented an AbstractTablemodel. It's not working too well. I've a RowMap that I add each ID to as Stocks are added to the TableModel. To update the prices and variables of all the stocks in the TableModel, I want to send a Stock object to an updateModel(Stock s) method. I can find the relevant row by searching the map, but how do I handle this nicely, so I don't have to start iterating through table columns and comparing the values of the cells to the variables of the object to see whether there are any differences?? Basically, i want to send a Stock object to the TableModel and update cells if there are changes and do nothing if there aren't. Any ideas about how to implement a TableModel that might do this? Any pointeres at all would be appreciated. Thanks.

    Read the article

  • Is it possible to destroy a CDI scope?

    - by Matt Ball
    I'm working on a Java EE application, primarily JAX-RS with a JSF admin console, that uses CDI/Weld for dependency injection with @ApplicationScoped objects. Minor debugging issues aside, CDI has worked beautifully for this project. Now I need some very coarse-grained control over CDI-injected object lifecycles. I need the ability to: Remove an injected object from the application context, or Destroy/delete/clear/reset/remove the entire application context, or Define my own @ScopeType and implementing Context in which I could provide methods to perform one of the two above tasks. I'm fully aware that this is across, if not against, the grain of CDI and dependency injection in general. I just want to know Is this remotely possible? If yes, what is the easiest/simplest/quickest/foolproofiest way to get the job done?

    Read the article

  • Can I access the function body of an event listener using nodeJS jsdom

    - by Zhami
    I am using jsdom with nodeJS. I load in a large HTML document, and am using jQuery to navigate the DOM. I have a case where I have an element, and I need to access the function body of an event listener (onclick). The event listener was added in the source HTML: <a href="#" onclick="javascript:window.open('http://<rest-of-url>'); return false;"></a> The onclick attribute of the DOM element is undefined. btw: what I really want to do is get the URL (please note that <rest-of-url> is not what is in the source, a real URL spec is there) that is specified in the source.

    Read the article

  • How do I make a lock that allows only ONE thread to read from the resource ?

    - by mare
    I have a file that holds an integer ID value. Currently reading the file is protected with ReaderWriterLockSlim as such: public int GetId() { _fileLock.EnterUpgradeableReadLock(); int id = 0; try { if(!File.Exists(_filePath)) CreateIdentityFile(); FileStream readStream = new FileStream(_filePath, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(readStream); string line = sr.ReadLine(); sr.Close(); readStream.Close(); id = int.Parse(line); return int.Parse(line); } finally { SaveNextId(id); // increment the id _fileLock.ExitUpgradeableReadLock(); } } The problem is that subsequent actions after GetId() might fail. As you can see the GetId() method increments the ID every single time, disregarding what happens after it has issued an ID. The issued ID might be left hanging (as said, exceptions might occur). As the ID is incremented, some IDs might be left unused. So I was thinking of moving the SaveNextId(id) out, remove it (the SaveNextId() actually uses the lock too, except that it's EnterWriteLock). And call it manually from outside after all the required methods have executed. That brings out another problem - multiple threads might enter the GetId() method before the SaveNextId() gets executed and they might all receive the same ID. I don't want any solutions where I have to alter the IDs after the operation, correcting them in any way because that's not nice and might lead to more problems. I need a solution where I can somehow callback into the FileIdentityManager (that's the class that handles these IDs) and let the manager know that it can perform the saving of the next ID and then release the read lock on the file containing the ID. Essentialy I want to replicate the relational databases autoincrement behaviour - if anything goes wrong during row insertion, the ID is not used, it is still available for use but it also never happens that the same ID is issued. Hopefully the question is understandable enough for you to provide some solutions..

    Read the article

  • Jquery Mobile app focus-based navigation stops working after switching between pages

    - by nawar
    As much as I would like to expand on the details here, I am not able to find relevant information about the root cause of this problem. I am having this issue with my blackberry Webapp which I built using JQM. After few times of navigation from page to page, the application becomes unresponsive on the destination page and I am not able to scroll up/down using the touchpad. If someone had this problem or some clue to the resolution, then that would be helpful. Edit: after doing some research I was able to narrow down the cause of the issue. I am having an issue with focus-based navigation. As I lose focus on the page elements (buttons, input fields, etc) after few transitions among the pages. Edit I had to switch back to the cursor based navigation as it is much faster and do not have the issue faced by focus-based navigation. I removed the entry: <rim:navigation mode=”focus”/> from the config.xml file I found this entry on the blackberry fourms but it haven't solved my problem despite the fact I upgraded my WebWorks SDK to 2.0 from 1.5 http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Focus-based-navigation-hangs-device/td-p/455600 Thanks

    Read the article

  • PetaPoco with parameterised stored procedure and Asp.Net MVC

    - by Jalpesh P. Vadgama
    I have been playing with Micro ORMs as this is very interesting things that are happening in developer communities and I already liked the concept of it. It’s tiny easy to use and can do performance tweaks. PetaPoco is also one of them I have written few blog post about this. In this blog post I have explained How we can use the PetaPoco with stored procedure which are having parameters.  I am going to use same Customer table which I have used in my previous posts. For those who have not read my previous post following is the link for that. Get started with ASP.NET MVC and PetaPoco PetaPoco with stored procedures Now our customer table is ready. So let’s Create a simple process which will fetch a single customer via CustomerId. Following is a code for that. CREATE PROCEDURE mysp_GetCustomer @CustomerId as INT AS SELECT * FROM [dbo].Customer where CustomerId=@CustomerId Now  we are ready with our stored procedures. Now lets create code in CustomerDB class to retrieve single customer like following. using System.Collections.Generic; namespace CodeSimplified.Models { public class CustomerDB { public IEnumerable<Customer> GetCustomers() { var databaseContext = new PetaPoco.Database("MyConnectionString"); databaseContext.EnableAutoSelect = false; return databaseContext.Query<Customer>("exec mysp_GetCustomers"); } public Customer GetCustomer(int customerId) { var databaseContext = new PetaPoco.Database("MyConnectionString"); databaseContext.EnableAutoSelect = false; var customer= databaseContext.SingleOrDefault<Customer>("exec mysp_GetCustomer @customerId",new {customerId}); return customer; } } } Here in above code you can see that I have created a new method call GetCustomer which is having customerId as parameter and then I have written to code to use stored procedure which we have created to fetch customer Information. Here I have set EnableAutoSelect=false because I don’t want to create Select statement automatically I want to use my stored procedure for that. Now Our Customer DB class is ready and now lets create a ActionResult Detail in our controller like following using System.Web.Mvc; namespace CodeSimplified.Controllers { public class HomeController : Controller { public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult About() { return View(); } public ActionResult Customer() { var customerDb = new Models.CustomerDB(); return View(customerDb.GetCustomers()); } public ActionResult Details(int id) { var customerDb = new Models.CustomerDB(); return View(customerDb.GetCustomer(id)); } } } Now Let’s create view based on that ActionResult Details method like following. Now everything is ready let’s test it in browser. So lets first goto customer list like following. Now I am clicking on details for first customer and Let’s see how we can use the stored procedure with parameter to fetch the customer details and below is the output. So that’s it. It’s very easy. Hope you liked it. Stay tuned for more..Happy Programming

    Read the article

  • Inside Red Gate - Be Reasonable!

    - by simonc
    As I discussed in my previous posts, divisions and project teams within Red Gate are allowed a lot of autonomy to manage themselves. It's not just the teams though, there's an awful lot of freedom given to individual employees within the company as well. Reasonableness How Red Gate treats it's employees is embodied in the phrase 'You will be reasonable with us, and we will be reasonable with you'. As an employee, you are trusted to do your job to the best of you ability. There's no one looking over your shoulder, no one clocking you in and out each day. Everyone is working at the company because they want to, and one of the core ideas of Red Gate is that the company exists to 'let people do the best work of their lives'. Everything is geared towards that. To help you do your job, office services and the IT department are there. If you need something to help you work better (a third or fourth monitor, footrests, or a new keyboard) then ask people in Information Systems (IS) or Office Services and you will be given it, no questions asked. Everyone has administrator access to their own machines, and you can install whatever you want on it. If there's a particular bit of software you need, then ask IS and they will buy it. As an example, last year I wanted to replace my main hard drive with an SSD; I had a summer job at school working in a computer repair shop, so knew what to do. I went to IS and asked for 'an SSD, a SATA cable, and a screwdriver'. And I got it there and then, even the screwdriver. Awesome. I screwed it in myself, copied all my main drive files across, and I was good to go. Of course, if you're not happy doing that yourself, then IS will sort it all out for you, no problems. If you need something that the company doesn't have (say, a book off Amazon, or you need some specifications printing off & bound), then everyone has a expense limit of £100 that you can use without any sign-off needed from your managers. If you need a company credit card for whatever reason, then you can get it. This freedom extends to working hours and holiday; you're expected to be in the office 11am-3pm each day, but outside those times you can work whenever you want. If you need a half-day holiday on a days notice, or even the same day, then you'll get it, unless there's a good reason you're needed that day. If you need to work from home for a day or so for whatever reason, then you can. If it's reasonable, then it's allowed. Trust issues? A lot of trust, and a lot of leeway, is given to all the people in Red Gate. Everyone is expected to work hard, do their jobs to the best of their ability, and there will be a minimum of bureaucratic obstacles that stop you doing your work. What happens if you abuse this trust? Well, an example is company trip expenses. You're free to expense what you like; food, drink, transport, etc, but if you expenses are not reasonable, then you will never travel with the company again. Simple as that. Everyone knows when they're abusing the system, so simply don't do it. Along with reasonableness, another phrase used is 'Don't be an a**hole'. If you act like an a**hole, and abuse any of the trust placed in you, even if you're the best tester, salesperson, dev, or manager in the company, then you won't be a part of the company any more. From what I know about other companies, employee trust is highly variable between companies, all the way up to CCTV trained on employee's monitors. As a dev, I want to produce well-written & useful code that solves people's problems. Being able to get whatever I need - install whatever tools I need, get time off when I need to, obtain reference books within a day - all let me do my job, and so let Red Gate help other people do their own jobs through the tools we produce. Plus, I don't think I would like working for a company that doesn't allow admin access to your own machine and blocks Facebook! Cross posted from Simple Talk.

    Read the article

  • Rotating text using CSS

    - by Renso
    Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} Goal: Rotating text using css only. How: Surprisingly IE supports this feature rather well. You could use property filters in IE, but since this is only supported on IE browsers, I would not recommend it. CSS3, still in proposal state, has a "writing-mode" property for doing this. It has been part of IE's browser engine since IE5.5. Now that it is part of the CSS3 draft specification, would be the best way to implement this going forward. Webkit based browsers; Firefox 3.5+, Opera 11 and IE9 implement this feature differently by utilizing the transform property. Without using third-party JavaScript or CSS properties, we can use the CSS3 "writing-mode" property, supported from IE5.5 up to IE8, the latter adding addition formatting options through -ms extensions. <style type="text/css"> .rightToLeft{ writing-mode: tb-rl; } </style> <p class="rightToLeft">This is my text</p> This will rotate the text 90 degrees, starting from the right to the left. Here are all the options: ·         lr-tb – Default value, left to right, top to bottom ·         rl-tb – Right to left, top to bottom ·         tb-rl – Vertically; top to bottom, right to left ·         bt-rl – Vertically; bottom to top, right to left ·         tb-lr – Available in IE8+: -ms-writing-mode; top to bottom, left to right ·         bt-lr – Bottom to top, left to right ·         lr-bt – Left to right, bottom to top What about Firefox, Safari, etc.? The following techniques need to be used on Webkit browsers like Firefox, Opera 11, Google Chrome and IE9. These browsers require their proprietary vendor extensions: -moz-, -webkit-, -o- and -ms-. -webkit-transform: rotate(90deg);    -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); transform: rotate(90deg);

    Read the article

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