Search Results

Search found 10177 results on 408 pages for 'thumbs db'.

Page 146/408 | < Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >

  • How do you automatically refresh part of a page automatically using Javascript or AJAX?

    - by Ryan
    $messages = $db->query("SELECT * FROM chatmessages ORDER BY datetime DESC, displayorderid DESC LIMIT 0,10"); while($message = $db->fetch_array($messages)) { $oldmessages[] = $message['message']; } $oldmessages = array_reverse($oldmessages); ?> <div id="chat"> <?php for ($count = 0; $count < 9; $count++) { echo $oldmessages[$count]; } ?> <script language="javascript" type="text/javascript"> <!-- setInterval( "document.getElementById('chat').innerHTML='<NEW CONTENT OF #CHAT>'", 1000 ); --> </script> </div> I'm trying to create a PHP chatroom script but I'm having a lot of trouble getting it to AutoRefresh The content should automatically update to , how do you make it do that? I've been searching for almost an hour

    Read the article

  • Exposing a "dumbed-down", read-only instance of a Model in GAE

    - by Blixt
    Does anyone know a clever way, in Google App Engine, to return a wrapped Model instance that only exposes a few of the original properties, and does not allow saving the instance back to the datastore? I'm not looking for ways of actually enforcing these rules, obviously it'll still be possible to change the instance by digging through its __dict__ etc. I just want a way to avoid accidental exposure/changing of data. My initial thought was to do this (I want to do this for a public version of a User model): class ReadOnlyUser(db.Model): display_name = db.StringProperty() @classmethod def kind(cls): return 'User' def put(self): raise SomeError() Unfortunately, GAE maps the kind to a class early on, so if I do ReadOnlyUser.get_by_id(1) I will actually get a User instance back, not a ReadOnlyUser instance.

    Read the article

  • Django Redundancy

    - by Sunsu
    I've read many things about scaling Django and the new multiple-DB support makes it so much easier. However, I have not been able to find much information on good ways to create a fully redundant system (not just one that scales). I realize there are many things that go into this problem, but the real thing I'm having trouble solving well is Database redundancy. Is it possible to set up a "write slave" using django's new multiple-DB support? If I had IP failover support it seems like having a write slave would help solve the problem. Simple MySQL replication doesn't seem like it will work due to slave lag right? What's the typical method of creating a redundant database system? Any input or guidance you guys have would be greatly appreciated. I realize I could be asking the wrong questions!

    Read the article

  • Database Error django

    - by Megan
    DatabaseError at /admin/delmarva/event/ no such column: delmarva_event.eventdate I created a class in my models.py file: from django.db import models from django.contrib.auth.models import User class Event(models.Model): eventname = models.CharField(max_length = 100) eventdate = models.DateField() eventtime = models.TimeField() address = models.CharField(max_length = 200) user = models.ForeignKey(User) def __unicode__(self): return self.eventname and now when i try to view my events in my admin or my main_page it gives me the error that there is no eventdate. I tried syncing the db again but nothing changed. Also, I hashtagged eventdate out to see if I get a different error and then it states that delmarva_event.eventtime does not exist as well. I It is weird because it does not have a problem with eventname. Any suggestions would be greatly appreciated!

    Read the article

  • How can this be done with (N)Hibernate?

    - by Vilx-
    I'm creating a windows forms application with NHibernate. It's an MDI application, so there is no limit to how many forms the user can have open at the same time (probably many). For most forms I want to have an "OK" and a "Cancel" button. Both close the form, but "OK" also saves the modified data to the DB. The forms can be pretty complex, and the modifications are likely to touch a whole graph of objects, adding some, deleting some, and changing some more. It would be good if the changes could be automatically detected and persisted as needed, without the need to manually keep track of each of them. What would be a good way to do this? Extra information: I can make whatever DB schema I want. I'm using MSSQL 2008 and currently have decided for GUID primary keys (with guid.comb generator) and a TIMESTAMP column for optimistic concurrency. I tried to simply set FlushMode of a NHibernate ISession to Never, doing all modifications as needed, and then calling Flush() if the user clicked OK. But that didn't work.

    Read the article

  • jQuery selector after dynamically created element

    - by Bryan Williams
    I am trying to get an dynamically created element using a jQuery selector but it is returning an empty array. The first thing I am doing is grabbing an empty div: var packDiv = document.getElementById('templates'); packDiv.innerHTML = ""; then adding items to it in a loop: packDiv.innerHTML = packDiv.innerHTML + "<img id='" + thumbName + "' src='thumbs/" + thumbName + "'/>"; after the loop finishes I try to select an item using: console.log($("#"+thumbName)); and it returns the empty array. All the things I search on show to use .on but all the examples show that is to set event handlers. My question is how do I format a selector for dynamically created elements?

    Read the article

  • Calling functions outside paths

    - by user1775718
    In mongojs, when you do: var birds = db.birds.find(searchTerm, callback); ...how do you pass arguments to the callback? I've tried bind, as in: birds = db.birds.find(searchTerm, app.get('getBirds').bind(res)); ...but to no avail. Just fyi I'm trying to pass the response object of the GET route so that the callback can render using res.send(results). The other option is to set app.set('res': res); and call app.get('res') from the callback - I'm not sure this is a good idea. It works, but it doesn't obey the events loop model too well - I think the request back to the app may be costly? Any help would be gratefully accepted. :)

    Read the article

  • [java] how to parse XML document?

    - by user32167
    I have xml document in variable (not in file). How can i get data storaged in that? I don't have any additional file with that, i have it 'inside' my sourcecode. When i use DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(XML); (XML is my xml variable), i get an error java.io.FileNotFoundException: C:\netbeans\app-s7013\<network ip_addr="10.0.0.0\8" save_ip="true"> File not found.

    Read the article

  • Is It possible to use the second part of this code for repository patterns and generics

    - by newToCSharp
    Is there any issues in using version 2,to get the same results as version 1. Or is this just bad coding. Any Ideas public class Customer { public int CustomerID { get; set; } public string EmailAddress { get; set; } int Age { get; set; } } public interface ICustomer { void AddNewCustomer(Customer Customer); void AddNewCustomer(string EmailAddress, int Age); void RemoveCustomer(Customer Customer); } public class BALCustomer { private readonly ICustomer dalCustomer; public BALCustomer(ICustomer dalCustomer) { this.dalCustomer = dalCustomer; } public void Add_A_New_Customer(Customer Customer) { dalCustomer.AddNewCustomer(Customer); } public void Remove_A_Existing_Customer(Customer Customer) { dalCustomer.RemoveCustomer(Customer); } } public class CustomerDataAccess : ICustomer { public void AddNewCustomer(Customer Customer) { // MAKE DB CONNECTION AND EXECUTE throw new NotImplementedException(); } public void AddNewCustomer(string EmailAddress, int Age) { // MAKE DB CONNECTION AND EXECUTE throw new NotImplementedException(); } public void RemoveCustomer(Customer Customer) { // MAKE DB CONNECTION AND EXECUTE throw new NotImplementedException(); } } // VERSION 2 public class Customer_New : DataRespository<CustomerDataAccess> { public int CustomerID { get; set; } public string EmailAddress { get; set; } public int Age { get; set; } } public class DataRespository<T> where T:class,new() { private T item = new T(); public T Execute { get { return item; } set { item = value; } } public void Update() { //TO BE CODED } public void Save() { //TO BE CODED } public void Remove() { //TO BE CODED } } class Program { static void Main(string[] args) { Customer_New cus = new Customer_New() { Age = 10, EmailAddress = "[email protected]" }; cus.Save(); cus.Execute.RemoveCustomer(new Customer()); // Repository Version Customer customer = new Customer() { EmailAddress = "[email protected]", CustomerID = 10 }; BALCustomer bal = new BALCustomer(new CustomerDataAccess()); bal.Add_A_New_Customer(customer); } } }

    Read the article

  • servlet stops working with tomcat server after some hits or time

    - by nekin
    hi all i have very strange issue with some of my servlet. below is my configuration Folder A is having X number os servelet deployed in tomcat directory Folder B is having Y number of servelet deployed in tomcat directory. now after certain amount of time or hits to any of the servelet in Folder B is stops working properly, whereas at same time All servelet of Folder A works fine i am not able to trace where i am doing mistake all coding for both folder's servelet is same only difference is they are with different dB, but it is very simple read only operation with dB though. any idea ? thks

    Read the article

  • How to create wordpress-like option table and get values for each row?

    - by Nacho
    Hi guys. I'm looking to create an options table in my db that makes every record a system option, so I can work with a little number of fields. My db has the following structure: 3 columns named id, name, and value The following data is inserted as an example: +--+-----------+--------------------------+ |id|name |value | +--+-----------+--------------------------+ | 1|uri |www.example.com | | 2|sitename |Working it out | | 3|base_folder|/folder1/folder2/ | | 4|slogan |Just a slogan for the site| +--+-----------+--------------------------+ That way I can include a large number of customizable system options very easily. The problem is that I don't know how to retrieve them. How do I get the value of uri and store it as a var? And better yet, how do I get, for exmaple, values of id 1 and 4 only without making a query each time? (I assume multiple queries are useless and a pretty ugly method.) I know the question is pretty basic but I'm lost here. I'd really appreciate your answer!

    Read the article

  • General question: Filesystem or database?

    - by poeschlorn
    Hey guys, i want to create a small document management system. there are several users who store their files. each file which is uploaded contains an info which user uploaded it and the document content itself. In a view there are displayed all files of ONE specific user, ordered by date. What would be better: 1) giving the documents a name or metadata(XML) which contain the date and user (and iterate through them to get the metadata) or 2) giving the files a random/unique name and store metadata in a DB? something like this: date | user | filename What would you say and why? The used programming language is java and the DB is MySQL.

    Read the article

  • get count from Iqueryable<T> in linq-to-sql?

    - by Pandiya Chendur
    The following code doesn't seem to get the correct count..... var materials = consRepository.FindAllMaterials().AsQueryable(); int count = materials.Count(); Is it the way to do it.... Here is my repository which fetches records... public IQueryable<MaterialsObj> FindAllMaterials() { var materials = from m in db.Materials join Mt in db.MeasurementTypes on m.MeasurementTypeId equals Mt.Id where m.Is_Deleted == 0 select new MaterialsObj() { Id = Convert.ToInt64(m.Mat_id), Mat_Name = m.Mat_Name, Mes_Name = Mt.Name, }; return materials; }

    Read the article

  • Copy image to BLOB from client pc aka Java function in Oracle

    - by mumich
    Hi guys, I've been stuck with this for past two days. I've go java function stored in Oracle system which is supposed to copy image from local drive do remote database and store it in BLOB - it's called CopyBLOB and looks like this: import java.sql.*; import oracle.sql.*; import java.io.*; public class CopyBLOB { static int id; static String fileName = null; static Connection conn = null; public CopyBLOB(int idz, String f) { id = idz; fileName = f; } public static void copy(int ident, String path) throws SQLException, FileNotFoundException { CopyBLOB cpB = new CopyBLOB(ident, path); cpB.getConnection(); cpB.callUpdate(id, fileName); } public void getConnection() throws SQLException { DriverManager.registerDriver (new oracle.jdbc.OracleDriver()); try { conn = DriverManager.getConnection("jdbc:oracle:thin:@oraserv.ms.mff.cuni.cz:1521:db", "xxx", "xxx"); } catch (SQLException sqlex) { System.out.println("SQLException while getting db connection: "+sqlex); if (conn != null) conn.close(); } catch (Exception ex) { System.out.println("Exception while getting db connection: "+ex); if (conn != null) conn.close(); } } public void callUpdate(int id, String file ) throws SQLException, FileNotFoundException { CallableStatement cs = null; try { conn.setAutoCommit(false); File f = new File(file); FileInputStream fin = new FileInputStream(f); cs = (CallableStatement) conn.prepareCall( "begin add_image(?,?); end;" ); cs.setInt(1, id ); cs.setBinaryStream(2, fin, (int) f.length()); cs.execute(); conn.setAutoCommit(true); } catch ( SQLException sqlex ) { System.out.println("SQLException in callUpdateUsingStream method of given status : " + sqlex.getMessage() ); } catch ( FileNotFoundException fnex ) { System.out.println("FileNotFoundException in callUpdateUsingStream method of given status : " + fnex.getMessage() ); } finally { try { if (cs != null) cs.close(); if (conn != null) conn.close(); } catch ( Exception ex ) { System.out.println("Some exception in callUpdateUsingStream method of given status : " + ex.getMessage( ) ); } } } } The wrapper function is defined in package "MyPackage" as folows: procedure image_adder( id varchar2, path varchar2 ) AS language java name 'CopyBLOB.copy(java.lang.String, java.lang.String)'; And the inserting function called image_add is as simple as this: procedure add_image( id numeric(10), pic blob) AS BEGIN insert into pictures values (seq_pic.nextval, id, pic); END add_image; Now the problem: When I type call MyPackage.image_adder(1, 'd:\samples\img.jpg'); I get the ORA-29531 Error: No method copy in class CopyBLOB. Can you help me, please?

    Read the article

  • Should I use WPF or Windows Forms Application for my project in C#?

    - by RAJ K
    I am developing a Client-Server based application in which client application will access server database to store billing information. It will also have report generation facility. Windows Forms is good in document printing & I don't see such facility or controls in WPF. If I am wrong then please correct me. I want database security, which DB should I use, SQL Server, MySQL or Oracle. I would like to use free DB but security is my priority. Please suggest how I can implement a Client-Server architecture with multiple clients in C#? Thank you Geeks!!!

    Read the article

  • Efficient way to combine results of two database queries.

    - by ensnare
    I have two tables on different servers, and I'd like some help finding an efficient way to combine and match the datasets. Here's an example: From server 1, which holds our stories, I perform a query like: query = """SELECT author_id, title, text FROM stories ORDER BY timestamp_created DESC LIMIT 10 """ results = DB.getAll(query) for i in range(len(results)): #Build a string of author_ids, e.g. '1314,4134,2624,2342' But, I'd like to fetch some info about each author_id from server 2: query = """SELECT id, avatar_url FROM members WHERE id IN (%s) """ values = (uid_list) results = DB.getAll(query, values) Now I need some way to combine these two queries so I have a dict that has the story as well as avatar_url and member_id. If this data were on one server, it would be a simple join that would look like: SELECT * FROM members, stories WHERE members.id = stories.author_id But since we store the data on multiple servers, this is not possible. What is the most efficient way to do this? Thanks.

    Read the article

  • How to Compare and fetch date in Cakephp ?

    - by delete me
    I am trying to make an availability calender and need to know how can I compare date when fetching it. My DB is id start_date end_date status Now suppose I want to fetch booking in next month, i.e. from 2010-03-01 to 2010-04-01. How should I fetch this data ? I did try comparing directly using an and condition but it didnt help. The format in DB is yyyy-mm-dd and I used the same to compare. But direct comparison does not work.

    Read the article

  • Linq to SQL - design question.

    - by UshaP
    HI, Currently i have one big datacontex with 35 tables (i dragged all my DB tables to the designer). I must admit it is very comfortable cause i have ORM to my full DB and query with linq is easy and simple. My questions are: 1. Would you consider it bad design to have one datacontext with 35 tables or should i split it to logic units? 2. Is there any performance penalties for using such a big datacontext? Thanks, Pini.

    Read the article

  • Remote Seam Persistence

    Hi. I have a button in a .xhtml file which calls a javascript function which calls a java function remotely (in jboss seam environment). That java function has an entityManager.persist(object). Do you know why this line of code doesn't commit to the DB? It says something that a transaction hasn't started. I supose in a remote context i don't have a transaction began because if i put an action on that button which calls the same java function instead of using javascript is above, it works fine; entityManager persists the object and i can see it in the DB. Does anyone has any ideas how could i make to actually persist the object using javascript to call the java function? (i have to use javascript because i need the callback function )

    Read the article

  • NoSQL for concurrent reads/writes

    - by Mickael Marrache
    After getting some performance issues for an application using a MySQL database, I'm thinking of using NoSQL solutions. My architecture is as follows: One application receives messages from the network at a high throughput (i.e. 50000 messages/sec). Each message is stored in the DB, so it's important for the write rate to be as fast as the arrival rate. Then, I also have some PHP pages that accesses the DB to get the data stored by the other application. It's important for me that the retrieved data is as relevant as possible (i.e. not old data, let's say not more than 5 seconds old). Also, the data is not critical, so I don't need any security mechanism to avoid losing the data. I see there are a lot of NoSQL solutions, but I don't know if they are all relevant. Could you please provide me some directions. Thanks

    Read the article

  • How to retrieve Google Appengine Objects by id (Long value) ?

    - by David
    Hi, i have declared an entity the following way: public class MyEntity { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String text; //getters and setters } Now I want to retrieve the objects using the id. I tried to manage it from the Google Appengine Data Viewer with "SELECT * FROM MyEntity Where id = 382005" or via a query in a servlet. I get no results returned. But i know for sure that the object with the id exists (i made a jsp which queries all objects in the db and displays them in the db). So what is wrong in my query? Am I querying the wrong field? The Google Appengine Data Viewer names the field "ID/name" and it has the value "id=382005". Do I have to query with this names? I've tried but it didn't work out :(

    Read the article

  • Get information from various sources

    - by Francesc
    Hi. I'm developing an app that has to get some information from various sources (APIs and RSS) and display it to the user in near real-time. What's the best way to get it: 1.Have a cron job to update them all accounts every 12h, and when a user is requesting one, update that account, save it to the DB and show it to the user? 2.Have a cron job to update them all accounts every 6h, and when a user is requesting one, update the account and showing it to the user without saving it to the DB? What's the best way to get it? What's faster? And what's the most scallable?

    Read the article

  • Java: Allowing the child thread to kill itself on InterruptedException?

    - by Zombies
    I am using a ThreadPool via ExecutorService. By calling shutDownNow() it interrupts all running threads in the pool. When this happens I want these threads to give up their resources (socket and db connections) and simply die, but without continuing to run anymore logic, eg: inserting anything into the DB. What is the simplest way to achieve this? Bellow is some sample code: public void threadTest() { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(999999); } catch (InterruptedException e) { //invoke thread suicide logic here } } }); t.start(); t.interrupt(); try { Thread.sleep(4000); } catch (InterruptedException e) { } }

    Read the article

  • Is it possible to create custom methods in entity classes in linq to sql

    - by doekman
    I have a table Site in SQL with (amongst others) three properties idReviewer1, idReviewer2, idReviewer3. Now I would like to create a methods on the entity class of Site to check if a user is a reviewer: partial class Site { public bool IsReviewer(int idUser) { return idReviewer1 == idUser || idReviewer2 == idUser || idReviewer3 == idUser; } } and I use it like this: return from s in db.Sites where s.IsReviewer(user) select s; However, Linq to SQL doesn't know how to translate this to SQL. I get the following error message: Method 'Boolean IsReviewer(Int32)' has no supported translation to SQL. I'd rather not write this: return from s in db.Sites where idReviewer1 == idUser || idReviewer2 == idUser || idReviewer3 == idUser select s; Is there any way to put this functionality in one place, without resorting to SQL?

    Read the article

< Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >