Search Results

Search found 1305 results on 53 pages for 'ryan holder'.

Page 1/53 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Meredith Ryan: DBA of the Day

    Meredith Ryan – DBA at the Bell Group –was elected by judges and the SQL Server community as the Exceptional DBA of 2012. So who is Meredith, and how did she become a DBA? What makes her exceptional at her work? Simple-Talk sent Richard Morris to investigate. 12 essential tools for database professionalsThe SQL Developer Bundle contains 12 tools designed with the SQL Server developer and DBA in mind. Try it now.

    Read the article

  • Remote Control Holder Mod Stores Tablet Close At Hand

    - by Jason Fitzpatrick
    If you spend most of your iPad time lounging on your couch or in bed, this simple IKEA hack will keep your favorite tablet stowed right at your finger tips. IKEA’s inexpensive remote control holder, the $4.99 Flort, is easy to hack from a remote holster into an tablet holder. You simply flip it around, sew up the edge of the back flap, and holster your tablet in it–your tablet fits all the way inside, in the above image the iPad is tucked in semi-precariously to demonstrate it sliding inside. Hit up the link below for step-by-step pictures. Smartest Way to Store Your iPad for $4.99 [IKEAHackers] HTG Explains: When Do You Need to Update Your Drivers? How to Make the Kindle Fire Silk Browser *Actually* Fast! Amazon’s New Kindle Fire Tablet: the How-To Geek Review

    Read the article

  • Make a Geeky Lego Key Holder for Your Home [Quick DIY Project]

    - by Asian Angel
    LEGOs are terrific fun to work with whether you are in a playful mood or working on a personal geeky project. With that in mind the Mini-eco blog has an quick and easy tutorial for making an awesome LEGO key holder for your home or office. The best part about this project is the amount of personalization in colors and/or themes (i.e. Star Wars, Indiana Jones, etc.) that you can bring to it. To get started just visit the blog post linked below… DIY Lego Key Holder [via BoingBoing] How To Use USB Drives With the Nexus 7 and Other Android Devices Why Does 64-Bit Windows Need a Separate “Program Files (x86)” Folder? Why Your Android Phone Isn’t Getting Operating System Updates and What You Can Do About It

    Read the article

  • Ryan Weber On KCNext | #AJIReport

    - by Jeff Julian
    We sit down with Ryan Weber of KCNext in our office to talk about the Kansas City market for technology. The Technology Council of Greater Kansas City is committed to growing the existing base of technology firms, recruiting and attracting technology companies, aggregating and promoting our regional IT assets and providing peer interaction and industry news. During this show we talk about why KCNext is great for Kansas City. They offer some great networking and educational events, but also focus on connecting companies together to help build relationships on a business level. Make sure you visit their website to see what events are coming up and link up with them on Twitter to stay on top of news from the KC technology community. Listen to the Show Site: http://www.kcnext.com/ Twitter: @KCNext LinkedIn: KCNext - The Technology Council of Greater Kansas City

    Read the article

  • AJI Report with Nat Ryan–Discussion about Game Development with Corona Labs SDK

    - by Jeff Julian
    We sat down with Nat Ryan of Fully Croisened to talk about Game Development and the Corona Labs framework. The Corona SDK is a platform that allows you to write mobile games or applications using the Lua language and deploy to the iOS and Android platforms. One of the great features of Corona is the compilation output is a native application and not a hybrid application. Corona is very centered around their developer community and there are quite a few local meetups focused on the helping other developers use the platform. The community and Corona site offers a great number of resources and samples that will help you get started in a matter of a few days. If you are into Game Development and want to move towards mobile, or a business developer looking to turn your craft back into a hobby, check out this recording and Corona Labs to get started.   Download the Podcast   Site: AJI Report – @AJISoftware Site: Fully Croisened Twitter: @FullyCroisened Site: Corona Labs

    Read the article

  • Data Holder Framework

    - by csharp-source.net
    Data Holder is an open source .net object/relational mapper written in c#. It provides typed data ecapsulation and database persistence for .net applications. It also contains a wizzard for generating the data objects and persistance c# code. Right now it has persistence implementation only for MSQL 2000/2005.

    Read the article

  • ListView: convertView / holder getting confused

    - by Steve H
    I'm working with a ListView, trying to get the convertView / referenceHolder optimisation to work properly but it's giving me trouble. (This is the system where you store the R.id.xxx pointers in as a tag for each View to avoid having to call findViewById). I have a ListView populated with simple rows of an ImageView and some text, but the ImageView can be formatted either for portrait-sized images (tall and narrow) or landscape-sized images (short and wide). It's adjusting this formatting for each row which isn't working as I had hoped. The basic system is that to begin with, it inflates the layout for each row and sets the ImageView's settings based on the data, and includes an int denoting the orientation in the tag containing the R.id.xxx values. Then when it starts reusing convertViews, it checks this saved orientation against the orientation of the new row. The theory then is that if the orientation is the same, then the ImageView should already be set up correctly. If it isn't, then it sets the parameters for the ImageView as appropriate and updates the tag. However, I found that it was somehow getting confused; sometimes the tag would get out of sync with the orientation of the ImageView. For example, the tag would still say portrait, but the actual ImageView would still be in landscape layout. I couldn't find a pattern to how or when this happened; it wasn't consistent by orientation, position in the list or speed of scrolling. I can solve the problem by simply removing the check about convertView's orientation and simply always set the ImageView's parameters, but that seems to defeat the purpose of this optimisation. Can anyone see what I've done wrong in the code below? static LinearLayout.LayoutParams layoutParams; (...) public View getView(int position, View convertView, ViewGroup parent){ ReferenceHolder holder; if (convertView == null){ convertView = inflater.inflate(R.layout.pick_image_row, null); holder = new ReferenceHolder(); holder.getIdsAndSetTag(convertView, position); if (data[position][ORIENTATION] == LANDSCAPE) { // Layout defaults to portrait settings, so ImageView size needs adjusting. // layoutParams is modified here, with specific values for width, height, margins etc holder.image.setLayoutParams(layoutParams); } holder.orientation = data[position][ORIENTATION]; } else { holder = (ReferenceHolder) convertView.getTag(); if (holder.orientation != data[position][ORIENTATION]){ //This is the key if statement for my question switch (image[position][ORIENTATION]) { case PORTRAIT: // layoutParams is reset to the Portrait settings holder.orientation = data[position][ORIENTATION]; break; case LANDSCAPE: // layoutParams is reset to the Landscape settings holder.orientation = data[position][ORIENTATION]; break; } holder.image.setLayoutParams(layoutParams); } } // and the row's image and text is set here, using holder.image.xxx // and holder.text.xxx return convertView; } static class ReferenceHolder { ImageView image; TextView text; int orientation; void getIdsAndSetTag(View v, int position){ image = (ImageView) v.findViewById(R.id.pickImageImage); text = (TextView) v.findViewById(R.id.pickImageText); orientation = data[position][ORIENTATION]; v.setTag(this); } } Thanks!

    Read the article

  • Subterranean IL: Volatile

    - by Simon Cooper
    This time, we'll be having a look at the volatile. prefix instruction, and one of the differences between volatile in IL and C#. The volatile. prefix volatile is a tricky one, as there's varying levels of documentation on it. From what I can see, it has two effects: It prevents caching of the load or store value; rather than reading or writing to a cached version of the memory location (say, the processor register or cache), it forces the value to be loaded or stored at the 'actual' memory location, so it is then immediately visible to other threads. It forces a memory barrier at the prefixed instruction. This ensures instructions don't get re-ordered around the volatile instruction. This is slightly more complicated than it first seems, and only seems to matter on certain architectures. For more details, Joe Duffy has a blog post going into the details. For this post, I'll be concentrating on the first aspect of volatile. Caching field accesses To demonstrate this, I created a simple multithreaded IL program. It boils down to the following code: .class public Holder { .field public static class Holder holder .field public bool stop .method public static specialname void .cctor() { newobj instance void Holder::.ctor() stsfld class Holder Holder::holder ret }}.method private static void Main() { .entrypoint // Thread t = new Thread(new ThreadStart(DoWork)) // t.Start() // Thread.Sleep(2000) // Console.WriteLine("Stopping thread...") ldsfld class Holder Holder::holder ldc.i4.1 stfld bool Holder::stop call instance void [mscorlib]System.Threading.Thread::Join() ret}.method private static void DoWork() { ldsfld class Holder Holder::holder // while (!Holder.holder.stop) {} DoWork: dup ldfld bool Holder::stop brfalse DoWork pop ret} If you compile and run this code, you'll find that the call to Thread.Join() never returns - the DoWork spinlock is reading a cached version of Holder.stop, which is never being updated with the new value set by the Main method. Adding volatile to the ldfld fixes this: dupvolatile.ldfld bool Holder::stopbrfalse DoWork The volatile ldfld forces the field access to read direct from heap memory, which is then updated by the main thread, rather than using a cached copy. volatile in C# This highlights one of the differences between IL and C#. In IL, volatile only applies to the prefixed instruction, whereas in C#, volatile is specified on a field to indicate that all accesses to that field should be volatile (interestingly, there's no mention of the 'no caching' aspect of volatile in the C# spec; it only focuses on the memory barrier aspect). Furthermore, this information needs to be stored within the assembly somehow, as such a field might be accessed directly from outside the assembly, but there's no concept of a 'volatile field' in IL! How this information is stored with the field will be the subject of my next post.

    Read the article

  • Behavior of retained propertie while holder is retained

    - by Aurélien Vallée
    Hello everyone, I am a beginner ObjectiveC programmer, coming from the C++ world. I find it very difficult to understand the memory management offered by NSObject :/ Say I have the following class: @interface User : NSObject { NSString* name; } @property (nonatomic,retain) NSString* name; - (id) initWithName: (NSString*) theName; - (void) release; @end @implementation User @synthetise name - (id) initWithName: (NSString*) theName { if ( self = [super init] ) { [self setName:theName]; } return self; } - (void) release { [name release]; [super release]; } @end No considering the following code, I can't understand the retain count results: NSString* name = [[NSString alloc] initWithCString:/*C string from sqlite3*/]; // (1) name retainCount = 1 User* user = [[User alloc] initWithName:name]; // (2) name retainCount = 2 [whateverMutableArray addObject:user]; // (3) name retainCount = 2 [user release]; // (4) name retainCount = 1 [name release]; // (5) name retainCount = 0 At (4), the retain count of name decreased from 2 to 1. But that's not correct, there is still the instance of user inside the array that points to name ! The retain count of a variable should only decrease when the retain count of a referring variable is 0, that is, when it is dealloced, not released.

    Read the article

  • Behavior of retained property while holder is retained

    - by Aurélien Vallée
    Hello everyone, I am a beginner ObjectiveC programmer, coming from the C++ world. I find it very difficult to understand the memory management offered by NSObject :/ Say I have the following class: @interface User : NSObject { NSString* name; } @property (nonatomic,retain) NSString* name; - (id) initWithName: (NSString*) theName; - (void) release; @end @implementation User @synthesize name - (id) initWithName: (NSString*) theName { if ( self = [super init] ) { [self setName:theName]; } return self; } - (void) release { [name release]; [super release]; } @end No considering the following code, I can't understand the retain count results: NSString* name = [[NSString alloc] initWithCString:/*C string from sqlite3*/]; // (1) name retainCount = 1 User* user = [[User alloc] initWithName:name]; // (2) name retainCount = 2 [whateverMutableArray addObject:user]; // (3) name retainCount = 2 [user release]; // (4) name retainCount = 1 [name release]; // (5) name retainCount = 0 At (4), the retain count of name decreased from 2 to 1. But that's not correct, there is still the instance of user inside the array that points to name ! The retain count of a variable should only decrease when the retain count of a referring variable is 0, that is, when it is dealloced, not released.

    Read the article

  • versioning fails for onetomany collection holder

    - by Alexander Vasiljev
    given parent entity @Entity public class Expenditure implements Serializable { ... @OneToMany(mappedBy = "expenditure", cascade = CascadeType.ALL, orphanRemoval = true) @OrderBy() private List<ExpenditurePeriod> periods = new ArrayList<ExpenditurePeriod>(); @Version private Integer version = 0; ... } and child one @Entity public class ExpenditurePeriod implements Serializable { ... @ManyToOne @JoinColumn(name="expenditure_id", nullable = false) private Expenditure expenditure; ... } While updating both parent and child in one transaction, org.hibernate.StaleObjectStateException is thrown: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): Indeed, hibernate issues two sql updates: one changing parent properties and another changing child properties. Do you know a way to get rid of parent update changing child? The update results both in inefficiency and false positive for optimistic lock. Note, that both child and parent save their state in DB correctly. Hibernate version is 3.5.1-Final

    Read the article

  • Pass ng-model and place-holder value into directive

    - by Zen
    I have a segment of code needs to be reuse a lot, there for I want to just create a directive for it. <div class="btn-group"> <div class="input-group"> <div class="has-feedback"> <input type="text" class="form-control" placeholder="BLAH BLAH" ng-model="model"> <span class="times form-control-feedback" ng-click="model=''" ng-show="model.length > 0"></span> </div> </div> </div> I want to use this code as template in directive. Create a directive used as follow: <div search-Field ng-model="model" placeholder="STRING"></div> to replace to old html, ng-model and placeholder will be as variables. angular.module('searchField', []) .directive('searchField', [function () { return { scope: { placeholder: '@', ngModel: '=' }, templateUrl: 'Partials/_SearchInputGroup.html' } }]); Is it the way of doing it?

    Read the article

  • diffuculty in appending images dynamically in an Custom List View

    - by ganesh
    Hi I have written an custom List view which binds images according to the result from a feed @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.row_for_stopnames, null); holder = new ViewHolder(); holder.name = (TextView)convertView.findViewById(R.id.stop_name); holder.dis = (TextView)convertView.findViewById(R.id.distance); holder.route_one=(ImageView)convertView.findViewById(R.id.one); holder.route_two=(ImageView)convertView.findViewById(R.id.two); holder.route_three=(ImageView)convertView.findViewById(R.id.three); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.name.setText(elements.get(position).get("stop_name")); holder.dis.setText(elements.get(position).get("distance")); String[] route_txt=elements.get(position).get("route_name").split(","); for(int i=0;i<route_txt.length;i++) { if(i==0) { holder.route_one.setBackgroundResource(Utils.getRouteImage().get(stop_txt[0])); } else if(i==1) { holder.route_two.setBackgroundResource(Utils.getRouteImage().get(stop_txt[1])); } else if(i==2) { holder.route_three.setBackgroundResource(Utils.getRouteImage().get(stop_txt[2])); } } convertView.setOnClickListener(new OnItemClickListener(position,elements)); return convertView; } class ViewHolder { TextView name; TextView dis; ImageView route_one; ImageView route_two; ImageView route_three; } for every stop name there may be route_names, maximum of three routes.I have to bind images according to the number of route names.This is what I tried to do by the above code .This works fine until I start scrolling up and down .When I do so the route images gets displayed where it does not want to be,this behaviour is unpredictable.I will be glad if someone explain me why this happens,and the best way to do this.The getRouteImage method of Utils class returns HashMap with key String and value a drawable

    Read the article

  • Web image loaded by thread in android

    - by Bostjan
    I have an extended BaseAdapter in a ListActivity: private static class RequestAdapter extends BaseAdapter { and some handlers and runnables defined in it // Need handler for callbacks to the UI thread final Handler mHandler = new Handler(); // Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { loadAvatar(); } }; protected static void loadAvatar() { // TODO Auto-generated method stub //ava.setImageBitmap(getImageBitmap("URL"+pic)); buddyIcon.setImageBitmap(avatar); } In the getView function of the Adapter, I'm getting the view like this: if (convertView == null) { convertView = mInflater.inflate(R.layout.messageitem, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. holder = new ViewHolder(); holder.username = (TextView) convertView.findViewById(R.id.username); holder.date = (TextView) convertView.findViewById(R.id.dateValue); holder.time = (TextView) convertView.findViewById(R.id.timeValue); holder.notType = (TextView) convertView.findViewById(R.id.notType); holder.newMsg = (ImageView) convertView.findViewById(R.id.newMsg); holder.realUsername = (TextView) convertView.findViewById(R.id.realUsername); holder.replied = (ImageView) convertView.findViewById(R.id.replied); holder.msgID = (TextView) convertView.findViewById(R.id.msgID_fr); holder.avatar = (ImageView) convertView.findViewById(R.id.buddyIcon); holder.msgPreview = (TextView) convertView.findViewById(R.id.msgPreview); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } and the image is getting loaded this way: Thread sepThread = new Thread() { public void run() { String ava; ava = request[8].replace(".", "_micro."); Log.e("ava thread",ava+", username: "+request[0]); avatar = getImageBitmap(URL+ava); buddyIcon = holder.avatar; mHandler.post(mUpdateResults); //holder.avatar.setImageBitmap(getImageBitmap(URL+ava)); } }; sepThread.start(); Now, the problem I'm having is that if there are more items that need to display the same picture, not all of those pictures get displayed. When you scroll up and down the list maybe you end up filling all of them. When I tried the commented out line (holder.avatar.setImageBitmap...) the app sometimes force closes with "only the thread that created the view can request...". But only sometimes. Any idea how I can fix this? Either option.

    Read the article

  • SQLBeat Podcast – Episode 6 – And the Winner is…Meredith Ryan from Albakerkee.

    - by SQLBeat
    In this episode I speak with the winner of the Exceptional DBA Award for 2012, Meredith Ryan.  We talk about a lot of things, but mainly attending the PASS Summit, first timers (this is PASS related too) and SQL Saturdays. Meredith has been with her present company for 14 years, an achievement of a bygone era in IT, but we are kindred in this area having worked at my present position for nearly 7. We also agree that every DBA should have to spend at least 2 years on Help Desk. I feel really, really dumb for not having recognized her tattoo, which I shamelessly ask about.  Congratulations, Meredith on your award and I look forward to meeting you this year in a few short weeks. Download the MP3

    Read the article

  • Android save Checkbox State in ListView with Cursor Adapter

    - by Ricardo
    I cant find a way to save the checkbox state when using a Cursor adapter. Everything else works fine but if i click on a checkbox it is repeated when it is recycled. Ive seen examples using array adapters but because of my lack of experience im finding it hard to translate it into using a cursor adapter. Could someone give me an example of how to go about it. Any help appreciated. private class PostImageAdapter extends CursorAdapter { private static final int s = 0; private int layout; Bitmap bm=null; private String PostNumber; TourDbAdapter mDbHelper; public PostImageAdapter (Context context, int layout, Cursor c, String[] from, int[] to, String Postid) { super(context, c); this.layout = layout; PostNumber = Postid; mDbHelper = new TourDbAdapter(context); mDbHelper.open(); } @Override public View newView(Context context, final Cursor c, ViewGroup parent) { ViewHolder holder; LayoutInflater inflater=getLayoutInflater(); View row=inflater.inflate(R.layout.image_post_row, null); holder = new ViewHolder(); holder.Description = (TextView) row.findViewById(R.id.item_desc); holder.cb = (CheckBox) row.findViewById(R.id.item_checkbox); holder.DateTaken = (TextView) row.findViewById(R.id.item_date_taken); holder.Photo = (ImageView) row.findViewById(R.id.item_thumb); row.setTag(holder); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); return row; }; @Override public void bindView(View row, Context context, final Cursor c) { ViewHolder holder; holder = (ViewHolder) row.getTag(); int DateCol = c.getColumnIndex(TourDbAdapter.KEY_DATE); String Date = c.getString(DateCol); int DescCol = c.getColumnIndex(TourDbAdapter.KEY_CAPTION); String Description = c.getString(DescCol); int FileNameCol = c.getColumnIndex(TourDbAdapter.KEY_FILENAME); final String FileName = c.getString(FileNameCol); int PostRowCol = c.getColumnIndex(TourDbAdapter.KEY_Post_ID); String RowID = c.getString(PostRowCol); String Path = "sdcard/Tourabout/Thumbs/" + FileName + ".jpg"; Bitmap bm = BitmapFactory.decodeFile(Path, null); File x = null; holder.Photo.setImageBitmap(bm); holder.DateTaken.setText(Date); holder.Description.setText(Description); holder.cb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox cBox = (CheckBox) v; if (cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, PostNumber); } else if (!cBox.isChecked()) { mDbHelper.UpdatePostImage(FileName, ""); } } }); } } static class ViewHolder{ TextView Description; ImageView Photo; CheckBox cb; TextView DateTaken; } }

    Read the article

  • What is a proper way to pass a parameter to Set-Alias in powershell?

    - by Nick Gorbikoff
    Hello. A little background: I use PowerShell on windows xp at work and I set a bunch of useful shortcuts in Microsoft.PowerShell_profile.ps1 in My Documents, trying to emulate Mac environment inspired by Ryan Bates's shortcuts I have things like: Set-Alias rsc Rails-Console function Rails-Console {Invoke-Expression "ruby script/console"} Which works just fine when in command prompt I say: rsc #it calls the proper command However this doesn't work properly Set-Alias rsg Rails-Generate function Rails-Generate {Invoke-Expression "ruby script/generate"} So when I do : rsg model User which is supposed to call ruby script/generate model User all it calls is ruby script/generate #Dumping my params So how would I properly modify my functions to take params I send to functions? Thank you!!

    Read the article

  • How do I set the current point in a CG graphics context?

    - by Joe
    When running the code below in the iphone simulator I get the error : CGContextClosePath: no current point. Why is the current point not being set? Or is the context not set to the correct state? CGContextBeginPath(ctx); CGMutablePathRef pathHolder; pathHolder = CGPathCreateMutable(); //move to point for the initial point NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:0] floatValue], [[holder.points objectAtIndex:1] floatValue]); CGPathMoveToPoint(pathHolder, NULL, [[holder.points objectAtIndex:0] floatValue], [[holder.points objectAtIndex:1] floatValue]); for(int x = 2; x < [holder.points count] - 1; x += 2) { NSLog(@"Drawing a state point %f, %f", [[holder.points objectAtIndex:x] floatValue], [[holder.points objectAtIndex:(x+1)] floatValue]); CGPathAddLineToPoint(pathHolder, NULL, [[holder.points objectAtIndex:x] floatValue], [[holder.points objectAtIndex:(x+1)] floatValue]); } CGContextClosePath(ctx); CGContextFillPath(ctx);

    Read the article

  • Saving a reference to a int.

    - by Scott Chamberlain
    Here is a much simplified version of what I am trying to do static void Main(string[] args) { int test = 0; int test2 = 0; Test A = new Test(ref test); Test B = new Test(ref test); Test C = new Test(ref test2); A.write(); //Writes 1 should write 1 B.write(); //Writes 1 should write 2 C.write(); //Writes 1 should write 1 Console.ReadLine(); } class Test { int _a; public Test(ref int a) { _a = a; //I loose the reference here } public void write() { var b = System.Threading.Interlocked.Increment(ref _a); Console.WriteLine(b); } } In my real code I have a int that will be incremented by many threads however where the threads a called it will not be easy to pass it the parameter that points it at the int(In the real code this is happening inside a IEnumerator). So a requirement is the reference must be made in the constructor. Also not all threads will be pointing at the same single base int so I can not use a global static int either. I know I can just box the int inside a class and pass the class around but I wanted to know if that is the correct way of doing something like this? What I think could be the correct way: static void Main(string[] args) { Holder holder = new Holder(0); Holder holder2 = new Holder(0); Test A = new Test(holder); Test B = new Test(holder); Test C = new Test(holder2); A.write(); //Writes 1 should write 1 B.write(); //Writes 2 should write 2 C.write(); //Writes 1 should write 1 Console.ReadLine(); } class Holder { public Holder(int i) { num = i; } public int num; } class Test { Holder _holder; public Test(Holder holder) { _holder = holder; } public void write() { var b = System.Threading.Interlocked.Increment(ref _holder.num); Console.WriteLine(b); } } Is there a better way than this?

    Read the article

  • Problem in finalizing the link list in C#

    - by Yasin
    My code was almost finished that a maddening bug came up! when i nullify the last node to finalize the link list , it actually dumps all the links and make the first node link Null ! when i trace it , its working totally fine creating the list in the loop but after the loop is done that happens and it destroys the rest of the link by doing so, and i don't understand why something so obvious is becoming problematic! (last line) struct poly { public int coef; public int pow; public poly* link;} ; poly* start ; poly* start2; poly* p; poly* second; poly* result; poly* ptr; poly* start3; poly* q; poly* q2; private void button1_Click(object sender, EventArgs e) { string holder = ""; IntPtr newP = Marshal.AllocHGlobal(sizeof(poly)); q = (poly*)newP.ToPointer(); start = q; int i = 0; while (this.textBox1.Text[i] != ',') { holder += this.textBox1.Text[i]; i++; } q->coef = int.Parse(holder); i++; holder = ""; while (this.textBox1.Text[i] != ';') { holder += this.textBox1.Text[i]; i++; } q->pow = int.Parse(holder); holder = ""; p = start; //creation of the first node finished! i++; for (; i < this.textBox1.Text.Length; i++) { newP = Marshal.AllocHGlobal(sizeof(poly)); poly* test = (poly*)newP.ToPointer(); while (this.textBox1.Text[i] != ',') { holder += this.textBox1.Text[i]; i++; } test->coef = int.Parse(holder); holder = ""; i++; while (this.textBox1.Text[i] != ';' && i < this.textBox1.Text.Length - 1) { holder += this.textBox1.Text[i]; if (i < this.textBox1.Text.Length - 1) i++; } test->pow = int.Parse(holder); holder = ""; p->link = test; //the addresses are correct and the list is complete } p->link = null; //only the first node exists now with a null link! }

    Read the article

  • JAXB doesn't unmarshal list of interfaces

    - by Joker_vD
    It seems JAXB can't read what it writes. Consider the following code: interface IFoo { void jump(); } @XmlRootElement class Bar implements IFoo { @XmlElement public String y; public Bar() { y = ""; } public Bar(String y) { this.y = y; } @Override public void jump() { System.out.println(y); } } @XmlRootElement class Baz implements IFoo { @XmlElement public int x; public Baz() { x = 0; } public Baz(int x) { this.x = x; } @Override public void jump() { System.out.println(x); } } @XmlRootElement public class Holder { private List<IFoo> things; public Holder() { things = new ArrayList<>(); } @XmlElementWrapper @XmlAnyElement public List<IFoo> getThings() { return things; } public void addThing(IFoo thing) { things.add(thing); } } // ... try { JAXBContext context = JAXBContext.newInstance(Holder.class, Bar.class, Baz.class); Holder holder = new Holder(); holder.addThing(new Bar("1")); holder.addThing(new Baz(2)); holder.addThing(new Baz(3)); for (IFoo thing : holder.getThings()) { thing.jump(); } StringWriter s = new StringWriter(); context.createMarshaller().marshal(holder, s); String data = s.toString(); System.out.println(data); StringReader t = new StringReader(data); Holder holder2 = (Holder)context.createUnmarshaller().unmarshal(t); for (IFoo thing : holder2.getThings()) { thing.jump(); } } catch (Exception e) { System.err.println(e.getMessage()); } It's a simplified example, of course. The point is that I have to store two very differently implemented classes, Bar and Baz, in one collection. Well, I observed that they have pretty similar public interface, so I created an interface IFoo and made them two to implement it. Now, I want to have tools to save and load this collection to/from XML. Unfortunately, this code doesn't quite work: the collection is saved, but then it cannot be loaded! The intended output is 1 2 3 some xml 1 2 3 But unfortunately, the actual output is 1 2 3 some xml com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to testapplication1.IFoo Apparently, I need to use the annotations in a different way? Or to give up on JAXB and look for something else? I, well, can write "XMLNode toXML()" method for all classes I wan't to (de)marshal, but...

    Read the article

  • how to changed editext values from first to last in customise listview in android

    - by prakash
    i am getting menunames from database then append to the custom listview edittext . now i am changing some values in edittext . i want all values with changed values of edittext into array Example :x,y,z menunames comes from database i append editext(Custom listview) now i am changed y to b now i want x,b,z in arraylist i try this code(Base adapter class) public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.editmainmenulist, null); holder.caption = (EditText) convertView .findViewById(R.id.editmaimenu); holder.caption1=(ImageView) convertView.findViewById(R.id.menuimage); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } //Fill EditText with the value you have in data source holder.caption.setText(itemnames[position]); holder.caption.setId(position); holder.caption1.setImageBitmap(bmps[position]); arr.add(holder.caption.getText().toString());//here i get menunames data only not changed edittext values return convertView; } } class ViewHolder { EditText caption; ImageView caption1; } class ListItem { String caption; } please help me

    Read the article

  • getView only shows Flagged Backgrounds for drawn Views, It does not show Flagged Background when scroll to view more items on list

    - by Leoa
    I am trying to create a listview that receives a flagged list of items to indicate a status to the user. I have been able to create the flag display by using a yellow background (see image at bottom). In Theory, the flagged list can have many flagged items in it. However in my app, only the first three flagged backgrounds are shown. I believe this is because they are initially drawn to the screen. The Flagged background that are not drawn initially to the screen do not show. I'd like to know how to get the remaining flags to show in the list. ListView Recycling: The backgrounds in the listView are being recycled in getView(). This recycling goes from position 0 to position 9. I have flags that need to match at positions 13, 14 and so on. Those positions are not being displayed. listView.getCheckedItemPositions() for multiple selections: This method will not work in my case because the user will not selected the flags. The flags are coming from the server. setNotifyOnChange() and/or public virtual void SetNotifyOnChange (bool notifyOnChange): I'm not adding new data to the list, so I don't see how this method would work for my program. Does this method communicate to getview when it is recycling data? I was unable to find an answer to this in my research. public void registerDataSetObserver: This may be overkill for my problem, but is it possible to have an observer object that keeps track of the all the positions in my items list and in my flag list no matter if the view is recycled and match them on the screen? Code: package com.convention.notification.app; import java.util.Iterator; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.text.Html; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.TextView; public class NewsRowAdapter extends ArrayAdapter<Item> { private Activity activity; private List<Item> items; private Item objBean; private int row; private List<Integer> disable; View view ; int disableView; public NewsRowAdapter(Activity act, int resource, List<Item> arrayList, List<Integer> disableList) { super(act, resource, arrayList); this.activity = act; this.row = resource; this.items = arrayList; this.disable=disableList; System.out.println("results of delete list a:"+disable.toString()); } public int getCount() { return items.size(); } public Item getItem(int position) { return items.get(position); } public long getItemId(int position) { return position; } @Override public int getItemViewType(int position) { for(int k =0;k < disable.size();k++){ if(position==disable.get(k)){ //System.out.println( "is "+position+" value of disable "+disable.get(k)); disableView=disable.get(k); //AdapterView.getItemAtPosition(position); } } return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder holder; if (view == null) { LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(row, null); getItemViewType(position); long id=getItemId(position); if(position==disableView){ view.setBackgroundColor(Color.YELLOW); System.out.println(" background set to yellow at position "+position +" disableView is at "+disableView); }else{ view.setBackgroundColor(Color.WHITE); System.out.println(" background set to white at position "+position +" disableView is at "+disableView); } //ViewHolder is a custom class that gets TextViews by name: tvName, tvCity, tvBDate, tvGender, tvAge; holder = new ViewHolder(); /* setTag Sets the tag associated with this view. A tag can be used to * mark a view in its hierarchy and does not have to be unique * within the hierarchy. Tags can also be used to store data within * a view without resorting to another data structure. */ view.setTag(holder); } else { //the Object stored in this view as a tag holder = (ViewHolder) view.getTag(); } if ((items == null) || ((position + 1) > items.size())) return view; objBean = items.get(position); holder.tv_event_name = (TextView) view.findViewById(R.id.tv_event_name); holder.tv_event_date = (TextView) view.findViewById(R.id.tv_event_date); holder.tv_event_start = (TextView) view.findViewById(R.id.tv_event_start); holder.tv_event_end = (TextView) view.findViewById(R.id.tv_event_end); holder.tv_event_location = (TextView) view.findViewById(R.id.tv_event_location); if (holder.tv_event_name != null && null != objBean.getName() && objBean.getName().trim().length() > 0) { holder.tv_event_name.setText(Html.fromHtml(objBean.getName())); } if (holder.tv_event_date != null && null != objBean.getDate() && objBean.getDate().trim().length() > 0) { holder.tv_event_date.setText(Html.fromHtml(objBean.getDate())); } if (holder.tv_event_start != null && null != objBean.getStartTime() && objBean.getStartTime().trim().length() > 0) { holder.tv_event_start.setText(Html.fromHtml(objBean.getStartTime())); } if (holder.tv_event_end != null && null != objBean.getEndTime() && objBean.getEndTime().trim().length() > 0) { holder.tv_event_end.setText(Html.fromHtml(objBean.getEndTime())); } if (holder.tv_event_location != null && null != objBean.getLocation () && objBean.getLocation ().trim().length() > 0) { holder.tv_event_location.setText(Html.fromHtml(objBean.getLocation ())); } return view; } public class ViewHolder { public TextView tv_event_name, tv_event_date, tv_event_start, tv_event_end, tv_event_location /*tv_event_delete_flag*/; } } Logcat: 06-12 20:54:12.058: I/System.out(493): item disalbed is at postion :0 06-12 20:54:12.058: I/System.out(493): item disalbed is at postion :4 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :5 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :13 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :14 06-12 20:54:12.069: I/System.out(493): item disalbed is at postion :17 06-12 20:54:12.069: I/System.out(493): results of delete list :[0, 4, 5, 13, 14, 17] 06-12 20:54:12.069: I/System.out(493): results of delete list a:[0, 4, 5, 13, 14, 17] 06-12 20:54:12.069: I/System.out(493): set adapaer to list view called; 06-12 20:54:12.128: I/System.out(493): background set to yellow at position 0 disableView is at 0 06-12 20:54:12.628: I/System.out(493): background set to white at position 1 disableView is at 0 06-12 20:54:12.678: I/System.out(493): background set to white at position 2 disableView is at 0 06-12 20:54:12.708: I/System.out(493): background set to white at position 3 disableView is at 0 06-12 20:54:12.738: I/System.out(493): background set to yellow at position 4 disableView is at 4 06-12 20:54:12.778: I/System.out(493): background set to yellow at position 5 disableView is at 5 06-12 20:54:12.808: I/System.out(493): background set to white at position 6 disableView is at 5 06-12 20:54:12.838: I/System.out(493): background set to white at position 7 disableView is at 5 This is a link to my first question a day ago: Change Background on a specific row based on a condition in Custom Adapter I appreciate your help!

    Read the article

  • Why do properties behave this way?

    - by acidzombie24
    from http://csharpindepth.com/Articles/Chapter8/PropertiesMatter.aspx using System; struct MutableStruct { public int Value { get; set; } public void SetValue(int newValue) { Value = newValue; } } class MutableStructHolder { public MutableStruct Field; public MutableStruct Property { get; set; } } class Test { static void Main(string[] args) { MutableStructHolder holder = new MutableStructHolder(); // Affects the value of holder.Field holder.Field.SetValue(10); // Retrieves holder.Property as a copy and changes the copy holder.Property.SetValue(10); Console.WriteLine(holder.Field.Value); Console.WriteLine(holder.Property.Value); } } 1) Why is a copy (of Property?) being made? 2) When changing the code to holder.Field.value and holder.Property.value = 10 i get the error below. That just blew my mind Error 1 Cannot modify the return value of 'MutableStructHolder.Property' because it is not a variable Why would i ever not be allowed to assign a value inside of a property!?! both property are get/set! and finally WHY would you EVER want behavior mentioned in 1 and 2. (It never came up for me, i always used get only properties). Please explain well, i cant imagine ever wanting the 2nd much less then the first. It is just so weird to me.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >