Search Results

Search found 491 results on 20 pages for 'aa'.

Page 16/20 | < Previous Page | 12 13 14 15 16 17 18 19 20  | Next Page >

  • jquery disable/remove option on select?

    - by SoulieBaby
    Hi all, I have two select lists, I would like jquery to either remove or disable a select option, depending on what is selected from the first select list: <select name="booking" id="booking"> <option value="3">Group Bookings</option> <option value="2" selected="selected">Port Phillip Bay Snapper Charters</option> <option value="6">Portland Tuna Fishing</option> <option value="1">Sport Fishing</option> </select> Here's the second list (which will only ever have two values): <select name="charterType" id="charterType"> <option value="1">Individual Booking</option> <option value="2">Group Booking</option> </select> If Group Bookings or Port Phillip Bay Snapper Charters are selected, I need only "Group Booking" to be displayed. (To basically hide "Individual Booking") but I can't seem to get it to work.. If someone could help me that'd be great!! :) I've also tried using a switch, but that doesnt work either.. /* select list */ switch (jQuery('#booking :selected').text()) { case 'Sport Fishing': alert('AA'); break; case 'Port Phillip Bay Snapper Charters': jQuery("#charterType option[value=1]").remove(); alert('BB'); break; case 'Portland Tuna Fishing': alert('CC'); break; case 'Group Bookings': alert('DD'); break; }; It alerts, but doesn't do anything else..

    Read the article

  • MATLAB Easter Egg Spy vs Spy

    - by Aqui1aZ3r0
    I heard that MATLAB 2009b or earlier had a fun function. When you typed spy in the console, you would get something like this: http://t2.gstatic.com/images?q=tbn:ANd9GcSHAgKz-y1HyPHcfKvBpYmZ02PWpe3ONMDat8psEr89K0VsP_ft However, now you have an image like this:http://undocumentedmatlab.com/images/spy2.png I'd like it if I could get the code of the original spy vs spy image FYI, there's a code, but has certain errors in it: c = [';@3EA4:aei7]ced.CFHE;4\T*Y,dL0,HOQQMJLJE9PX[[Q.ZF.\JTCA1dd' '-IorRPNMPIE-Y\R8[I8]SUDW2e+' '=4BGC;7imiag2IFOQLID8''XI.]K0"PD@l32UZhP//P988_WC,U+Z^Y\<2' '&lt;82BF>?8jnjbhLJGPRMJE9/YJ/L1#QMC$;;V[iv09QE99,XD.YB,[_]=3a' '9;CG?@9kokc2MKHQSOKF:0ZL0aM2$RNG%AAW\jw9E.FEE-_G8aG.d]_W5+' '?:CDH@A:lpld3NLIRTPLG=1[M1bN3%SOH4BBX]kx:J9LLL8H9bJ/+d_dX6,' '@;DEIAB;mqmePOMJSUQMJ2\N2cO4&TPP@HCY^lyDKEMMN9+I@+S8,+deY7^' '8@EFJBC<4rnfQPNPTVRNKB3]O3dP5''UQQCIDZ_mzEPFNNOE,RA,T9/,++\8_' '9A2G3CD=544gRQPQUWUOLE4^P4"Q6(VRRIJE[n{KQKOOPK-SE.W:F/,,]Z+' ':BDH4DE>655hSRQRVXVPMF5_Q5#R>)eSSJKF\ao0L.L-WUL.VF8XCH001_[,' ';3EI<eo ?766iTSRSWYWQNG6$R6''S?*fTTlLQ]bp1M/P.XVP8[H9]DIDA=]' '?4D3=FP@877jUTSTXZXROK7%S7(TF+gUUmMR^cq:N9Q8YZQ9_IcIJEBd_^' '@5E@GQA98b3VUTUY*YSPL8&T)UI,hVhnNS_dr;PE.9Z[RCaR?+JTFC?e+' '79FA?HRB:9c4WVUVZ+ZWQM=,WG*VJ-"gi4OTes-XH+bK.#hj@PUvftDRMEF,]UH,UB.TYVWX,e\' '9;ECAKTY< ;eWYXWX\:)YSOE.YI,cL/$ikCqV1guE/PFL-^XI-YG/WZWXY1+]' ':AFDBLUZ=jgY[ZYZ-<7[XQG0[K.eN1&"$K2u:iyO9.PN9-_K8aJ9_]]82[' '?CEFDNW\?khZ[Z[==8\YRH1\M/!O2''#%m31Bw0PE/QXE8+R9bS;da^]93\' '@2FGEOX]ali[][9(ZSL2]N0"P3($&n;2Cx1QN9--L9,SA+T< +d_:4,' 'A3GHFPY^bmj\^]\]??:)[TM3^O1%Q4)%''oA:D0:0OE.8ME-TE,XB,+da;5[' '643IGQZ_cnk]_^]^@@;5\UN4_P2&R6*&(3B;E1<1PN99NL8WF.^C/,a+bY6,' '7:F3HR[dol^_^AA<6]VO5Q3''S>+'');CBF:=:QOEEOO9_G8aH6/d,cZ[Y' '8;G4IS\aep4_a-BD=7''XP6aR4(T?,(5@DCHCC;RPFLPPDH9bJ70+0d\\Z' '9BH>JT^bf45ba.CE@8(YQ7#S5)UD-)?AEDIDDD/QKMVQJ+S?cSDF,1e]a,' ':C3?K4_cg5[acbaADFA92ZR8$T6*VE.*@JFEJEEE0.NNWTK,U@+TEG0?+_bX' ';2D@L9dh6\bdcbBEGD:3[S=)U7+cK/+CKGFLIKI9/OWZUL-VA,WIHB@,`cY']; i = double(c(:)-32); j = cumsum(diff([0; i])< =0) + 1; S = sparse(i,j,1)'; spy(S)

    Read the article

  • how to download a file from remote server usingh asp.net

    - by ush
    The below code works fine for downloading a file from a current pc.plz suggest me how to download it from remote server using ip address or any method protected void Button1_Click(object sender, EventArgs e) { const string fName = @"C:\ITFSPDFbills\February\AA.pdf"; FileInfo fi = new FileInfo(fName); long sz = fi.Length; Response.ClearContent(); Response.ContentType = MimeType(Path.GetExtension(fName)); Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(fName))); Response.AddHeader("Content-Length", sz.ToString("F0")); Response.TransmitFile(fName); Response.End(); } public static string MimeType(string Extension) { string mime = "application/octetstream"; if (string.IsNullOrEmpty(Extension)) return mime; string ext = Extension.ToLower(); Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext); if (rk != null && rk.GetValue("Content Type") != null) mime = rk.GetValue("Content Type").ToString(); return mime; }

    Read the article

  • [PHP] Associate different data

    - by Alex Cane
    I will try to be as clear as possible because I can't get anybody to help me around, I am trying to associate some data from a 'videos' table with their respective ID. Lets say, I have column ID, title, serie, season, episode. I am getting my data : <? $result = mysql_query("SELECT * FROM videos WHERE serie = '".$row['serie']."' AND season = '".$row['season']."'"); $total_rows = mysql_num_rows($result); ?> (that is in the page where you see the video itself) So now I can get the number of episodes from a serie and season. What I'm trying to do is have a link for the next episode, and aa link for the previous one. In the URL I am working with the id, so http://website.com/view/id/'video id here'/ So how can I get the ID of the following and previous episodes of the same season AND serie? Help will be much appreciated! The easiest thing I thought of is <?=$row['id'] + 1?> <?=$row['id'] - 1?> But the thing is that it's mixed videos, so it wont work 100%

    Read the article

  • NSMutableDictionary with UIButton* as keys - iPhone development

    - by Alejandro A.
    Hi, I'm new to iPhone development and I have a question that may have a very simple answer. I am trying to add buttons to a view and these buttons are associated with a custom class that I defined. When I add the buttons to the view, I would like to know what class these buttons correspond to. This is because when I press the button, I need to get some information about the class, but the receiver of the message is another class. I couldn't find information about an error that I'm getting on the web. The problem I have is that I'm trying to create an NSMutableDictionary where the keys are of type UIButton* and the values are of my custom type: // create button for unit UIButton* unitButton = [[UIButton alloc] init]; [sourceButtonMap setObject:composite forKey:unitButton]; Of course, the sourceButtonMap is defined in the class and initialized in the init function as sourceButtonMap = [[NSMutableDictionary alloc] init]; The error I get when I try to add the key-value pair is: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIButton copyWithZone:]: unrecognized selector sent to instance 0x3931e90' Is this happening because I can't store UIButton* as keys? Can anyone point me why I'm getting this error? Thank you all, aa

    Read the article

  • Displaying music list using custom lists instead of array adapters

    - by Rahul Varma
    Hi, I have displayed the music list in a list view. The list is obtained from a website. I have done this using Arraylist. Now, i want to iterate the same program using custom lists and custom adapters instead of array list. The code i have written using array lists is... public class MusicListActivity extends Activity { MediaPlayer mp; File mediaFile; TextView tv; TextView albumtext; TextView artisttext; ArrayList<String> al=new ArrayList<String>(); //ArrayList<String> al=new ArrayList<String>(); ArrayList<String> node=new ArrayList<String>(); ArrayList<String> filepath=new ArrayList<String>(); ArrayList<String> imgal=new ArrayList<String>(); ArrayList<String> album=new ArrayList<String>(); ArrayList<String> artist=new ArrayList<String>(); ListView lv; Object[] webImgListObject; String[] stringArray; XMLRPCClient client; String loginsess; HashMap<?, ?> siteConn = null; //ImageView im; Bitmap img; String s; int d; int j; StreamingMediaPlayer sm; int start=0; Intent i; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.openadiuofile); lv=(ListView)findViewById(R.id.list1); al=getIntent().getStringArrayListExtra("titles"); //node=getIntent().getStringArrayListExtra("nodeid"); filepath=getIntent().getStringArrayListExtra("apath"); imgal=getIntent().getStringArrayListExtra("imgpath"); album=getIntent().getStringArrayListExtra("album"); artist=getIntent().getStringArrayListExtra("artist"); // ArrayAdapter<String> aa=new ArrayAdapter<String>(this,R.layout.row,R.id.text2,al); //lv.setAdapter(aa); try{ lv.setAdapter( new styleadapter(this,R.layout.row, R.id.text2,al)); }catch(Throwable e) { Log.e("openaudio error",""+e.toString()); goBlooey(e); } lv.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3){ j=1; try{ d=arg2; String filep=filepath.get(d); String tit=al.get(d); String image=imgal.get(d); String singer=artist.get(d); String movie=album.get(d); sendpath(filep,tit,image,singer,movie); // getpath(n); }catch(Throwable t) { goBlooey(t); } } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); if(j==0) {i=new Intent(this,gorinkadashboard.class); startActivity(i);} } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); j=0; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_SEARCH) { Log.i("go","go"); return true; } return(super.onKeyDown(keyCode, event)); } public void sendpath(String n,String nn,String image,String singer,String movie) { Intent ii=new Intent(this,MusicPlayerActivity.class); ii.putExtra("path",n); ii.putExtra("titletxt",nn); //ii.putStringArrayListExtra("playpath",filepath); ii.putExtra("pos",d); ii.putExtra("image",image); ii.putStringArrayListExtra("imagepath",imgal); ii.putStringArrayListExtra("filepath", filepath); ii.putStringArrayListExtra("imgal", imgal); ii.putExtra("movie" ,movie ); ii.putExtra("singer",singer); ii.putStringArrayListExtra("album", album); ii.putStringArrayListExtra("artist",artist); ii.putStringArrayListExtra("tittlearray",al); startActivity(ii); } class styleadapter extends ArrayAdapter<String> { Context context=null; public styleadapter(Context context, int resource, int textViewResourceId, List<String> objects) { super(context, resource, textViewResourceId, objects); this.context=context; } @Override public View getView(int position, View convertView, ViewGroup parent) { final int i=position; LayoutInflater inflater = ((Activity) context).getLayoutInflater(); View v = inflater.inflate(R.layout.row, null); tv=(TextView)v.findViewById(R.id.text2); albumtext=(TextView)v.findViewById(R.id.text3); artisttext=(TextView)v.findViewById(R.id.text1); tv.setText(al.get(i)); albumtext.setText(album.get(i)); artisttext.setText(artist.get(i)); final ImageView im=(ImageView)v.findViewById(R.id.image); s="http://www.gorinka.com/"+imgal.get(i); // displyimg(s,v); // new imageloader(s,im); String imgPath=s; AsyncImageLoaderv asyncImageLoaderv=new AsyncImageLoaderv(); Bitmap cachedImage = asyncImageLoaderv.loadDrawable(imgPath, new AsyncImageLoaderv.ImageCallback() { public void imageLoaded(Bitmap imageDrawable, String imageUrl) { im.setImageBitmap(imageDrawable); } }); im.setImageBitmap(cachedImage); return v; } } public class imageloader implements Runnable{ private String ss; //private View v; //private View v2; private ImageView im; public imageloader(String s, ImageView im) { this.ss=s; //this.v2=v2; this.im=im; Thread thread = new Thread(this); thread.start(); } public void run(){ try { // URL url = new URL(ss); // URLConnection conn = url.openConnection(); // conn.connect(); HttpGet httpRequest = null; httpRequest = new HttpGet(ss); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); HttpEntity entity = response.getEntity(); BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); InputStream is = bufHttpEntity.getContent(); // BufferedInputStream bis = new BufferedInputStream(is); Bitmap bm = BitmapFactory.decodeStream(is); Log.d("img","img"); // bis.close(); is.close(); im.setImageBitmap(bm); // im.forceLayout(); // v2.postInvalidate(); // v2.requestLayout(); } catch (Exception t) { Log.e("bitmap url", "Exception in updateStatus()", t); //goBlooey(t); // throw new RuntimeException(t); } } } private void goBlooey(Throwable t) { AlertDialog.Builder builder=new AlertDialog.Builder(this); builder .setTitle("Exception!") .setMessage(t.toString()) .setPositiveButton("OK", null) .show(); } } I have created the SongList.java, SongsAdapter.java and also SongsAdapterView.java. Their code is... public class SongsList { private String titleName; private String movieName; private String singerName; private String imagePath; private String mediaPath; // Constructor for the SongsList class public SongsList(String titleName, String movieName, String singerName,String imagePath,String mediaPath ) { super(); this.titleName = titleName; this.movieName = movieName; this.singerName = singerName; this.imagePath = imagePath; this.mediaPath = mediaPath; } public String gettitleName() { return titleName; } public void settitleName(String titleName) { this.titleName = titleName; } public String getmovieName() { return movieName; } public void setmovieName(String movieName) { this.movieName = movieName; } public String getsingerName() { return singerName; } public void setsingerName(String singerName) { this.singerName = singerName; } public String getimagePath() { return imagePath; } public void setimagePath(String imagePath) { this.imagePath = imagePath; } public String getmediaPath() { return mediaPath; } public void setmediaPath(String mediaPath) { this.mediaPath = mediaPath; } } public class SongsAdapter extends BaseAdapter{ private Context context; private List<SongsList> listSongs; public SongsAdapter(Context context, List<SongsList> listPhonebook){ this.context = context; this.listSongs = listSongs; } public int getCount() { return listSongs.size(); } public Object getItem(int position) { return listSongs.get(position); } public long getItemId(int position) { return position; } public View getView(int position, View view, ViewGroup viewGroup) { SongsList entry = listSongs.get(position); return new SongsAdapterView(context,entry); } } public SongsAdapterView(Context context, SongsList entry) { super(context); this.setOrientation(VERTICAL); this.setTag(entry); // TODO Auto-generated constructor stub View v = inflate(context, R.layout.row, null); TextView tvTitle = (TextView)v.findViewById(R.id.text2); tvTitle.setText(entry.gettitleName()); TextView tvMovie = (TextView)v.findViewById(R.id.text3); tvTitle.setText(entry.getmovieName()); TextView tvSinger = (TextView)v.findViewById(R.id.text1); tvTitle.setText(entry.getsingerName()); addView(v); } } Can anyone please tell me how to display the list using custom lists and custom adapters using the code above???

    Read the article

  • How to use symbols/punctuation characters in discriminated unions

    - by user343550
    I'm trying to create a discriminated union for part of speech tags and other labels returned by a natural language parser. It's common to use either strings or enums for these in C#/Java, but discriminated unions seem more appropriate in F# because these are distinct, read-only values. In the language reference, I found that this symbol ``...`` can be used to delimit keywords/reserved words. This works for type ArgumentType = | A0 // subject | A1 // indirect object | A2 // direct object | A3 // | A4 // | A5 // | AA // | ``AM-ADV`` However, the tags contain symbols like $, e.g. type PosTag = | CC // Coordinating conjunction | CD // Cardinal Number | DT // Determiner | EX // Existential there | FW // Foreign Word | IN // Preposision or subordinating conjunction | JJ // Adjective | JJR // Adjective, comparative | JJS // Adjective, superlative | LS // List Item Marker | MD // Modal | NN // Noun, singular or mass | NNP // Proper Noun, singular | NNPS // Proper Noun, plural | NNS // Noun, plural | PDT // Predeterminer | POS // Possessive Ending | PRP // Personal Pronoun | PRP$ //$ Possessive Pronoun | RB // Adverb | RBR // Adverb, comparative | RBS // Adverb, superlative | RP // Particle | SYM // Symbol | TO // to | UH // Interjection | VB // Verb, base form | VBD // Verb, past tense | VBG // Verb, gerund or persent participle | VBN // Verb, past participle | VBP // Verb, non-3rd person singular present | VBZ // Verb, 3rd person singular present | WDT // Wh-determiner | WP // Wh-pronoun | WP$ //$ Possessive wh-pronoun | WRB // Wh-adverb | ``#`` | ``$`` | ``''`` | ``(`` | ``)`` | ``,`` | ``.`` | ``:`` | `` //not sure how to escape/delimit this ``...`` isn't working for WP$ or symbols like ( Also, I have the interesting problem that the parser returns `` as a meaningful symbol, so I need to escape it as well. Is there some other way to do this, or is this just not possible with a discriminated union? Right now I'm getting errors like Invalid namespace, module, type or union case name Discriminated union cases and exception labels must be uppercase identifiers I suppose I could somehow override toString for these goofy cases and replace the symbols with some alphanumeric equivalent?

    Read the article

  • Binary Search Tree for specific intent

    - by Luís Guilherme
    We all know there are plenty of self-balancing binary search trees (BST), being the most famous the Red-Black and the AVL. It might be useful to take a look at AA-trees and scapegoat trees too. I want to do deletions insertions and searches, like any other BST. However, it will be common to delete all values in a given range, or deleting whole subtrees. So: I want to insert, search, remove values in O(log n) (balanced tree). I would like to delete a subtree, keeping the whole tree balanced, in O(log n) (worst-case or amortized) It might be useful to delete several values in a row, before balancing the tree I will most often insert 2 values at once, however this is not a rule (just a tip in case there is a tree data structure that takes this into account) Is there a variant of AVL or RB that helps me on this? Scapegoat-trees look more like this, but would also need some changes, anyone who has got experience on them can share some thougts? More precisely, which balancing procedure and/or removal procedure would help me keep this actions time-efficient?

    Read the article

  • Why am i getting same values of different JSON date values?

    - by Maxood
    I do not know the reason why am i getting same values of different JSON date values. Here is my code for parsing date values in JSON date format: package com.jsondate.parsing; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class JSONDateParsing extends Activity { /** Called when the activity is first created. */ String myString; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = new TextView(this); //Date d = (new Date(1266029455L)); //Date d = (new Date(1266312467L)); Date d = (new Date(1266036226L)); //String s = d.getDate() + "-" + d.getMonth() + "-" + d.getYear() + d.getHours() + d.getMinutes() + d.getSeconds(); // SimpleDateFormat sdf=new SimpleDateFormat("yyyy MMM dd @ hh:mm aa"); //Toast.makeText(this, d.toString(), Toast.LENGTH_SHORT); Log.e("Value:", d.toString()); myString = d.toString(); String []words = myString.split(" "); for(int i = 0;i < words.length; i++) Log.e("Value:", words[i]); myString = words[2] + "-" + words[1] + "-" + words[5] + " " + words[3]; tv.setText(myString); setContentView(tv); } }

    Read the article

  • CSS: how come html, body height: 100% is more then 100% ?!

    - by Nati
    hey, i was trying to do a bottom sticky footer link test and but it kept being more then 100% meaning it scrolled a litle bit.. so i made a simple HTML code, without any additions but its still more than 100%, see here: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he" lang="he" dir="rtl" id="bangler"> <head> <title>my title</title> <style type="text/css"> html, body, #wrapper { height: 100%; } body > #wrapper { height: auto; min-height: 100%; } </style> </head> <body> <div id="wrapper">aa</div> </body> </html> the thing is, it scrolls just a little bit more then 100% meaning about 5-10px more.. this is really strange, on both IE and Firefox !! Thanks in advance !

    Read the article

  • ruby on rails one-to-many relationship

    - by fenec
    I would like to model a betting system relationship using the power of rails. so lets start with doing something very simple modelling the relationship from a user to a bet.i would like to have a model bet with 2 primary keys. here are my migrations enter code here class CreateBets < ActiveRecord::Migration def self.up create_table :bets do |t| t.integer :user_1_id t.integer :user_2_id t.integer :amount t.timestamps end end def self.down drop_table :bets end end class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name t.timestamps end end def self.down drop_table :users end end the models enter code here class Bet < ActiveRecord::Base belongs_to :user_1,:class_name=:User belongs_to :user_2,:class_name=:User end class User < ActiveRecord::Base has_many :bets, :foreign_key =:user_1) has_many :bets, :foreign_key =:user_2) end when i test here in the console my relationships I got an error enter code here u1=User.create :name="aa" = # u2=User.create :name="bb" = # b=Bet.create(:user_1=u1,:user_2=u2) *****error***** QUESTIONS: 1 How do I define the relationships between these tables correctly? 2 are there any conventions to name the attributes (ex:user_1_id...) thank you for your help

    Read the article

  • ARM Assembly - Converting Endianness

    - by SoulBeaver
    Hello people! This is currently a homework project that me and my teammate are stuck on. We haven't been given much of an introduction into Assembly, and this is supposed to be our first homework exercise. The task is to create a program that converts 0xAABBCCDD into 0xDDCCBBAA. I'm not looking for an answer, as that would defeat the purpose, but we are getting severely frustrated over the difficulty of this stupid thing. We think we have a good start in creating a viable solution, but we just cannot come up with the rest of the program. First, we mask every single tupel (aa), (bb), (cc), (dd) into a different register: LDR R0, LittleEndian // 0xAABBCCDD AND R1, R0, #0xFF000000 // 0xAA AND R2, R0, #0x00FF0000 // 0xBB AND R3, R0, #0x0000FF00 // 0xCC AND R4, R0, #0x000000FF // 0xDD Then we try to re-align them into the R0 register, but hell if we could come up with a good solution... Our best effort came from: ORR R0, R1, LSL #24 ORR R0, R2, LSL #8 ORR R0, R3, LSR #8 ORR R0, R4, LSR #24 which produced 0xBBBBCCDD for some odd reason; we really don't know. Any hints would be greatly appreciated. Again, we are asking for help, but not for a solution. Cheers!

    Read the article

  • Problem with for-loop in python

    - by Protean
    This code is supposed to be able to sort the items in self.array based upon the order of the characters in self.order. The method sort runs properly until the third iteration, unil for some reason the for loop seems to repeat indefinitely. What is going on here? class sorting_class: def __init__(self): self.array = ['ca', 'bd', 'ac', 'ab'] #An array of strings self.arrayt = [] self.globali = 0 self.globalii = 0 self.order = ['a', 'b', 'c', 'd'] #Order of characters self.orderi = 0 self.carry = [] self.leave = [] self.sortedlist = [] def sort(self): for arrayi in self.arrayt: #This should only loop for the number items in self.arrayt. However, the third time this is run it seems to loop indefinitely. print ('run', arrayi) #Shows the problem if self.order[self.orderi] == arrayi[self.globali]: self.carry.append(arrayi) else: if self.globali != 0: self.leave.append(arrayi) def srt(self): self.arrayt = self.array my.sort() #First this runs the first time. while len(self.sortedlist) != len(self.array): if len(self.carry) == 1: self.sortedlist.append(self.carry) self.arrayt = self.leave self.leave = [] self.carry = [] self.globali = 1 self.orderi = 0 my.sort() elif len(self.carry) == 0: if len(self.leave) != 0: #Because nothing matches 'aa' during the second iteration, this code runs the third time" self.arrayt = self.leave self.globali = 1 self.orderi += 1 my.sort() else: self.arrayt = self.array self.globalii += 1 self.orderi = self.globalii self.globali = 0 my.sort() self.orderi = 0 else: #This is what runs the second time. self.arrayt = self.carry self.carry = [] self.globali += 1 my.sort() my = sorting_class() my.srt()

    Read the article

  • Cassandra Batch_insert example in C#.net

    - by Sandeep
    Can any one please give me an example on how to work on Cassandra batch_insert in C# thrift client? If possible please let me know where am I going wrong in the following code. Dictionary dictionary = new Dictionary(); Dictionary subColumns = new Dictionary(); List listOfMutations = new List(); listOfMutations.Add(new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("AA"), Value = utf8Encoding.GetBytes("Answer Automation"), Timestamp = timeStamp } } }); listOfMutations.Add(new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("CT"), Value = utf8Encoding.GetBytes("Call Tracker"), Timestamp = timeStamp } } }); listOfMutations.Add( new Mutation() { Column_or_supercolumn = new ColumnOrSuperColumn() { Column = new Column() { Name = utf8Encoding.GetBytes("TL"), Value = utf8Encoding.GetBytes("Track That Lead"), Timestamp = timeStamp } } }); SuperColumn superColumn = new SuperColumn() { Name=utf8Encoding.GetBytes("Indatus") }; subColumns.Add("Super1", listOfMutations); dictionary.Add("Indatus", subColumns); client.batch_mutate("Keyspace1",dictionary, ConsistencyLevel.ONE); I understand that SuperColumn struct expects List but I does not have a list of Columns. Rather I have List. Thanks in Advance.

    Read the article

  • PHP : How to get specific data from array

    - by Giffary
    Hello! I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show me some result like SimpleXMLElement Object ( [Binding] = Electronics [Brand] = Canon [DisplaySize] = 2.5 [EAN] = 0013803113662 [Feature] = Array ( [0] = High-powered 20x wide-angle optical zoom with Optical Image Stabilizer [1] = Capture 720p HD movies with stereo sound; HDMI output connector for easy playback on your HDTV [2] = 2.5-inch Vari-Angle System LCD; improved Smart AUTO intelligently selects from 22 predefined shooting situations [3] = DIGIC 4 Image Processor; 12.1-megapixel resolution for poster-size, photo-quality prints [4] = Powered by AA batteries (included); capture images to SD/SDHC memory cards (not included) ) [FloppyDiskDriveDescription] = None [FormFactor] = Rotating [HasRedEyeReduction] = 1 [IsAutographed] = 0 [IsMemorabilia] = 0 [ItemDimensions] = SimpleXMLElement Object ( [Height] = 340 [Length] = 490 [Weight] = 124 [Width] = 350 ) [Label] = Canon [LensType] = Zoom lens [ListPrice] = SimpleXMLElement Object ( [Amount] = 60103 [CurrencyCode] = USD [FormattedPrice] = $601.03 ) [Manufacturer] = Canon [MaximumFocalLength] = 100 [MaximumResolution] = 12.1 [MinimumFocalLength] = 5 [Model] = SX20IS [MPN] = SX20IS [OpticalSensorResolution] = 12.1 [OpticalZoom] = 20 [PackageDimensions] = SimpleXMLElement Object ( [Height] = 460 [Length] = 900 [Weight] = 242 [Width] = 630 ) [PackageQuantity] = 1 [ProductGroup] = Photography [ProductTypeName] = CAMERA_DIGITAL [ProductTypeSubcategory] = point-and-shoot [Publisher] = Canon [Studio] = Canon [Title] = Canon PowerShot SX20IS 12.1MP Digital Camera with 20x Wide Angle Optical Image Stabilized Zoom and 2.5-inch Articulating LCD [UPC] = 013803113662 ) my goal is to get only Feature infomation and I try to use $feature = $parsed_xml->Items->Item->ItemAttributes->Feature it does'not work for me because it just show me the first feature only. How do i get all feature information? please help

    Read the article

  • JSP getParameter problem

    - by user236501
    I have a form, if the timer reach the form will auto redirect to the Servlet to update database. My problem now is if javascript redirect the window to servlet my request.getParameter is null. function verify(f,whichCase){ if(whichCase == "Submit"){ msg = "Are you sure that you want to submit this test?"; var i = confirm(msg) if(i){ parent.window.location = "sindex.jsp" } return i; } } I doing this because i got a iframe in my jsp. Timer update problem have to use iframe. So, when time up or user click submit parent.window.location can let me refresh parent window <form method="POST" action="${pageContext.request.contextPath}/TestServlet" onSubmit="return verify(this,whichPressed)"> My form when user click submit button within the timing, it will trigger the verify function to let user confirm submit. So inside my TestServlet i got this, because using javascript redirect request.getParameter("answer") this keep return me null. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("Submit") != null) { String ans = request.getParameter("answer"); Answer a = new Answer(ans, no); aa.CreateAnswer(an,t.getTestCode(),username); RequestDispatcher rd = request.getRequestDispatcher("/sindex.jsp"); rd.forward(request, response); } } Below are my timer when time up redirect to TestServlet trigger the doGet method if((mins == 0) && (secs == 0)) { window.alert("Time is up. Press OK to submit the test."); // change timeout message as required var sUrl = "TestServlet"; parent.window.location = sUrl // redirects to specified page once timer ends and ok button is pressed } else { cd = setTimeout("redo()",1000); }

    Read the article

  • GWT + Seam, cannot fetch scoped beans from gwt servlet in seam resource servlet.

    - by David Göransson
    Hello all I am trying to get session and conversation scoped beans to a gwt servlet in the seam resource servlet. I have a conversation scoped bean: @Name ("viewFormCopyAction") @Scope (ScopeType.CONVERSATION) public class ViewFormCopyAction {} and a session scoped bean: @Name ("authenticator") @Scope (ScopeType.SESSION) public class AuthenticatorAction {} There is a RemoteService interface: @RemoteServiceRelativePath ("strokesService") public interface StrokesService extends RemoteService { public Position getPosition (int conversationId); } with corresponding async interface: public interface StrokesServiceAsync extends RemoteService { public void getPosition (int conversationId, AsyncCallback callback); } and implementation: @Name ("com.web.actions.forms.gwt.client.StrokesService") @Scope (ScopeType.EVENT) public class StrokesServiceImpl implements StrokesService { @In Manager manager; @Override @WebRemote public Position getPosition (int conversationId) { manager.switchConversation( "" + conversationId ); ViewFormCopyAction vfca = (ViewFormCopyAction) Component.getInstance( "viewFormCopyAction" ); AuthenticatorAction aa = (AuthenticatorAction) Component.getInstance( "authenticator" ); return null; } } The gwt page is within an IFrame in a regular seam page and the conversationId is propagted with the src attribute of the IFrame. Both bean objects end up with only null values. Can anyone see anything wrong with the code? I know that I could use strings instead of the int, but never mind that at this point.

    Read the article

  • Sharing NSMutableArray

    - by Lucas Veiga
    Hey everbody, im trying to share a NSMutableArray to another xib. The cartList.codigo is a NSMutableArray from a shared class, according to James Brannan's tutorial (http://www.vimeo.com/12164589). When i count it, it gives me 1. But when i load the another view, gives me 0. Whats wrong? View that adds: self.produtoCodigo = [[NSMutableArray alloc]init]; [self.produtoCodigo addObject:@"aa"]; CartViewController *carrinho = [[CartViewController alloc] initWithNibName:@"CartViewController" bundle:[NSBundle mainBundle]]; CartList *lista = [[CartList alloc] init]; carrinho.cartList = lista; carrinho.cartList.codigo = self.produtoCodigo; NSLog(@"QTD %i", [carrinho.cartList.codigo count]); View that wants to load the item added: - (void) viewDidAppear:(BOOL)animated { self.produtoCodigo = self.cartList.codigo; NSLog(@"%i", [self.produtoCodigo count]); [super viewDidLoad]; } Im loading the CartList class in both. Thanks!

    Read the article

  • how to fetch more than 1000 entities NON keybased?

    - by user291071
    If I should be approaching this problem through a different method, please suggest so. I am creating an item based collaborative filter. I populate the db with the LinkRating2 class and for each link there are more than a 1000 users that I need to call and collect their ratings to perform calculations which I then use to create another table. So I need to call more than 1000 entities for a given link. For instance lets say there are over a 1000 users rated 'link1' there will be over a 1000 instances of this class for the given link property that I need to call. How would I complete this example? class LinkRating2(db.Model): user = db.StringProperty() link = db.StringProperty() rating2 = db.FloatProperty() query =LinkRating2.all() link1 = 'link string name' a = query.filter('link = ', link1) aa = a.fetch(1000)##how would i get more than 1000 for a given link1 as shown? ##keybased over 1000 in other post example i need method for a subset though not key class MyModel(db.Expando): @classmethod def count_all(cls): """ Count *all* of the rows (without maxing out at 1000) """ count = 0 query = cls.all().order('__key__') while count % 1000 == 0: current_count = query.count() if current_count == 0: break count += current_count if current_count == 1000: last_key = query.fetch(1, 999)[0].key() query = query.filter('__key__ > ', last_key) return count

    Read the article

  • use a sprite png in li-class and display in div

    - by bonny
    hello i have some problem with displaying a sprite in a div that is in a li-class. so the structure is: <li id="aa"> <div><a href="#">one</a></div> </li> and the css: li{ width: 120px; height: 18px; margin-top: 5px; } li div{ width: 20px; height: 10px; background-image:url(../images/sprite.png) background-repeat: no-repeat; margin-left: 0px; font-weight:bolder; border: 1px solid #fff; } when i use this i can see the sprite even outside the div. so i tried adding to li background-image: none; that makes the image in the div not visible too. so if there is someone who know about that i really would appreciate. thanks alot.

    Read the article

  • Error loading font file using Imager::Font module in perl

    - by user211808
    use strict; use Imager; use Imager::Font; my $img = Imager->new(); my $file = "D:\\table.png"; $img->open(file=>$file) or die $img->errstr(); # Create smaller version my $thumb = $img->scale(scalefactor=>1.2); my $black = Imager::Color->new( 0, 0, 0 ); my $format; # Autostretch individual channels $thumb->filter(type=>'autolevels'); my $font_filename = "D:\\courbd.ttf"; my $font = Imager::Font->new(file=>$font_filename) or die "Cannot load $font_filename: ", Imager->errstr; for $format ( qw( png gif jpg tiff ppm ) ) { # Check if given format is supported if ($Imager::formats{$format}) { $file.="_low.$format"; print "Storing image as: $file\n"; $thumb->string(x => 50, y => 70, font =>$font, string => "Hello, World!", color => 'red', size => 30, aa => 1); $thumb->write(file=>$file) or die $thumb->errstr; } }

    Read the article

  • After mysql_query, no result output

    - by Jerry
    I have a simple mysql_query() update command to update mysql. When a user submits my form, it will jump to an update page to update the data. The problem is that there's supposed to be some data shown after the update, but it comes out blank. My form <form id="form1" method="POST" action="scheduleUpdate.php" > <select name=std1> <option>AA</option> <option>BB</option> <option>CC</option> </select> <select name=std2> <option>DD</option> <option>EE</option> <option>FF</option> </select> .......//more drop down menu but the name is std3..std4..etc... ....... </form> scheduleUpdate.php //$i is the value posted from my main app to tell me how many std we have for($k=0;$k<$i;$k++){ $std=$_POST['std'.$k]; //if i remove the updateQuery, the html will output.I know the query is the problem but i //couldn't fix it.. $updateQuery=mysql_query("UPDATE board SET student='$std' WHERE badStudent='$std' or goodStudent='$std'",$connection); //no output below this line at all if($updateQuery){ DIE('mysql Error:'+mysql_error()); } } // I have bunch of HTML here....but no output at all!!!! MySQL will be updated after I hit submit, but it doesn't shown any HTML.

    Read the article

  • php png image transparency

    - by user1334130
    I have been working with some code to draw a circle but I am having problems with removing the black background from the shape. I am using imagecopyresampled for its AA features in order to draw a smooth circle, so I can't use a different drawing function. Thanks. <?php $img_2 = imagecreatetruecolor(200, 200); $red = imagecolorallocate($img_2, 255, 0, 0); imagefill($img_2, 0, 0, $red); //set circle values $xPos = 50; $yPos = 80; $diameter = 40; $img_1 = imagecreatetruecolor(($diameter + 2) * 2, ($diameter + 2) * 2); $green = imagecolorallocate($img_1, 0, 255, 0); //draw the circle imagefilledarc($img_1, $diameter+1, $diameter+1, ($diameter + 2) * 2, ($diameter + 2) * 2, 0, 360, $green, IMG_ARC_PIE); imagecopyresampled($img_2, $img_1, $xPos, $yPos, 0, 0, $diameter+2, $diameter+2, ($diameter + 2) * 2, ($diameter + 2) * 2); header("Content-type: image/png"); imagepng($img_2); imagedestroy($img_1); imagedestroy($img_2); ?>

    Read the article

  • how to fetch data using jquery

    - by user3566029
    I have tried to connect my index.php file in 000webhost.com using jQuery. From the site menu I have connected with 000webhost using FTP details available in 000webhost.com. When I tried to read data from jQuery it doesn’t working. Anyone please tell me what should I need to change? Should I need to connect my Dreamweaver database to webhost? If yes please explain? This is what I have done. index.php $mysql_host = "mysql0.000webhost.com"; $mysql_database = "a000000_mydb"; $mysql_user = "a000000_root"; $mysql_password = "******"; $conn=@mysql_connect ( $mysql_host,$mysql_user,$mysql_password )or die('aa'); mysql_select_db($mysql_database,$conn) or die('eoor on db'); $quer=mysql_query("SELECT * FROM sam"); $res=array(); while($row=mysql_fetch_row($quer)) { $res[]=$row; } print(json_encode($res)); return json_encode($res); mysql_close(); index.html $.get('public_html/index.php', function( data ) { alert( 'Successful' +data); });

    Read the article

  • How do I fix a corrupted harddrive after failed upgrade?

    - by Nil
    The problem originated when I was trying to fix this problem. Things went horribly, horribly wrong and I ended up with a new problem altogether. The last thing I did was run sudo apt-get install and that caused my system to freeze. I restarted my computer and it would not boot from the harddrive. I ran a copy of Ubuntu 12.10 from a flashdrive that I had and ran gparted to see if my partitions were all there. It returned this message: Invalid partition table on /dev/sda -- wrong signature 5208. The drive appeared as a 2TiB unallocated drive with an error. The drive had 4 partitions before (plus random unallocated space). There was a fat32 partition, an ext4 partition which contained ubuntu 13.04/13.10 (I don't even know which one at this point), an extended partition which contained a swap partition for my ubuntu partition (I was meaning to move that ubuntu partition into the extended partition, never got around to it), and another partition (I don't remember how I formatted it). I should also mention this is a 1TB harddrive. So in short, I have a corrupted partition table on my primary harddrive from which I boot from, how can I fix this? I tried mounting the drive with sudo mount /dev/sda1 /media/ubuntu then I changed my directory to said folder and tried to list files and this monstrosity happened: $ ls ls: cannot access ??w?j^?.: Input/output error ls: cannot access ??(? ?x?.|: Input/output error ls: cannot access 6W_@?)?._??: Input/output error ls: cannot access HB0v???.A}?: Input/output error ls: cannot access ???.?X: Input/output error ls: cannot access t)?.+?l: Input/output error ls: cannot access ?h@ ?.@ : Input/output error ls: cannot access >? @??.???: Input/output error ls: cannot access m???.??: Input/output error ls: cannot access @ if??a?: Input/output error ls: cannot access ?M!vN$?.??n: Input/output error ls: cannot access ?o? ??.Bm`: Input/output error ls: cannot access ?:I??? M. : Input/output error ls: cannot access W??.??: Input/output error ls: cannot access ?: Input/output error ls: cannot access ?W?s??: Input/output error ls: cannot access ?v?k?.???: Input/output error ls: cannot access 5?$<N??: Input/output error .x????.??i: Input/output error ls: cannot access je????.j?1: Input/output error XjD?.???: Input/output error ls: cannot access W??n???.?: Input/output error ls: cannot access ?^x.$"?: Input/output error ls: cannot access !??*!??j.??: Input/output error ls: cannot access '-??k?^?.???: Input/output error ls: cannot access b?w?w?b.\??: Input/output error ls: cannot access o????"z.??B: Input/output error ls: cannot access ??b?h.?3-: Input/output error ls: cannot access ??.$7: Input/output error ls: cannot access )??K.bk: Input/output error ls: cannot access s??z?.?(?: Input/output error ls: cannot access ?F@?0?.@?: Input/output error .?D: Input/output error .??: Input/output error ls: cannot access?????. @: Input/output error ls: cannot access ?/?? ?.??: No such file or directory ls: cannot access rk?p4q(?.?k: Input/output error This looks promising. This is the output of fdisk -l $ sudo fdisk -l /dev/sda Warning: ignoring extra data in partition table 5 Warning: ignoring extra data in partition table 5 Warning: ignoring extra data in partition table 5 Warning: invalid flag 0x5208 of partition table 5 will be corrected by w(rite) Disk /dev/sda: 2199.0 GB, 2199023132672 bytes 255 heads, 63 sectors/track, 267349 cylinders, total 4294967056 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x44fdfe06 Device Boot Start End Blocks Id System /dev/sda1 113305600 894715903 390705152 c W95 FAT32 (LBA) /dev/sda2 894715904 1489307647 297295872 83 Linux /dev/sda3 1489309694 1497307135 3998721 5 Extended /dev/sda4 1497309184 1953523711 228107264 7 HPFS/NTFS/exFAT /dev/sda5 ? 3013257822 3688738171 337740175 aa Unknown

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20  | Next Page >