Daily Archives

Articles indexed Saturday January 15 2011

Page 23/28 | < Previous Page | 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • insert contacts into database but does not want to duplicate already existing contact.

    - by Frank Nwoko
    I am trying to insert contacts into database but does not want to duplicate already existing contact. Not sure INSERT has WHERE CLAUSE. Any ideas? //Insert INTO contact database $user_id = userid; $sql_insert = "INSERT into `jt_members_external_contacts` (`j_user_id`,`contact_email`,`firstname` ) VALUES ('$user_id','$email','$name') WHERE j_user_id !=$user_id AND contact_email != $email;";

    Read the article

  • Should I uniform different API calls to a single format before caching?

    - by bluedaniel
    The problem is that I am recreating the social media widget/icons on http://about.me/bluedaniel (thats me). Anyhow there can be up to 6 or 7 different API calls on the page and obviously I am caching them, at the moment with Memcached. The question is, as they arrive in various formats and sizes (fb-json, linkedin-xml, wordpress-rss etc), should I universally format/convert them before storing it in the cache. At present I have recreated the html widget and then stored that, but I worry about saving huge blocks of html in the cache as it doesn't seem that smart.

    Read the article

  • Displaying Data from a Join in Codeigniter

    - by Brad
    I am using a simple join to pull data from two databases. This is the join in the model function com_control(){ $this->db->select('*'); $this->db->from('comments'); $this->db->join('posts', 'comments.entry_id = posts.id'); $query = $this->db->get(); return $query->result; } My desired method of display is going to be in a table so I am starting out to use like this foreach($comm_control as $row){ $this->table->add_row( $row->entry_id, $row->comments.id, $row->comment, $row->title ); }//end of foreach My problem is the display of data from comments.id. What is the proper format to add the comment.id into the table rows? I need the ID from both tables for display, edit and delete further on in the table. The only display I get at this time for "comment.id" is the word id. The Any help would be appreciated.

    Read the article

  • What are the Options for Storing Hierarchical Data in a Relational Database?

    - by orangepips
    Good Overviews One more Nested Intervals vs. Adjacency List comparison: the best comparison of Adjacency List, Materialized Path, Nested Set and Nested Interval I've found. Models for hierarchical data: slides with good explanations of tradeoffs and example usage Representing hierarchies in MySQL: very good overview of Nested Set in particular Hierarchical data in RDBMSs: most comprehensive and well organized set of links I've seen, but not much in the way on explanation Options Ones I am aware of and general features: Adjacency List: Columns: ID, ParentID Easy to implement. Cheap node moves, inserts, and deletes. Expensive to find level (can store as a computed column), ancestry & descendants (Bridge Hierarchy combined with level column can solve), path (Lineage Column can solve). Use Common Table Expressions in those databases that support them to traverse. Nested Set (a.k.a Modified Preorder Tree Traversal) First described by Joe Celko - covered in depth in his book Trees and Hierarchies in SQL for Smarties Columns: Left, Right Cheap level, ancestry, descendants Compared to Adjacency List, moves, inserts, deletes more expensive. Requires a specific sort order (e.g. created). So sorting all descendants in a different order requires additional work. Nested Intervals Combination of Nested Sets and Materialized Path where left/right columns are floating point decimals instead of integers and encode the path information. Bridge Table (a.k.a. Closure Table: some good ideas about how to use triggers for maintaining this approach) Columns: ancestor, descendant Stands apart from table it describes. Can include some nodes in more than one hierarchy. Cheap ancestry and descendants (albeit not in what order) For complete knowledge of a hierarchy needs to be combined with another option. Flat Table A modification of the Adjacency List that adds a Level and Rank (e.g. ordering) column to each record. Expensive move and delete Cheap ancestry and descendants Good Use: threaded discussion - forums / blog comments Lineage Column (a.k.a. Materialized Path, Path Enumeration) Column: lineage (e.g. /parent/child/grandchild/etc...) Limit to how deep the hierarchy can be. Descendants cheap (e.g. LEFT(lineage, #) = '/enumerated/path') Ancestry tricky (database specific queries) Database Specific Notes MySQL Use session variables for Adjacency List Oracle Use CONNECT BY to traverse Adjacency Lists PostgreSQL ltree datatype for Materialized Path SQL Server General summary 2008 offers HierarchyId data type appears to help with Lineage Column approach and expand the depth that can be represented.

    Read the article

  • Website Images not indexed by Google, Yahoo and Bing

    - by Nabil Kadimi
    Hi, My classifieds website has been present online since 2006, the html pages are indexed and rank as expected whereas a search on Google Images for site:example.com returns nothing & in Yahoo or Bing it returns only a few image results, 8 to 10. Here is an example of a response HTTP headers as reported by Firebug: Date Sat, 15 Jan 2011 20:38:21 GMT Server Apache Cache-Control max-age=34560000 Expires Sun, 19 Feb 2012 20:38:21 GMT Accept-Ranges bytes Last-Modified Fri, 14 Jan 2011 21:59:16 GMT Vary Accept-Encoding Content-Encoding gzip Content-Length 21675 Connection close Content-Type image/jpeg What should I do to tell search engines to index my website images? Thanks in advance.

    Read the article

  • "Too much recursion" error when loading the same page with a hash

    - by Elliott
    Hi, I have a site w/ an image gallery ("Portfolio") page. There is drop-down navigation that allows a user to view a specific image in the portfolio from any page on the site. The links in the navigation use a hash, and that hash is read and converted into a string of an image filename. The image src attribute on the /portfolio/ page is then swapped out with the new image filename. This works fine if I'm clicking the dropdown link from a page OTHER THAN the /portfolio/ page itself. However if I take the same action from the /portfolio/ page, I get a "too much recursion" error in Firefox. Here's the code: Snippet of the nav markup: <li>Portfolio Category A <ul> <li><a href="/portfolio/#dining-room-table">Dining Room Table</a></li> <li><a href="/portfolio/#bathroom-mirror">Bathroom Mirror</a></li> </ul> </li> JS that reads the hash, converts it to an image filename, and swaps out the image on the page: $(document).ready(function() { if(location.pathname.indexOf("/portfolio/") > -1) { var hash = location.hash; var new_image = hash.replace("#", "")+".jpg"; swapImage(new_image); } }); function swapImage(new_image) { setTimeout(function() { $("img#current-image").attr("src", "/images/portfolio/work/"+new_image); }, 100); } I'm using the setTimeout function because I'm fading out the old image before making the swap, then fading it back in. I initially thought this was the function that was causing the recursion error, but when I remove the setTimeout I still have this problem. Does this have to do with a closure I'm not aware of? I'm pretty green on closures. JS that listens for the click on the nav: $("nav.main li.dropdown li ul li").click(function() { $(this).find("a").click(); $("nav.main").find("ul ul").hide(); $("nav.main li.hover").removeClass("hover"); }); I haven't implemented the fade in/out functionality for the dropdown nav yet, but I have implemented it for Next and Previous arrows, which can also be used to swap out images using the same swapImage function. Here's that code: $("#scroll-arrows a").click(function() { $("#current-image").animate({ opacity: 0 }, 100); var current_image = $("#current-image").attr("src").split("/").pop(); var new_image; var positions = getPositions(current_image); if($(this).is(".right")) { new_image = positions.next_img; } else { new_image = positions.prev_img; } swapImage(new_image); $("#current-image").animate({ opacity: 1 }, 100); return false; }); Here's the error I'm getting in Firefox: too much recursion var ret = handleObj.handler.apply( this, arguments ); jquery.js (line 1936) Thanks for any advice.

    Read the article

  • Jquery toggle input disabled attribute

    - by Tommy Arnold
    here is my code $("#product1 :checkbox").click(function(){ $(this) .closest('tr') // find the parent row .find(":input[type='text']") // find text elements in that row .attr('disabled',false).toggleClass('disabled') // enable them .end() // go back to the row .siblings() // get its siblings .find(":input[type='text']") // find text elements in those rows .attr('disabled',true).removeClass('disabled'); // disable them }); how do i toggle .attr('disabled',false); I cant seem to find it on google.

    Read the article

  • Using javascript to access a json array from php

    - by celenius
    I'm trying to understand how my php script can pass an array to my javascript code. Using the following php, I pass an array: $c = array(3,2,7); echo json_encode($c); My javascript is as follows: $.post("getLatLong.php", { latitude: 500000}, function(data){ arrayData = data document.write(arrayData) document.write(arrayData[0]); document.write(arrayData[0]); document.write(arrayData[0]); }); </script> What is printed out on screen is [3,2,7][3, I'm trying to understand how json_encode works - I though I would be able to pass the array to a variable, and then access it like a normal javascript array, but it views my array as one large text string. How do ensure that it reads it like an array?

    Read the article

  • Having difficulty catching postgresql exception in sequel/ruby

    - by mhd
    I have postgresql table that has somekind of unique constraint. I have ruby script that will update this table. The ruby script should be able to switch to UPDATE instead of INSERT when this kind of error occured: PGError: ERROR: duplicate key value violates unique constraint CMIIW, sequel seems cannot catch this exception?? Anyway,sample code below is something that I would like to see to work but apparently not: @myarray.each do |x| fresh_ds = DB["INSERT INTO mytable (id, col_foo) values ('#{x}' ,'#{myhash[x]}')"] result = fresh_ds.insert catch Sequel::Error do fresh_ds = DB["UPDATE mytable set col_foo = '#{myhash[x]} where id = #{x}"] result = fresh_ds.update end end Maybe my ruby code is wrong or I missed something I don't know. Any solution? Thanks. UPDATE: code below works, the error is caught when unique constraint is violated. @myarray.each do |x| begin # INSERT CODE rescue Sequel::Error # UPDATE CODE end end

    Read the article

  • PC powers up but there is no display

    - by Matthew
    I built a computer with standard components I bought from Newegg about three years ago. It ran great for 2 years and has sat powered down for the last year. I tried to power it up today and the display was blank. It powers up, lights come on, drives start spinning but there is nothing on the display. I verified that the monitor and video adapter work. I also tried the video adapter in a different slot on the mother board with no luck. What's the next thing I should try? Is the mother board shot? Thanks.

    Read the article

  • Cannot connect to internet with Clearwire modem.

    - by ide
    I'm currently using a Motorola WiMAX modem (CPEi 25725) and cannot connect to the internet. I can connect to the modem at 192.168.15.1 and check its status. It says that it has good/excellent connectivity to the internet and shows all five signal bars. Additionally it has sent and received some WiMAX packets so I believe it is connected to a tower. I'm at a loss for what the problem is. Unplugging the modem, restarting it from software, and restarting my computer (Windows 7) have not helped. Windows still reports that it is not connected to the internet. Alternatively, could this be an ISP issue? I have heard that Clearwire is a not-so-reputable ISP that blocks VoIP, and I was using Skype recently.

    Read the article

  • Suggestions for cleaning up the mess after removing the "system tool" virus?

    - by Ross
    Hi! Last night I got infected with the "System Tool" virus. For those who don't know it disallows the user from executing any software, changes the desktop, stops all security software from running, and continually requests that you buy a Trojan security software. It took me a few hours but I finally managed to remove the software. To do this I went into my Ubuntu partition and searched out files that had been created around the time that I got infected and deleted the executable. Then I went back into my W7 partition and ran an MBAM full scan, an MSE full scan, an AVG bootable USB scan, and ran a ClamAV scan from my Ubuntu partition (Together these found 3 more infected executables). I also ran a Ccleaner full sweep and the registry cleaner just in case. I think I have found all of the problems but am still concerned that there might be a payload leftover from the virus that I didn't find. Do you have any suggestions of what else I can do to be sure. Just FYI I use W7 64 bit and MSE as my primary antivirus. I was using chrome when I got infected and it seems that it was due to a slightly out of date Java installation (MSE gave me a warning that the website had used a Java exploit and then my desktop changed to the classic "System Tools" desktop) Thank you very much for your help.

    Read the article

  • Prioritize file sharing capabilities in Windows Server 2008

    - by cmbrnt
    I've got a server running Windows Server 2008, and use it mainly for sharing files throughout the domain from a number of disks. It's running on VMware ESXi 4.0, in case that matters. My problem is that when I log in to the server to check user permissions etc, the access speed the files on the remote disks almost grinds to a halt. I havn't been able to measure the speeds, but I would guess it slows down to about 100kB/s as soon as I log in. This is on a gigabit network and the problems are equal for all users, even the ones connected to the same switch as the server. I've assigned 2 GB RAM to the server, and reserved it 1,5Ghz processor power. I don't have to do anything special on the server for this halt to occur. How can I make sure file sharing is prioritized on the server, so no matter what applications I'm using it will always make sure file sharing works properly? Could this be a VMware issue?

    Read the article

  • book about psychology of decision and psychology of human

    - by boos
    I'm a unix developer and i want to make career in project/people management as first step. I think sometimes is better to have good communication skill and in general more human skill to make career more fast. Almost in Italy, a lot of people made career development more fast for his human skill and not for his technical skill. Anyone have read some book about psychology to better manage how people and personality work and to exploit decision making situation in the right way? I have found some interesting book about people personality and psychology of decision, but i am in doubt about the usefulness about reading such book. anyone have some experience in this path ? Anyone have found useful to read similar book about how people work, to manage career development in a more fast way and handle people and decision in a more useful way? i have already read peopleware. The table of content of one of this book have: 1 - Judicment and decision 2 - Euristics and sistematics error 3 - Estimating probability and frequency prediction 4 - Risk and decision 5 - rappresentation and decision 6 - Memory, attention and decision. Etc. what do you think about ?

    Read the article

  • Performance cost of running Ubuntu from external hard drive

    - by dandan78
    A friend just complained to me about Ubuntu being slow. Although I've noticed a certain lack of snappiness with Linux vs Windows in the past, I really can't say I've had much to grumble about with the recent distributions of Ubuntu. That said, his objections seem much worse than the ones I used to have and I know that his current setup is significantly more powerful than my laptop. And then it turned out he is running Ubuntu off an external HDD hooked up via USB2.0. The HD enclosure is USB3.0 but apparently he can't manage to get it to boot on USB3.0 so he switched to one of the USB2.0 ports or whatever and that works, albeit not very well. Now I would expect USB to add some overhead to communication between the computer and the HDD; SATA is after all designed to get the maximum out of a hard drive, whereas USB is, well, universal. What are your expreriences with booting off external HDDs? Edit: Does anybody know just how much of a slowdown can be expected?

    Read the article

  • Disable the Go button in the Keyboard for a UITextfield in iphone app.

    - by coder net
    Hi, My app has a screen where keyboard is always visible. The main element of the screen is a UITextfield. For easy data entering, keyboard is always made visible. When the user finishes entering data and hits Go, the app performs a 4,5 seconds action which is done in the background thread in order to show UIActivityIndicatorView. My problem is that the Go button on the keyboard still shows as enabled since the logic is performed in the background. The user could potentially hit the Go again causing it to run again. I am not able to set editable/userinteraction properties to No because then the keyboard disappears. Is there anyway just to disable the Go button or freeze the keyboard until the background thread returns?

    Read the article

  • How to include header files in Visual Studio 2008?

    - by Sergio
    I am currently trying to compile a simple program that includes two header files. I see them in the Solution Explorer, where I included them through "include existing files". However, when I run my program it get the following error. fatal error C1083: Cannot open include file: 'FileWrite.h': No such file or directory. THe problem is that I see the file included in the Header's folder and in the code I have written: #include "FileWrite.h" and then the rest of the program code. Is there something else needed to do so that the compiler can see the header file and link it to the .cpp file I'm trying to compile?

    Read the article

  • Assigning XY positions to points based on a "weight" between them

    - by sanity
    I have a bunch of points in a graph, and for every pair of these points I have "weight" value indicating what their proximity should be, between -1 and 1. I want to choose XY coordinates for these points such that those that have a proximity of 1 are in the same position, and those with a proximity of -1 are distant from each-other. All points must reside within a bounded area. What algorithms should I investigate to achieve this?

    Read the article

  • Access Filter VBA

    - by user569709
    Hi, I'm trying to use a filter in vba like this: Private Sub Form_Load() Me.Filter = "[Alvo] = " & AlvoAtual Me.FilterOn = True Me.Requery End Sub where AlvoAtual is global variable, but nothin happens. When I change the AlvoAtual for a specifc value nothin happens too. Like this: Private Sub Form_Load() Me.Filter = "[Alvo] = 'AAAA'" Me.FilterOn = True Me.Requery End Sub Someone knows the problem? Thank you.

    Read the article

  • In Winform I need ASP.NET like membership and roles stuff. But Roles doesn't work

    - by user512602
    Hi, following http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm I set up the membership & roles providers in app.config and try use it in code. Authentication works well, bur roles always returns empty roles array for connected user. This part works: If Membership.ValidateUser(userName, password) Then ' Set the current application principal information to a known user Dim identity As GenericIdentity Dim principal As RolePrincipal Dim user As MembershipUser user = Membership.GetUser(userName) identity = New GenericIdentity(user.UserName) principal = New RolePrincipal(identity) Threading.Thread.CurrentPrincipal = principal This one doesn't: If principal.IsInRole("Club") Then LoggedInUserRole = "Club" Return True Exit Function End If No error is thrown though. Similarly, if I try to add a user to a known, existing role, an exception is thrown : If Not Roles.IsUserInRole(userName, "club") Then Roles.AddUserToRole(userName, "club") End If Exception msg is: Cannot find role '' (I mean the role name isn't given back in exception.) Any clue? Please do not tell me to use Windows Client Administration within project services, I need my own SQL DB connection + the client app services is a bloated dfeature, bug prone.

    Read the article

  • Union of two or more (hash)maps

    - by javierfp
    I have two Maps that contain the same type of Objects: Map<String, TaskJSO> a = new HashMap<String, TaskJSO>(); Map<String, TaskJSO> b = new HashMap<String, TaskJSO>(); public class TaskJSO { String id; } The map keys are the "id" properties. a.put(taskJSO.getId(), taskJSO); I want to obtain a list with: all values in "Map b" + all values in "Map a" that are not in "Map b". What is the fastest way of doing this operation? Thanks EDIT: The comparaison is done by id. So, two TaskJSOs are considered as equal if they have the same id (equals method is overrided). My intention is to know which is the fastest way of doing this operation from a performance point of view. For instance, is there any difference if I do the "comparaison" in a map (as suggested by Peter): Map<String, TaskJSO> ab = new HashMap<String, TaskJSO>(a); ab.putAll(b); ab.values() or if instead I use a set (as suggested by Nishant): Set s = new Hashset(); s.addAll(a.values()); s.addAll(b.values());

    Read the article

  • C# - LINQ Including headache...

    - by ebb
    Case can have many Replies and one User, Replies can have one Case and one User, One User can have many Replies and many Cases. ObjectSet <= Case Object (IDbSet) ObjectSet.Include(x => x.User).Include(x => x.Replies).FirstOrDefault(x => x.Id == caseId); But the User Object for each Reply are not included? Only the User object for Case is Included? How would I include the User objects for the Replies too? Thanks in advance!

    Read the article

  • What's missing in ASP.NET MVC?

    - by LukaszW.pl
    Hello stackoverflow, I think there are not many people who don't think that ASP.NET MVC is one of the greatest technologies Microsoft gave us. It gives full control over the rendered HTML, provides separation of concerns and suits to stateless nature of web. Next versions of framework gaves us new features and tools and it's great, but... what solutions should Microsoft include in new versions of framework? What are biggest gaps in comparison with another web frameworks like PHP or Ruby? What could improve developers productivity? What's missing in ASP.NET MVC?

    Read the article

  • Access 2007 Locking Issue - Attachments being overwritten...

    - by user456356
    We're currently running into an issue with an Access 2007 database for a client. They've got Excel 2007 documents attached to records within the database. Whenever changes to the document are made, they are overwriting each other, and we're not sure exactly why. This is happening with different records, and all of the attached documents are named differently. We've tried adjusting the different locking schemes, but this doesn't seem to resolve the issue. Any ideas? Are we missing something?

    Read the article

  • Are `return` and `break` useless inside a Ruby block when used as a callback?

    - by Skilldrick
    In Rails, blocks can be used as callbacks, e.g.: class User < ActiveRecord::Base validates_presence_of :login, :email before_create {|user| user.name = user.login.capitalize if user.name.blank?} end When a block is used like this, is there any use for break and return? I'm asking because normally in a block, break will break out of the loop, and return will return from the enclosing method. But in a callback context, I can't get my head round what that means. The Ruby Programming Language suggests that return could cause a LocalJumpError but I haven't been able to reproduce this in a Rails callback. Edit: with the following code I'd expect a LocalJumpError, but all the return does is stop the rest of the callback executing. class User < ActiveRecord::Base validates_presence_of :login, :email before_create do |user| return user.name = user.login.capitalize end

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28  | Next Page >