Daily Archives

Articles indexed Saturday April 24 2010

Page 12/78 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • ROR heroku PostGres issue

    - by oelbrenner
    getting error: ActiveRecord::StatementInvalid (PGError: ERROR: argument of HAVING must be type boolean, not type timestamp without time zone controller code snippet: def inactive @number_days = params[:days].to_i || 90 @clients = Client.find(:all, :include = :appointments, :conditions = ["clients.user_id = ? AND appointments.start_time <= ?", current_user.id, @number_days.days.ago], :group = 'client_id', :having = 'MAX(appointments.start_time)' ) end

    Read the article

  • Problem inserting android.text.format.Time.toMillis value into SQLite DB on droid

    - by schusselig
    I'm writing an app for Android OS, and I need to store some time values in the SQLite DB. I have been using android.text.format.Time to store the time values in the app, and then inserting the values as millis into the DB as REAL values. On the SDK emulator, everything works perfectly. On the sole phone I've had the opportunity to test my app (so far), my duration code doesn't work as expected. Some relevant code: private static final String DATABASE_CREATE = "create table " + DATABASE_TABLE + " (" + KEY_ROWID + " integer primary key autoincrement, " + KEY_START + " REAL, " + KEY_STOP + " REAL, " + KEY_DUR + " REAL );"; ... private SQLiteDatabase mDb; ContentValues timerValues = new ContentValues(); ... timerValues.put(KEY_START, stime.toMillis(false)); timerValues.put(KEY_STOP, etime.toMillis(false)); timerValues.put(KEY_DURATION, stime.toMillis(false)-etime.toMillis(false)); int result = mDb.insert(DATABASE_TABLE, null, timerValues); I pull this data from two separate functions with slightly different bits of code, both using Time.set(long millis), both giving incorrect results: The start and stop values come back correct, but the duration comes out 17 hours too large. Am I missing something about calculating durations or does this just seem like there's something "special" about this particular droid? I'll have another droid to test on Monday, but any ideas are appreciated.

    Read the article

  • iphone - making the CGAffineTransform permanent

    - by Mike
    I am banging my head on the wall here due to this problem: When I create a UIImageView this view has a certain orientation and size. Lets call this state "A". This view responds to taps. It can be dragged around the screen. At some point in the code I apply a CGAffineTransform to the view. Does not matter if the affine is a scale, a rotation, a translation or a combination of all. Does not matter also if the transform is absolute or relative. Not to mention the device can change its orientation and the view is autorotated to the correct orientation (that we can cay is a kind of rotation or transformation applied to the view). The problem is: the moment I touch that object or try to animate its transparency or any other parameter, it "remembers" the state "A" and does all animations from that state, not from current state. If I simply touch the view, it returns instantly to state "A". The code is not doing it by itself. It is an annoying "gift" from Apple. How to I make a view assume its current state of transformations as the reset or initial state? In other words, how do I make a view forget its past transformations or states? The only way I know is recreating the view, but this is a ridiculous way of doing this. Is there any way to make this work as I described? thanks

    Read the article

  • CSS menu bar wont show!!! class or ID problem?

    - by Tran
    Hello everyone, Please help me with this insanity: http://imageoneads.com/zenliver/ My menu bar worked fine & I accidently deleted or moved one of class or ID. Now it disappeared. All browsers Wont display the menu, except Firefox for Mac. This drives me nut....Cant believe I have to start over if I can't figure it out....Please help....Thanks ahead tran006

    Read the article

  • Google Maps v3 InfoWindow Too Wide

    - by ryan
    In Google Maps v3, I can't seem to get my infoWindow to a width smaller than 200px. Here is the code I'm using: var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 15, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var myMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var gmarker = new google.maps.Marker({position: latLng,title:'Example'} ); var infoWindow = new google.maps.InfoWindow(); infoWindow.setOptions({maxWidth: 110}); window_content = '<div style="width:110px;height:110px;">Test</div>'; infoWindow.setContent(window_content); infoWindow.open(myMap, gmarker); Is there a way to get the infoWindow more narrow? Or am I stuck with a minimum width?

    Read the article

  • Simple Adapter error

    - by Rahul Varma
    Hi, I have the following errors when i try to access the simple adapter from my program... Plz can anyone help me solving the error... Desperate to get it done.... android.widget.SimpleAdapter.getCount(SimpleAdapter.java:95) android.widget.ListView.setAdapter(ListView.java:431) com.stellent.gorinka.MusicListActivity.list(MusicListActivity.java:76) com.stellent.gorinka.MusicListActivity$1.run(MusicListActivity.java:67) android.os.Handler.handleCallback(Handler.java:587) android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:123) android.os.Handler.handleCallback(Handler.java:587) android.os.Handler.dispatchMessage(Handler.java:92) android.os.Looper.loop(Looper.java:123) Here' the code for Adapter... public class SongsAdapter extends SimpleAdapter{ static List<HashMap<String,String>> songsList; Context context; LayoutInflater inflater; public SongsAdapter(Context context,List<HashMap<String,String>> imgListWeb,int layout,String[] from,int[] to,LayoutInflater inflater) { super(context,songsList,layout,from,to); this.songsList=songsList; this.context=context; this.inflater=inflater; // TODO Auto-generated constructor stub }@Override public View getView(int postition,View convertView,ViewGroup parent)throws java.lang.OutOfMemoryError{ try { View v = ((LayoutInflater) inflater).inflate(R.layout.row,null); ImageView images=(ImageView)v.findViewById(R.id.image); TextView tvTitle=(TextView)v.findViewById(R.id.text1); TextView tvAlbum=(TextView)v.findViewById(R.id.text2); TextView tvArtist=(TextView)v.findViewById(R.id.text3); HashMap<String,String> songsHash=songsList.get(postition); String path=songsHash.get("path"); String title=songsHash.get("title"); String album=songsHash.get("album"); String artist=songsHash.get("artist"); String imgPath=path; final ImageView imageView = (ImageView) v.findViewById(R.id.image); AsyncImageLoaderv asyncImageLoader=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoader.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { imageView.setImageBitmap(imageDrawable); } }); imageView.setImageBitmap(cachedImage); tvTitle.setText(title); tvAlbum.setText(album); tvArtist.setText(artist); return v; } catch(Exception e){ Log.e("error",e.toString()); } return null; } And also in my main program the focus is not entering the loop... The implementation in the loop isnt getting executed...Here's the code for it... public void list() { Log.d("#####","#####"); LayoutInflater inflater=getLayoutInflater(); String[] from={}; int[] n={}; adapter=new SongsAdapter(getApplicationContext(),songNodeDet,R.layout.row,from,n,inflater); lv.setAdapter(adapter);} private Handler handler = new Handler() { public void handleMessage(Message msg){ Log.d("*****","handler"); removeDialog(0); p.dismiss(); } }; public void webObjectList(Object[] imgListObj,String logInSess) throws XMLRPCException{ songNodeWeb = new HashMap<?,?>[imgListObj.length]; if(imgListObj!=null){ Log.e("completed","completed"); for(int i=0;i<imgListObj.length;i++){ //imgListObj.length songNodeWeb[i]=(HashMap<?,?>)imgListObj[i]; String nodeid=(String) songNodeWeb[i].get("nid"); Log.e("img",i+"completed"); HashMap<String,String> nData=new HashMap<String,String>(); nData.put("nid",nodeid); Object nodeget=client.call("node.get",logInSess,nodeid); HashMap<?,?> imgNode=(HashMap<?,?>)nodeget; String titleName=(String) imgNode.get("titles"); String movieName=(String) imgNode.get("album"); String singerName=(String) imgNode.get("artist"); nData.put("titles", titleName); nData.put("album", movieName); nData.put("artist", singerName); Object[] imgObject=(Object[])imgNode.get("title_format"); HashMap<?,?>[] imgDetails=new HashMap<?,?>[imgObject.length]; imgDetails[0]=(HashMap<?, ?>)imgObject[0]; String path=(String) imgDetails[0].get("filepath"); if(path.contains(" ")){ path=path.replace(" ", "%20"); } String imgPath="http://www.gorinka.com/"+path; paths.add(imgPath); nData.put("path", imgPath); Log.e("my path",path); String mime=(String)imgDetails[0].get("filemime"); nData.put("mime", mime); SongsList songs=new SongsList(titleName,movieName,singerName,imgPath,imgPath); SngList.add(i,songs); songNodeDet.add(i,nData); } Log.e("paths values",paths.toString()); // return imgNodeDet; handler.sendEmptyMessage(0); } } public void getSongs() throws MalformedURLException, XMLRPCException { String ur="http://www.gorinka.com/?q=services/xmlrpc"; URL u=new URL(ur); client = new XMLRPCClient(u); //Connecting to the website HashMap<?, ?> siteConn =(HashMap<?, ?>) client.call("system.connect"); // Getting initial sessio id String initSess=(String)siteConn.get("sessid"); //Login to the site using session id HashMap<?, ?> logInConn =(HashMap<?, ?>) client.call("user.login",initSess,"prakash","stellentsoft2009"); //Getting Login sessid logInSess=(String)logInConn.get("sessid"); websongListObject =(Object[]) client.call("nodetype.get",logInSess,""); webObjectList(websongListObject,logInSess); Log.d("webObjectList","webObjectList"); runOnUiThread(returnRes); } }

    Read the article

  • VMware Converter errors when creating Boot Camp VM

    - by Ryan Giglio
    I just got a new computer. My old computer had a Boot Camp installation of Windows 7, with VMWare running the Boot Camp installation in a virtual machine. On my new computer, I want Windows to strictly be a VM, so I downloaded the VMWare Converter software to create a virtual machine out of the Boot Camp partition. After finishing 95% of the converting process, I get a few messages Warning: Failed while updating boot.ini on the target machine's system volume. Warning: Failed while updating drive letters for the target volume layout. Error: Reconfiguration failed. And then it fails with FAILED: Unable to find the system volume, reconfiguration is not possible. I'm not sure what the problem is or how to fix it...I don't know much about virtualization or dual booting other than the simple instructions on how to set it up the first time.

    Read the article

  • Building a rails form to filter an index page?

    - by Schroedinger
    G'day guys, I'm having an issue with filtering the presentation of several thousand trade items I have in my system. As per the specs of the system we're building we have to have a form that allows people to put in a start date and then an interval in minutes, to filter the presentation of the items. I've built my helper functions to return all of the trades within that interval period, but I can't for the life of me properly build the form that will return a dateTime value and an integer value within the top of the index page? Any ideas? Would I have to build a separate model object to assign values to, or is there a simpler way?

    Read the article

  • Curve fitting: Find the smoothest function that satisfies a list of constraints.

    - by dreeves
    Consider the set of non-decreasing surjective (onto) functions from (-inf,inf) to [0,1]. (Typical CDFs satisfy this property.) In other words, for any real number x, 0 <= f(x) <= 1. The logistic function is perhaps the most well-known example. We are now given some constraints in the form of a list of x-values and for each x-value, a pair of y-values that the function must lie between. We can represent that as a list of {x,ymin,ymax} triples such as constraints = {{0, 0, 0}, {1, 0.00311936, 0.00416369}, {2, 0.0847077, 0.109064}, {3, 0.272142, 0.354692}, {4, 0.53198, 0.646113}, {5, 0.623413, 0.743102}, {6, 0.744714, 0.905966}} Graphically that looks like this: We now seek a curve that respects those constraints. For example: Let's first try a simple interpolation through the midpoints of the constraints: mids = ({#1, Mean[{#2,#3}]}&) @@@ constraints f = Interpolation[mids, InterpolationOrder->0] Plotted, f looks like this: That function is not surjective. Also, we'd like it to be smoother. We can increase the interpolation order but now it violates the constraint that its range is [0,1]: The goal, then, is to find the smoothest function that satisfies the constraints: Non-decreasing. Tends to 0 as x approaches negative infinity and tends to 1 as x approaches infinity. Passes through a given list of y-error-bars. The first example I plotted above seems to be a good candidate but I did that with Mathematica's FindFit function assuming a lognormal CDF. That works well in this specific example but in general there need not be a lognormal CDF that satisfies the constraints.

    Read the article

  • 'Attempt to call private method' error when trying to change change case of db entires in migration

    - by Senthil
    class AddTitleToPosts < ActiveRecord::Migration def self.up add_column :posts, :title, :string Post.find(:all).each do |post| post.update(:title => post.name.upcase) end end def self.down end end Like you can nothing particularly complicated, just trying to add new column title by changing case of name column already in db. But I get attempt to call private method error. I'm guessing it has something to do with 'self'? Thanks for your help.

    Read the article

  • How to use Web-View as page by page while scrolling or Flinging/swiping?

    - by Jetti
    Hi, I want to convert an .docx/.doc file to html and displaying in emulator with help of Web- view. But i am displaying entire data into webview as Single page(we need to scroll many times). So, i want to match the content of .docx file with webview as pages or put some buttons or gestures to get next page.But i unable to display text as pages in Web-View. is there any solution or suggestion to get as pages? How to get the height and width of webview? Thanks

    Read the article

  • Fowler Analysis Patterns lately?

    - by Berryl
    As much as I've always loved this one is how much I always wished there were more meaty examples of how to apply some of the concepts available. Is anyone aware of anything out there worth looking at that attempts to that? Cheers, Berryl

    Read the article

  • Android RTSP coding problem

    - by NetApex
    I have Googled my butt off trying to find where if there is a surefire way to make rtsp work. I have a radio station that I listen to that streams via rtsp. Of course by default Android doesn't want to play it. If I pop the URL into yourmuze.fm and create a station there it lets me stream it to my phone. After checking how it works I come to find that it streams to the phone via rtsp! So obviously there is something amiss. What makes one stream work and one not? This is the stream I am attempting : rtsp://wms2.christiannetcast.com/yes-fm It is an audio stream so I would be thrilled with most peoples problem of "it only does audio and not video." When yourmuze.fm streams, DDMS states it brings up MovieView to play the audio if that helps at all.

    Read the article

  • How do I add a method with a decorator to a class in python?

    - by Timmy
    How do I add a method with a decorator to a class? I tried def add_decorator( cls ): @dec def update(self): pass cls.update = update usage add_decorator( MyClass ) MyClass.update() but MyClass.update does not have the decorator @dec did not apply to update I'm trying to use this with orm.reconstructor in sqlalchemy.

    Read the article

  • Problem with HSQLDB & SequenceGenerator

    - by Srirangan
    Hi, I have an entity which has an ID field: @Id @Column(name = "`U##ID_VOIE`") @GeneratedValue(generator = "VOIE_SEQ") private String id; The class has the sequence generator defined as well: @SequenceGenerator(name = "VOIE_SEQ", sequenceName = "VOIE_SEQ") and the Oracle schema has the requisite sequence present. Everything works okay. We also have tests, which uses an in-memory HSQLDB. Before running the tests, all the tables are created based on the Hibernate entity classes. However the table for this particular class is not being created. And error pops up, because ID is a String and the SequenceGenerator in HSQLDB returns an INT / LONG / Numeric value. The application is using a legacy Oracle database and ID_VOIE column must remain a String / Varchar. Any solutions?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >