Posts

Showing posts from April, 2014

osx - CoreData ArrayControllers in Cocoa Storyboards -

i developing mac os port of ios app , face problem nsmanagedobjectcontexts when using nsarraycontrollers in storyboard based cocoa app. it's kind of follow-up question to: storyboard tabviewcontroller in os x application - core data array controllers in each scene? i have viewcontrollers presented in tabbarcontroller, showing same coredata entities. loaded through nsarraycontrollers, hooked interfacebuilder. from existing knowledge, no problem data on screens. editing , saving coredata works. realized, every storyboard scene got it's own instance of nsarraycontrollers , each own nsmanagedobjectcontext. when changing , saving data on 1 screen, not updated on other screens, bound through ib bindings , work in other cases. showing data, have loaded , not updating automatically. i think problem is, changed data contexta not merged (or synced) other contexts of other screens. what best way of doing that? should use nsmanagedobjectcontextdidsavenotification this? th

ios - Swift: Self type, subclassing and overriding methods -

the following code shows class superclass of class b. function has return type 'self'. overridden method in class b courses error (see comment). class { class func dosomething(param1: string) -> self { var entity = self() // code goes here... return entity } } class b: { override class func dosomething(param1: string) -> self { var entity = super.dosomething(param1) as! b // code goes here... return entity // error:'b' not convertible 'self' } } if have used instancetype in objective-c work. how can working? or not possible? i want have method return type of current overriding class. workaround have init-method accepts superclass type parameter. that brings question: object casted current class isn't equal self()? so difference between var entity = someobject as! b and var entity = self() // current class / file b edit: class func objectcast<t: a>(obj

android - How to load a url into a webview when enter is pressed? -

i trying make app search website taking google url, adding text edittext, adding google's code thing website. however, have discovered small problem: need webview refresh when enter button pressed. don't know how this. help? edit: came later, , haven't tested yet. please comment if there wrong it. package com.example.james.northalleghenyschooldistrict; import android.app.searchmanager; import android.content.intent; import android.support.v4.app.fragmentactivity; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.keyevent; import android.view.menu; import android.view.menuitem; import android.webkit.webview; import android.webkit.webviewclient; import android.widget.edittext; public class searchactivity extends fragmentactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_search); //identifies webvie

css - Angular-material's tabs and ui-bootstrap's datepicker conflict -

i have modal window angular-material tabs , ui-bootstrap datepicker. when open datepicker, text field moves up, , cannot access either datepicker or field. here's demo in jsfiddle here's code: var app = angular.module('myapp', ['ui.bootstrap', 'nganimate', 'ngaria', 'ngmaterial']) .controller('mycontroller', function ($scope, $modal) { $scope.showmodal = function () { var modalinstance; modalinstance = $modal.open({ templateurl: "addnew.html", controller: 'mycontroller2', size: 'lg' }); }; $scope.showmodal(); }) .controller('mycontroller2', function ($scope, $modal) { $scope.datepickers = { start: false } $scope.opendatepicker = function ($event, which) { $event.preventdefault(); $event.stoppropagation(); $scope.datepickers[which] = true; }; $scope.dateoptions = { formatyear: 'yy', startingday: 1 }; $sco

c# - Edit xml in program files throgh code -

i have xml file in c:\program files(86)\application . can edit file through note pad open administrator. want edit file through code. possible edit xml file through code? using windows 8.1 , visual studio 12. you can add application manifest file project , replace <requestedexecutionlevel level="asinvoker" uiaccess="false" /> with <requestedexecutionlevel level="requireadministrator" uiaccess="false" /> this way application require administrator rights run.

c# - Fluent mapping and relation table with Active flag -

i have relation table 1 additional column active bit not null i fail understand how should map in ef6, have 3 tables, foo , bar , foobar foobar relation table foobar { fooid: int (key , fk) barid: int (key , fk) active: bit } foo entity public class foo { public int id { get;set; } public icollection<foobar> bars { get; set; } ... } foobar entity public class foobar { public foo foo { get;set; } public bar bar { get;set; } public bool active { get;set; } } and problem , ef configuration foobar config public class foobarconfiguration : entitytypeconfiguration<foobar> { public foobarconfiguration() { haskey(fb => new[] {fb.foo.id, pv.bar.id}); //is correct? property(pv => pv.active); totable("productvehicle"); } } i have no clue have foo config should like, im stuck, tried like public class fooconfiguration : entitytypeconfigurati

asp.net mvc 4 - Fetching 50000 records at time using soql -

i using below code records dataset having 500k records in asp.net mvc app. var soqlcountry = new soqlquery().select(columns).limit(50000) but returns 1000 records. how 50000 records please help?? the soqlquery class limiting 1000 internally. i've sent developer of soda.net a pull request fix that. in meantime, can try out my branch .

Javafx Tree Table view: how to assign serial number to the direct child nodes of the root node -

i trying number direct child nodes of root node in serial manner (child-1, child-2...). here method sets cell value factory mycolumn: private void setcellvaluefactory() { mycolumn.setprefwidth(120); final int[] si_subsetcount = { 1 }; mycolumn.setcellvaluefactory( (treetablecolumn.celldatafeatures < mydataclass, string > p) - > { treeitem < jvcc_pageheaderinfo > ti_row = p.getvalue(); mydataclass mydataclass = p.getvalue().getvalue(); string text; if (ti_row.isleaf()) { //leaf } else if (ti_row.getparent() != null) { text = "child-" + si_subsetcount[0]; si_subsetcount[0]++; } else { si_subsetcount[0] = 1; text = "root"; } return new readonlyobjectwrapper < > (text); }); } but output below: >root >child-4 >leaf >leaf >child-8 >leaf >leaf i

Plotting participants within a pair on individual axis' in R? -

i have data experiment, participants have been working in pairs, , have rate enjoyment after task. participant<-(c(1:20)) pair<-(c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10)) position<-(c(1:2)) enjoyment<-(c(2,6,8,4,5,6,2,3,9,8,6,5,3,2,6,6,6,7,8,8)) data<-data.frame(participant, pair, position, enjoyment) i plot each participant enjoyment score, have each participant within pair on different axis (position 1 enjoyment on x-axis , position 2 enjoyment on y-axis). any suggestions how might that? follow pro's: how plot highest score within pair on y-axis? thank you. i don't have enough privileges comments, here goes: i don't understand means: (position 1 enjoyment on x-axis , position 2 enjoyment on y-axis) wouldn't need 2 dimensions regardless? one-axis solution dots along axis line, seems. if clarify in question (perhaps visual aid), more helpful. as code attempting answer question: plot(pair ~ enjoyment) woul

javascript - Node app route is not working -

im new node js , i've created following 3 files , when save application got error http.createserver(app).listen(**app.get('port')**, function(){ the error undefined not function use nodemon , see error in terminal i want keep structure of files(to initiate server different file - server.js )since want use tdd . this files server.js var http = require('http'); app = require('./app'); http.createserver(app).listen(app.get('port'), function(){ console.log('express server listening on port ' + app.get('port')); }); app.js module.exports = function() { var express = require('express'), app = express(); app.set('port', process.env.port || 3000); app.use(require('./controllers/requests')); return app; } requests.js var routers = require('express') , router = express.router() router.get('/wild', function(req, res) { debugger; res.sen

swift - how to declare a generate protocol as delegate? -

we can make generate protocol follow: protocol somedelegate { typealias t func xxx(x: t) } and make class conform it: class aa: somedelegate { typealias t = int func xxx(x: t) { // thing } } and problem how declare propert conform generate protocol this: class bb { var delegate: somedelegate } the code on above raise error: protocol 'somedelegate' can used generic constraint because has self or associated type requirements it seems can use protocol delegate follow: class bb { var delegate: aa? } but, not want, cause delegate can't inherit other parent class you use generics, using somedelegate type constraint: class bb <u : somedelegate> { var delegate: u? = nil } this way you'll need supply type of u when initialise instance of bb : struct mystruct : somedelegate { // argument of xxx needs concrete type here. func xxx(x: int) { // ... } } let bb = bb<mystruct

java - Viewpager inside a Dialog not working -

i using following code show dialog viewpager inside it new handler().postdelayed(new runnable() { @override public void run() { tutorialalerts alert = new tutorialalerts(mainactivity.this, android.r.style.theme_translucent_notitlebar_fullscreen, tutorialalerts.tutorial_alert_initial); alert.show(); } }, 3000); import android.app.dialog; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.view; import android.widget.textview; import com.iyedah.weping.r; import com.iyedah.weping.fragments.tutorialfragment; import com.viewpagerindicator.circlepageindicator; import java.util.arraylist; public class tutorialalerts extends

Keyboard Keys to Paste Text with AutoHotKey -

i using autohotkey software change use of buttons. helps lot if want open programs without having find shortcuts , click on them. all want save specific text (with paragraphs) in f keys. example, every time click f5 key, want text pasted: "hello. name apolo. bla bla bla." so, put line in autohotkey program: f5::send hello. name apolo. bla bla bla. my problems are: 01) not work when text has paragraphs. 02) paste procedure slow. (2-3 secs @ least) my questions are: 01) autohotkey choice? or better using software or scripting? , best/simplest purpose? 02) yes or no, still see if can make work autohotkey software. having copy paste same text (3 different versions) often, takes time. so, solution make life easier. you can fine ahk. use continuation section (check out method #2) section , sendinput . mytext = (ltrim lorem ipsum dolor sit amet, consectetur adipiscing elit. donec eleifend ultrices metus, auctor tellus vulputate eu

angularjs - How to build multiple applications from a single code base in Angular -

i'm working on angular application. based our application on https://github.com/swiip/generator-gulp-angular , working fine. angular seed project scans js files in directory , concats them single js file when go production. we're building admin backend billing system. client wants "public backend" clients. place clients , log in , send messages basically. ui same public backend, re-use same directives everywhere. problem public backend tiny , admin backend huge. don't think serving full admin app random client practice. how go building 2 applications same code base? don't serve 2 applications same codebase. recipe disaster. rough outline of how handle this: audit application have built. identify components reusable between 2 projects , establish base project project. if built things modularity in mind, shouldn't back-braking. may need refactor right position. john papa's angular styleguide great place on front (it's been grea

android - Google Play subscription inconsistent auto-renewal -

my app using /androidpublisher/v1 of googleapis validate google play subscriptions. (will upgraded v2 in near future) every month every user subscription automatically renewed, , new receipt response api of following type: { "kind": "androidpublisher#subscriptionpurchase", "initiationtimestampmsec": "<start timestamp>", "validuntiltimestampmsec": "<expiration timestamp>", "autorenewing": ***true*** } however, ever since 19/05/15 - following scenarios started occurring - @ end of every subscription, we're getting following response: { "kind": "androidpublisher#subscriptionpurchase", "initiationtimestampmsec": "<start timestamp>", "validuntiltimestampmsec": "<expiration timestamp>", "autorenewing": ***false*** } which means subscription had not been renewed , therefore cancelled. however, after attemp

How to Configure your Mobile site to work with Opera Mini's Single Column View -

i have wanted have mobile site works responsively facebook, twitter, google plus when person using opera mini browser single column view access mobile site. some people have suggested things using declaring on header <link rel="stylesheet" media="handheld" type="text/css" href="./kh_themes/css/mobile.css"> but has not worked me , others coz have never seen working solution expected. have idea of doing this? if view source code facebook mobile site see code before tag declaration. <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//wapforum//dtd xhtml mobile 1.0//en" "http://www.wapforum.org/dtd/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>welcome facebook</title> i tried on site , worked charm. if have mobile site add code header section before tag: <!doctype html public "-/

ios - Handling cancel in GKMatchmakerviewcontroller -

i making multiplayer feature game made. everything working, except when in matchmaking , both players connected, if 1 person hits "cancel" button other device gets no notice of canceling. on other device words change "disconnected" none of delegate methods called. how can handle this? you should implement gkmatchmakerviewcontrollerdelegate protocol.

Refresh map and layers in ARCGIS javascript -

i have drop down in page, when drop down value changes contents of map i.e data loaded should change.it loads first time when again changed not changing. new arcgis map , want reload map. tried several methods doesn't help. below code please suggest way fix this. require([ "esri/map", "esri/timeextent", "esri/dijit/timeslider", "esri/geometry/point", "esri/symbols/picturemarkersymbol", "esri/graphic", "esri/layers/graphicslayer", "esri/geometry/polyline", "dojo/_base/array", "dojo/dom", "dojo/domready!" ], function ( map, timeextent, timeslider, point, picturemarkersymbol, graphic, graphicslayer, polyline, arrayutils, dom ) { var globallocationarray = //my json data latitude , longitude var map; var longitude = 96.07677;

angularjs - Angular custom directive not working -

i have 2 things do: custom directive dropdowns custom directive upload var app=angular.module('app.directives', []); app.directive('dropdowns', function() {alert("dropdown directive"); return { restrict: 'ae', templateurl: 'html/uploadfile.html' }; }); app.directive('uploaddir', function() { alert("upload directive"); return { restrict : 'ae', templateurl : 'html/dropdowns.html' }; }); the directive dropdown working directive upload not working(the alert message in uploaddir directive not getting displayed) is syntax correct? index.html <!doctype html> <html ng-app="app"> <head> <meta charset="iso-8859-1"> <title>upload using directive</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script

swift - How to change the specific button text colour programmatically in the UIAlertController -

Image
i want changes colour of "cancel" button in uialertcontroller orange , keep colour of "log out" button is. have attached screenshot , code of alert controller below. code alert view alert = uialertcontroller(title: "", message: "are sure want log out?", preferredstyle: uialertcontrollerstyle.alert) alert.view.tintcolor = uicolor.blackcolor() alert.addaction(uialertaction(title: "log out", style: uialertactionstyle.cancel, handler:{ (uialertaction)in println("log out button clicked.") prefs.setbool(false, forkey: "isloggedin") nsuserdefaults.resetstandarduserdefaults() prefs.setbool(true, forkey: "isemail") prefs.setobject(email, forkey: "loggedemail") prefs.synchronize() let mainview = self.storyboard?.instantiateviewcontrollerwithidentifier("mainscreen") as! mainviewcontroller self.navigationcontroller?

C#(asp net mvc) -How to remove escape characters from string in controller or jquery? -

when receive string has special character in controller ajax call, see following behaviour string actualcontent ="abc\efg"; the \ in content received string contentreceived ="abc\\efg"; what best way remove escaping character \ ? either in controller while receiving string or in jquery while post processing this. so assuming might receiving double slashes 1 time or multiple times here in case, might use replace function replace each , every occurrence of \\ \ . help. string receivedstr= "abc\\efg"; string actualstr = receivedstr.replace("\\", "\"); also, if url type string, normal appear way double backslashes. if other kind of string, need work out. hope helps.

gpu - Wierd behavior with Visual Studio Debugger -

i experienced weird behavior visual studio's debugger when running vs dedicated gpu. what weird when terminate program building, debugger stays on. don't see when running vs integrated graphics. - checked if there threads or com-objects still alive , there active thread, no com references. i think it's weird. have of experienced it? missing obvious? there settings changed or special rules when running vs dedicated gpu? it doesn't hurt - makes ocd explode. ;) thank in advance constructive input :d most sincerely alpha silverback i have been surfing around long time find answer. difference between running application different graphics accelerators thread doesn't die after winmain has returned when app running using dedicated gpu. to fix - found through experimenting explicitly calling destructors of live object , calling std::exit( return code ) right before winmain's return call kill threads correctly. still weird different hardware pr

actionscript 3 - Editing a Sprite variable in a SWF With C# -

so trying develop trainer game silly know none less want know how edit sprite variable in action script of game through button , text // action script... // [initial movieclip action of sprite 2248] #initclip 12 class gamedata { var playerid, playername, lastmodified, difficulty, clevel, money, ammo_total, points; function gamedata(_playername) { var _loc2 = new date(); playerid = string(_loc2.gettime()); playerid = playerid + string(math.round(math.random() * 99999)); playername = _playername; lastmodified = new date(); difficulty = 1; clevel = 1; money = 0; ammo_total = [60000, 0, 0, 0, 0, 0]; points = 0; } // end of function static function savegame(_game) { _global.cgame.lastmodified = new date(); gamedata.savegames(_global.games); } // end of function static function savegames(_games) { var _loc1 = sharedobject.getlocal(gamedata.gameid

parallel processing - OpenCL barrier of finding max in a block -

i've found piece of opencl kernel sample code in nvidia's developer site purpose function maxoneblock find out biggest value of array maxvalue , store maxvalue[0]. i understand looping part, confused unroll part: why unroll part not need sync thread after each step done? e.g: when 1 thread done comparison of localid , localid+32, how ensure other thread have stored result localid+16? the kernel code: void maxoneblock(__local float maxvalue[], __local int maxind[]) { uint localid = get_local_id(0); uint localsize = get_local_size(0); int idx; float m1, m2, m3; (uint s = localsize/2; s > 32; s >>= 1) { if (localid < s) { m1 = maxvalue[localid]; m2 = maxvalue[localid+s]; m3 = (m1 >= m2) ? m1 : m2; idx = (m1 >= m2) ? localid : localid + s; maxvalue[localid] = m3; maxind[localid] = maxind[idx]; } barri

ios - Performing an action when 2 buttons pressed at the same time -

is there way code within swift whenever 2 buttons pressed simultaneously, action occurs? can create action links within swift individual buttons when they're pressed i'm not sure how create new action when both buttons pressed. you can use state machine keep state of both buttons. both buttons can linked single touchdowninside . each time button triggers method, increment state. similarly, both buttons can linked single touchupinside . each time button triggers method, decrement state. finally, in touchdowninside , check if state 2 (when both buttons pressed). means both buttons pressed simultaneously.

ruby on rails 4 - ActiveAdmin Nested Form multiple select -

i'm trying product_suppliers update via product form. form displays suppliers in supplier table doesn't update join table. not sure error lies. index , show show correct details edit not updating join table. starting go around , around in circles on one. update: changing form below has got me close. still not updating join table. delete works expected if manually add rows join table. display , can deleted. saving adds new product_id row not associated supply_company_id value. figure attribute issue cant see it. app/models/product.rb class product < activerecord::base ### shortned clarity has_many :product_suppliers, :foreign_key => 'product_id' has_many :supply_companies, :through => :product_suppliers accepts_nested_attributes_for :product_suppliers, :allow_destroy => true end app/models/supply_company.rb class supplycompany < activerecord::base has_many :products, :through => :product_suppliers has_many :product_supp

python - In Pandas, how to re-determine the dtypes of columns after dropna? -

i have dataframe df constructed via read_csv . want compute statistics on sampled sub_df . sub_df , want drop rows missing nans , re-check true types of columns. in data, many of integer columns read float because of missing values. i think understand question. don't think can automatically, can manually convert datatype of column using astype : import pandas pd import numpy np df = pd.dataframe([np.nan,2,3],columns = ['value']) df.dtypes value float64 dtype: object sub_df = df[df.value.notnull()] sub_df.value = sub_df.value.astype(int) sub_df.dtypes value int32 dtype: object

javascript - Appending an image to a div, but the image is called null -

if change document.body.appendchild(timg) document.div.appendchild(timg) , error saying cant appendchild of null. function happens inside initialize. function placefighter(t, imagefile) { timg = document.createelement("img"); timg.src = imagefile; timg.tangible = t; playerimg.push(timg); document.body.appendchild(timg); } i'd add id div , change code this. function placefighter(t, imagefile){ var timg = document.createelement("img"); timg.src = imagefile; timg.tangible = t; playerimg.push(timg); document.getelementbyid('mydiv').appendchild(timg); }

c++ - Setting Up OpenGL in Qt for QOpenGLWidget -

i have old opengl code created glew. trying port code qt 5.4, old code contains mesh , shader , , texture classes. what have far in qt, default main window , visualizer class inherits qopenglwidget , qopenglfunctions . able display widget black box setting mainwindow parent of visualizer . in order compile old opengl code uses functions glgenvertexarrays(); made classes inherit qopenglfunctions_3_3_core . call initializeopenglfunctions() necessary such inside initializegl() of visualizer class , in constructors of mesh , shader , , texture . it compiles well. when run program crashes when function glgenvertexarrays(); called when trying create mesh object. i guessing there memory violation of sort. have setup opengl context in qt manually qopenglwidget ? how can setup opengl 3.3 qt can use qopenglwidget render opengl content , use of opengl functions such glgenvertexarrays() ? i came interesting solution. perhaps obvious didn't see @ first. create

java - Can anyone tell me how to test my Camel Route if I have a choice operation? -

i have camel route has implemented content based routing eip(choice operation). need test it. i'm new camel. so, i'm unsure how it. can tell me how test operation. have mentioned sample code below has tested. public void configure() throws exception { onexception(exception.class).handled(true).bean(errorhandler.class).stop(); from("{{input}}?concurrentconsumers=10") .routeid("actions") .choice() .when().simple("${header.action} == ${type:status1}") .bean(class, "method1") .when().simple("${header.action} == ${type:status2}") .bean(class, "method2") .when().simple("${header.action} == ${type:status3}") .bean(class, "method3") .otherwise() .bean(class, "method4") .end(); } you can "advice" route , add mocks each choic

jsf - java.util.ConcurrentModificationException with c:forEach to loop and f:ajax to add items to ArrayList -

yes, question concurrentmodificationexception. my problem: i loopping through arraylist using <c:foreach> i adding value arraylist ajax call i getting java.util.concurrentmodificationexception. here block of xhtml: <h:form id="frmquestion" styleclass="form-horizontal"> <h:panelgroup layout="block" id="foreachanswer"> <div> <c:foreach items="#{questionbean.question.answers}" var="answer" varstatus="loopanswer"> ... </c:foreach> </div> <h:commandlink immediate="true" styleclass="list-group-item list-group-item-success text-center" action="#{questionbean.addanswer}"> <f:ajax execute="@all" render="frmquestion:foreachanswer" onevent="ajaxanswer" /> <i class=

ios - Creating a custom album on swift (a request is interfering on the process) -

i have following code got forum, , works perfectly. first time when creates album, requests user permission access photos. causes album doesn't create until second time application run. how can control that?, in order album can created first time requested. sorry if english not good, know little bit. hope can me! finally here code: import photos var assetcollection: phassetcollection! var albumfound : bool = false var photosasset: phfetchresult! var assetthumbnailsize:cgsize! var collection: phassetcollection! var assetcollectionplaceholder: phobjectplaceholder! func createalbum() { let fetchoptions = phfetchoptions() fetchoptions.predicate = nspredicate(format: "title = %@", "myalbum") let collection : phfetchresult = phassetcollection.fetchassetcollectionswithtype(.album, subtype: .any, options: fetchoptions) if let first_obj: anyobject = collection.firstobject { self.albumfound = true assetcollection = collection.firstobject phassetcollect

django - How to save the value of a jQuery sliderbar into a Person model? -

i trying save value of jquery element added surveywizardform class person(models.model): , therefore database. all of other elements in form created normal way, creating necessary fields , widgets in forms.py , data each question in models.py. result automatically work , correct data getting saved. however have customized surveywizardform on pages allow user submit rating image via jquery slider bar. my issue cannot seem store value in person model. question: how store value of slider bar slider_value in person model? all attempts far have created new entry in model/db not store value have in form/views.py. fear not linking 2 pieces correctly. any appreciated. thanks my code far slider_two.js this updates hidden form field hidden1 value of jquery slider bar if($(this).attr("id") == "one") $("#hidden1").val((ui.value > 0 ? '+' : '') + ui.value); wizard_form.html value="0" gets updated w

c# - Accessing one from another form, is it because it is a reference? -

i have tabcontrol in form 1 named tbcontrol. when press button example, change index of tabcontrol : this.tbcontrol.selectedindex = 2; it works. then have form 2, in have done : form1 form1 = new form1(); then try example : form1.tbcontrol.selectedindex=1; but doesn't work, tabcontrol doesn't change index. can tell me why ? you changing selectedindex on unshown new form1 . want change selectedindex on existing form1 , you'll need find way pass other form. psuedo-code: class form1 { private void onshowform2() { form2 f2 = new form2(); f2.mainform = this; f2.show(); } } class form2 { public form1 mainform { get; set; } private void dostuff() { //change selected index on passed in instance of form1 mainform.tbcontrol.selectedindex=1; } }

c - Detecting variable change as soon as possible -

first of all, has homework. little hint enough. what have detect when variable(signal) has changed , announce in 1 microsecond or less. progress far: int main(int argc, char **argv) { int i; n = atoi(argv[1]); if (argc != 2) { printf("usage: %s n\n" " where\n" " n : number of signals monitor\n" , argv[0]); return (1); } // set timed signal terminate program signal(sigalrm, exitfunc); alarm(20); // after 20 sec // allocate signal, time-stamp arrays , thread handles signalarray = (int *) malloc(n*sizeof(int)); timestamp = (struct timeval *) malloc(n*sizeof(struct timeval)); pthread_t siggen; pthread_t *sigdet = (pthread_t*) malloc(n * sizeof(pthread_t)); long *signalid = (long*) malloc(n * sizeof(long)); (i=0; i<n; i++) { signalarray[i] = 0; } (i = 0; < n; i++) { signalid[i] = (long) i; pthread_create (&sigdet[i], null, changedetector, (void*)

xcode - In my second view controller, i can not add an @IBOutlet in the viewcontroller.swift??? -

i can right click , drag automatically adds iboutlet in first view controller. can right click , drag not add iboutlet. how fix this? assuming not using storyboards. need add object utilities panel second view controller in xib. select object , set object's custom class in identity inspector second view controller.

Why does printing char sometimes print 4 bytes number in C -

why printing hex representation of char screen using printf prints 4 byte number? this code have written #include <stdio.h> #include <stdint.h> #include<stdio.h> int main(void) { char teststream[8] = {'a', 'b', 'c', 'd', 0x3f, 0x9d, 0xf3, 0xb6}; int i; for(i=0;i<8;i++){ printf("%c = 0x%x, ", teststream[i], teststream[i]); } return 0; } and following output: a = 0x61, b = 0x62, c = 0x63, d = 0x64, ? = 0x3f, � = 0xffffff9d, � = 0xfffffff3, � = 0xffffffb6 char appears signed on system. standard "two's complement" representation of integers, having significant bit set means negative number. in order pass char vararg function printf has expanded int . preserve value sign bit copied new bits ( 0x9d → 0xffffff9d ). %x conversion expects , prints unsigned int , see set bits in negative number rather minus sign. if don't want this, have either use unsigned