Posts

Singleton object for database class - but for multiple databases -

Singleton object for database class - but for multiple databases - background: writing c# class windows application deed customized sql server class includes custom error checking. , class allow general sql functions: executing queries, connecting database, closing connections, etc. my scenario this: have 2 separate databases need connect @ same time. want implement singleton pattern 1 connection can established each database (so total of 2 connections open @ once, 1 each database). want prevent sec connection either database beingness established. i thought flyweight pattern, don't think apply in case , if can singleton pattern work somehow improve solution... can not utilize singleton , have 2 database objects, or can create "open" flag in class checked when new connection requested see if existing connection open, , handle based on that... ideas / how can this? you can utilize mill pattern this. http://www.tutorialspoint.com/design_patter...

ios - Objective C - How to change image from another class (another UIViewController) -

ios - Objective C - How to change image from another class (another UIViewController) - i'm using nsobject class handle few server methods. one of methods download images db (parse.com). the problem uiviewcontroller nowadays image loaded faster download process (the image nil ), , 2 sec after image in device. how can update uiimageview image (userprofile class) nsobject class (the 1 download method)? i'm not using navigation bar - uiviewcontroller image in uitabbar i know how observe end of downloading process don't know how reach uiimageview property other class. use delegate requirement. check implement delegate or ios_delegates how can done. some understanding given below : say u have delegate method in nsobject class handle few server methods @protocol younsobjectclassdelegate <nsobject> @required -(void)imagedownloaded:(uiimage*)image; @end add @property (nonatomic,strong) id<younsobjectclassdelegate> delegate;...

Jquery countdown plugin, how to synchronize to server time? -

Jquery countdown plugin, how to synchronize to server time? - i want have countdown until 22:00 (10:00 pm) on server. i couldn't understand documentary should exact way so, i've managed define time pulled server (though in fiddle doesn't work, maybe refuses grab servertime.php), and define 22 hr value, doesn't work, adds +22 hours current time. how should done? do need code, , external php (that comes 2 additional .js resoruces) accomplish want? html: <span id="vvv"></span> js: $('#vvv').countdown({ until:new date(2014, 11 - 1, 9, 22, 0, 0), serversync: servertime, layout: '{hn} {hl}, {mn} {ml}, {sn} {sl}'} ); function servertime() { var time = null; $.ajax({url: 'http://keith-wood.name/servertime.php', async: false, datatype: 'text', success: function(text) { time = new date(text); }, error: function(http, message...

excel vba - Copying Dynamic Rows Into New Workbook and save it -

excel vba - Copying Dynamic Rows Into New Workbook and save it - i'm new in here. have search solution find needed. i found part of reply in post : copying dynamic cells/rows new sheet or workbook but there 2 more specific actions need , cant figure out in way. first thing save new workbooks name of "key" @ same place original file. sec thing re-create first line every new workbooks. here illustration : in db, key sorted alpha , bravo , rest... original database (db): name position key bruce 1 alpha bruce 2 alpha alfred 2 alpha alfred 3 bravo robin 1 bravo robin 1 bravo in first workbook like: name position key bruce 1 alpha bruce 2 alpha alfred 2 alpha and workbook save "alpha.xlsx" in same directory original database (in file on desktop) , close window then 2nd workbook be name position key alfred 3 bravo...

c# - Dynamically set the table name in LINQ query -

c# - Dynamically set the table name in LINQ query - i working on info warehouse application , have 4 tables schema identical. difference between tables table name. table example: ps_contractor ps_employee ps_union ps_nonunion schema id hourly benefit total now need generate 4 reports based on these tables. instead of writing 4 separate linq queries write single query can pass table name dynamically. the question how pass table name dynamically in next linq query ? var info = ( q in _dbcontext.ps_contractor bring together _l in _dbcontext.log on q.id equals l.tablelogid q.hourly = 8 select new{ hourly=q.hourly, benefit=q.benefit, total=q.total, log = l.message }.tolist(); i have looked @ similar questions suggested stack overflow. not want utilize executestorequery. what options have ? if tables have same columns, i'd extract interface out of tables , create partial entity classes implement interface, utilize interface query. fo...

jquery - Hide an element (in this case button) with visibility -

jquery - Hide an element (in this case button) with visibility - wanted hide button while maintaining space between buttons. $(document).ready(function(){ $('#hide').click(function(){$('#btn').css('visibility','hidden');}); $('#show').click(function(){$('#btn').css('visibility','visible');}); } looked visibility css tag. doesn't seem work way (or maybe i'm getting .css() function wrong). js fiddle here just utilize jquery's hide , show set visibility you: http://jsfiddle.net/uyoezedy/12/ $(function(){ $('#hide').click(function(){$('#btn').hide();}); $('#show').click(function(){$('#btn').show();}); }); behind scenes hide() sets display: none; , show() sets display: inline-block; notes: $(function(){your code here}); nice shortcut $(document).ready(function(){...}); hide collapse space element takes up your original did n...

python - how to check the field "select"? -

python - how to check the field "select"? - please help check field 'select'. model: class message(models.model): reciever = models.foreignkey( user, related_name='recipient', blank=false, null=false, ) theme = models.charfield( 'Тема сообщения', max_length=200, blank=true, null=true, ) text = models.textfield( 'Текст сообщения', max_length=10000, blank=false, ) forms: class createmessageform(forms.modelform): class meta: model = message fields = ( 'reciever', 'theme', 'text', ) def clean_reciever(self): reciever = self.cleaned_data['reciever'] if reciever == '': raise forms.validationerror("Это обязательное поле") ...