Posts

Showing posts from May, 2015

objective c - Mapping nested objects and arrays -

good afternoon, everyone! i'm trying figure out how map objects nested arrays, project keeps being terminated due uncaught exception. assume i'm not mapping correctly, i'm being told isn't key-value coding compliant. how map object nested array? following footprint of json i'm trying map, interface , implementation, , error that's being throw, respectively. finally, there link project on github, incase i've left out, or seeing full source helpful. json { "href": "string", "items": [ { "type": "string", "status": "string", "name": "string", "publisher": "string", "publisherid": "string", "description": "string", "url": "string", "smalllogoimageurl": "string", "tileimageurl": "string&

sh script doesn't add ssh key to ssh-agent (windows git bash) -

i using github windows on windows 7. have bash script add ssh-key ssh-agent. have setup ssh remote repo. add_key.sh #!/bin/bash cd ../ssh/ eval $(ssh-agent) ssh-add id.rsa cd ../htdocs/ execute command- ./add_key.sh it returns agent pid 5548 identity added: id.rsa (id.rsa) when git push origin master, fails. when manually cd in ssh directory, , run same ssh-related commands , cd directory htdocs , git push origin master, works. why happening? your problem script running in own shell session because running ./add_key.sh . this means variables set eval $(ssh-agent) not living beyond shell session parent session doesn't have them , cannot use agent (also might spawning new agent each time run script). the fix run "script" in current session dot-sourcing script instead of running external script. that want use . add_key.sh .

c++ - Running C++11 programs -

i installed gcc4.8 in scientific linux using: wget -o /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo yum install devtoolset-2 gcc --version gives me: gcc4.8 now problem when run c++11 programs on gcc (using netbeans ide) error: /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.17' not found (required /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7) /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.14' not found (required /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7) /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.15' not found (required /home/topk/cppapplication_7/dist/debug/gnu-linux-x86/cppapplication_7) can please me how can rid of error. edit: locate l

javascript - Border appears when click on input with OnClick -

i creating own website login , have input-tags of text-type. , want when clicking on them border appears when mouse anywhere else. hope can me thank in advance edit: html code <form action="login.php" method="post"> <input class="login" name="user" type="text" placeholder="benutzername"> <input class="login_pw" name="password" type="password" placeholder="passwort"><br> <br><input class="submit" name="login" value="anmelden" type="submit"> </form> css code .login { width: 250px; height: 40px; color: white; font-family: arial; font-size: 20px; font-weight: bold; text-align: center; background-color: #2e2e2e; border-bottom: 1px solid orange; border-top: none; border-left: none; border-right: none; } .login_pw { width: 250px; height: 40px; color: white;

sql server - Allow multiselect on a CSV column in SSRS -

i trying make parameter multiselect on csv column in report, not sure how or if it's possible. example dataset returned: | id | name | types | | 1 | test | type a, type b | the current dataset using in where clause parameter: where types '%' + @types + '%' this works fine single select, of course doesn't work multiselect. how can make parameter allow multiple values , still search csv column? wish where types in '%' + @types + '%' work, end where types in ('%type a%, %type b%') . or there better way can display column appears csv if sql not doing it? still want display values , see if selected type in list, if parameter set type b should still show type a, type b id = 1 . know csvs disliked in sql, seems frequent thing that's asked make csv columns , allow multiselect on it. there 2 posibilities (1) filter have single value 'type a' (2) filter have multiple values 'type

coding style - Stop PhpStorm from adding a new line after function declaration when arguments split across multiple lines -

in phpstorm 8.0.3 code style, have set add new line after function declaration, works fine. problem i'm in new project follows psr-2 standards , opening brace of function must placed in same line closing parenthesis of function arguments when these split across multiple lines, can see here . i want when arguments split across multiple lines... public function mymethod( myclass $arg1, $arg2 = null, ) { // method body } ...and when in same line... public function mymethod(myclass $arg1, $arg2 = null) { // method body } i trying search option couldn't find - know can decide whether want add new line all functions, need in these particular occasions. in file -> settings dialogue, under editor -> code style -> php select wrapping , braces tab on right hand side. find function declaration parameters block , check main control, here have bunch of options regarding wrapping parameters , few other options in block control braces p

wpf - Don't compile when there are bad bindings -

is there way prevent wpf project compiling in visual studio when there bad/incorrect bindings? no, bindings evaluated @ runtime using reflection. there no way aware of force validation @ build time. because view can bound model type when application active designed "fail gracefully" when binding can't evaluated. can see these failures in output window (typically) red debugger output lines.

wordpress - Query / Filter woocommerce products by product type -

i added new product type here now want show product type. here query: $query_args = array('post_type' => 'product' ); $r = new wp_query( $query_args ); if ( $r->have_posts() ) { ......... how can query products of new product type? in woocommerce, "post type" custom taxonomy, need add taxonomy parameters wp_query . $query_args = array( 'post_type' => 'product', 'tax_query' => array( array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => 'your_type', ), ), ); where terms argument same in $this->product_type = 'your_type'; part of new product type's class constructor.

nsdate - swift stored date turns different when formatted to string -

Image
this question has answer here: nsdate format outputting wrong date 5 answers i stored date in core data (as date), , println shows correctly value: april 21 (is var datex below), when right after println format string following code, label linked shows april 22 (which today, wonder tomorrow show 23 etc.), problem? anyone? thank you if datex != nil{ var dateformatter = nsdateformatter() dateformatter.dateformat = "mmm dd, yyyy" dateformatter.timezone = nstimezone.defaulttimezone() var datexstring = dateformatter.stringfromdate(datex nsdate) startlabel.text = "profile created on \(datexstring)" } println datex , datexstring: my time zone rome (italy) you have timezone issue. located? defaulttimezone gmt/zulu time -5 hrs east coast. a way check use timeintervals

android - RecyclerView Adapter gives error "The hierarchy of the type RecycleAdapter is inconsistent" -

i trying add new recyclerview project inside fragement . following video tutorial on link1 . when try create adapter recyclerview , start getting error. using eclipse juno. cant figure out problem. please help my code: public class recycleadapter extends recyclerview.adapter<recycleadapter.myviewholder> { private layoutinflater inflator; list <item> data = collections.empty_list; public recycleadapter(context context, list<item> data){ inflator = layoutinflater.from(context); } @override public int getitemcount() { // todo auto-generated method stub return data.size(); } @override public myviewholder oncreateviewholder(viewgroup parent, int arg1) { view view = inflator.inflate(r.layout.row_staggered_new, parent, false); myviewholder holder = myviewholder(view); return holder; } @override public void onbindviewholder(myviewholder holder, int position) { item current = data.get(position); holder.text.settext(current.title)

oracle - ORA-25028: regular trigger body can not start with keyword COMPOUND -

i getting mutating error trigger created. hence, changed trigger use compound trigger. have compound trigger below: create or replace trigger trig_chpt_update after update on task_status compound trigger /* declaration section */ task_id number(15); ckpt_id number(15); count_of_ckpt number(15); record number(15); ckpt_completed number(15):=0; total_ckpt number(15):=0; cursor cur_task_ckpt select c.taskid, c.ckpt_id, ts.status checkpoint c inner join task_status ts on c.ckpt_id=ts.ckpt_id; after each row begin /* taskid of checkpoint status being updated */ select taskid task_id checkpoint ckpt_id=:new.ckpt_id; end after each row; after each statement begin /* number of checkpoints task */ --select count(*) count_of_ckpt checkpoint taskid=task_id; /* checking assumption */ open cur_task_ckpt; record in cur_task_ckpt loop if record.taskid=task_id total_ckpt:=total_ckpt+1; if record.status=1 ckpt_completed:=ckpt_completed+1; end if; end if; end loop

python - Fit Data in Pandas DataFrame -

i querying database few variables experiment, 1 @ time , storing data in pandas dataframe. can data need, looks below instance: file time variableid data 0 1 1503657 1 11 1 1 1503757 1 22 there data several variables grabbing this, , combining them single dataframe output csv. each variable's data column added new column corresponding name of variable (as file_id should same). time column values might different (one df longer other, data wasn't sampled @ of same times, etc), if merge tables on time (and file) column, discrepancies filled in nan (and fill them in df.fillna(0)) , df can resorted time. what need though way filter data fits rate, such every 100 milliseconds (1503700,1503800,...). datapoint doesn't have fit rate (and in fact data falls on time ends in 00 instance), should closest matching data time (it closest before or after time actually, long consistent throughout). i thought iterating o

linux - GNUPLOT Illegal day of month -

i trying make graph out of stat.dat file containing: ----system---- ----total-cpu-usage---- ------memory-usage----- -net/total- time |usr sys idl wai hiq siq| used buff cach free| recv send 22-04 16:44:48| 0 0 100 0 0 0| 162m 57.1m 360m 3376m| 0 0 22-04 16:44:58| 0 0 100 0 0 0| 161m 57.1m 360m 3377m| 180b 317b and have gnu.sh containing: #!/usr/bin/gnuplot set terminal png set output "top.png" set title "cpu usage" set xlabel "time" set ylabel "percentage" set xdata time set timefmt "%d-%m %h:%m:%s" set format x "%h:%m" plot "stat.dat" using 1:3 title "system" lines, \ "stat.dat" using 1:2 title "user" lines, \ "stat.dat" using 1:4 title "idle" lines when run gnu file receive error: could not find/open font when opening font "/usr/share/fonts/truetype/ttf-liberation/liberationsans-regular.ttf", using i

search - Exploration Algorithm -

massively edited question make easier understand. given environment arbitrary dimensions , arbitrary positioning of arbitrary number of obstacles, have agent exploring environment limited range of sight (obstacles don't block sight). can move in 4 cardinal directions of nsew, 1 cell @ time, , graph unweighted (each step has cost of 1). linked below map representing agent's (yellow guy) current belief of environment @ instant of planning. time not pass in simulation while agent planning. http://imagizer.imageshack.us/a/img913/9274/qrsazt.jpg what exploration algorithm can use maximise cost-efficiency of utility, given revisiting cells allowed? each cell holds utility value. ideally, seek maximise sum of utility of cells seen (not visited) divided path length, although if complex suitable algorithm number of cells seen suffice. there maximum path length in hundreds or higher. (the actual test environments used on agent @ least 4x bigger, although theoretically there no

parallel processing - Using spmd or parfor in Matlab -

i trying run experiments in parallel using matlab 2011b time-consuming. wondering if me 'translate' following block of generic (non-working) parfor code work in spmd code. amountofoptions = 8; startstockprice = 60 + 40 * rand(1,amountofoptions); strike = 70 + 20 * rand(1,amountofoptions); v = 0.35 + 0.3 * rand(1,amountofoptions); iv = 0.25 + 0.1 * rand(1,amountofoptions); sigma = 0.15 + 0.65 * rand(1,amountofoptions); riskfreerate = 0.05 + 0.1 * rand(1,amountofoptions); tn = fix(1 + 3 * rand(1,amountofoptions)); tic; g=1:amountofoptions i=1:10 n = i*5; cti = zeros(1,n); sti = zeros(1,n); b = zeros(1,n); d1_ti = zeros(1,n); delta_t = zeros(1,n); ctn = 0; cmtn = 0; result = 0; t = (1:n)/n;

regex - Use same settings for two different locations on nginx -

i have following configs @ nginx.conf: location /records/load.js { proxy_next_upstream off; proxy_pass http://scala-front; break; } location /features/download.csv { proxy_next_upstream off; proxy_pass http://scala-front; break; } as can see, both locations share same settings. there anyway configure multiple locations same settings have 1 block? (i've tried regex far can't figure out how work slashes locations containing slashes). thanks

MongoDB dynamic update of collection when changes occurs in another collection -

i created 2 collections using robomongo : collection_project contains documents this { "_id" : objectid("5537ba643a45781cc8912d8f"), "_name" : "projectname", "_guid" : luuid("16cf098a-fead-9d44-9dc9-f0bf7fb5b60f"), "_obj" : [ ] } that create function public static void createproject(string projectname) { mongoclient client = new mongoclient("mongodb://localhost/testcreationmongo"); var db = client.getserver().getdatabase("testmongo"); var collection = db.getcollection("collection_project"); var project = new project { _name = projectname, _guid = guid.newguid(), _obj = new list<c_object>() }; collection.insert(project); } and collection_object contains documents this { "_id" : objectid("5537ba6c3a45781cc8912d90"), "associatedproject&quo

android - Updating Listview item -

i need update each item row after added listview .i using abc_slide_in_bottom animation all want when item added listview after sliding bottom previous item textview (having text value) should change imageview . mainactivity: protected void oncreate(bundle savedinstancestate) { dataobj=new data(); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mylistview=(listview)findviewbyid(r.id.lv_preflight); gobtn=(button)findviewbyid(r.id.btn_go); context=this.getapplicationcontext(); setdata();//to add first item dataobj customadapter=new datalistadapter(dataobj,context,mainactivity.this); mylistview.setadapter(customadapter); layoutanimationcontroller lac = new layoutanimationcontroller(animationutils.loadanimation(getapplicationcontext(), r.anim.abc_fade_in), 2f); mylistview.setlayoutanimation(lac); } i calling onupdate whenever new item added listview,to update old item. onupdate function i

css - Rotate text out of control -

Image
i rotate h4-tag this: .c_kolumnen h4{ text-transform: uppercase; color:gray; transform: rotate(-90deg); text-align: center; } and parent-container of has these values: .c_kolumnen { background: #fff; min-height: 300px; width: 8.33333%; font-size: 1em; margin: 0; display: inline-block; zoom: 1; letter-spacing: normal; word-spacing: normal; vertical-align: top; text-rendering: auto; box-sizing: border-box; overflow: hidden; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } now have 2 problems rotated text: a. it's 2-lined though value needs way less space has. b. doesn't horizontally (i not sure if horizontally right name it, because twisted things) align @ all. see screenshot therefore, please. what did wrong there?

android - iOS make gestureRecognizer listen outside of view -

hey using code imitate knob view in app: - (void) setupgesturerecognizer { cgpoint midpoint = cgpointmake(image.frame.origin.x + image.frame.size.width / 2, image.frame.origin.y + image.frame.size.height / 2); cgfloat outradius = image.frame.size.width / 2; gesturerecognizer = [[onefingerrotationgesturerecognizer alloc] initwithmidpoint: midpoint innerradius: outradius / 10 outerradius: outradius *2 target: self]; [self.view addgesturerecognizer: gesturerecognizer]; } like this, gesturerecognizer handles events happen on or very close button. want following: gesturerecognizer gets triggered when user touches inside image if finger leaves image, gesturerecognizer should continue listening (and calcul

ruby - Call 2 post controller methods on single form submission in rails -

i have use case need create 2 tuples ( 1 in invitation , 1 in notification table) on single form submission( action directed invitation#create). how call notification create method invitation create create new tuple in notification table. ps: no relation between invitation , notification. you wouldn't go notifications create action, in invitation create. below code use shared concern method, explained below it: class invitationscontroller < applicationcontroller include notifications #.... def create invitation = invitiation.create(invitation_params) create_notification(invitation) end private def invitation_params # strong params code end end so if had second controller/model, e.g rsvp: class rsvpscontroller < applicationcontroller include notifications #.... def create rsvp = rsvp.create(rsvp_params) create_notification(rsvp) end private def rsvp_params

html - How do I stop iPad making fontsize larger when viewing my website on Ipad in landscape mode -

when view website example page on on ipad there isn't enough width bit cramped because many columns (especially when expand sections). twist ipad view page in landscape and instead of making use of space makes font larger, how can consider width has. just add html{ -webkit-text-size-adjust: 100%; } this discussed here; preserve html font-size when iphone orientation changes portrait landscape

c# - WPF: Popout existing usercontrol -

imagine next situation: have application window several usercontrols inside. displayed side side in past, want show 1 of them in popup window. not in popup control new window. see example xaml: <window x:class="wpfapplication3.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfapplication3="clr-namespace:wpfapplication3" title="mainwindow" height="350" width="525"> <grid> <wpfapplication3:usercontrol1 visibility="hidden" x:name="usercontrol1"/> <button click="buttonbase_onclick" width="100" height="60">open window</button> </grid> in code behind need deattach usercontrol current window , assign new one: private void buttonbase_onclick(obje

php - image resizing png adding black colour in background -

i resizing images using code below, problem resizing png images transparent background fills background black color. below full code of image resizing: function store_uploaded_image($html_element_name, $new_img_width, $new_img_height ,$size ,$target_dir) { $target_file = $target_dir .'image-'.$size.'.png'; $image = new simpleimage(); $image->load($_files[$html_element_name]['tmp_name']); $image->resize($new_img_width, $new_img_height); $image->save($target_file); return $target_file; //return name of saved file in case want store in database or show confirmation message user } class simpleimage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == imagetype_jpeg ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == imagetype_g

c++ - Boost property_tree: multiple values per key, on a template class -

on topic, boost property_tree: multiple values per key , method proposed read multiples keys of boost tree. paste modified version below template<int dim> struct my_vector { std::vector<double> a_vector; }; the translator be: template<int dim> struct my_vector_translator { typedef std::string internal_type; typedef my_vector external_type; // my_vector string boost::optional<external_type> get_value(const internal_type& str) { if (!str.empty()) { std::vector val; val.resize(dim) std::stringstream s(str); double temp; (int i=0, < dim; ++i){ s >> temp; val.a_vector[i] = temp; return boost::optional<external_type>(val); } else return boost::optional<external_type>(boost::none); } }; and now, how should register translator ? namespace boost { namespace property_tree { template<typename ch, typename traits, typename alloc>

java - Duplicate entry for key -

i have simple entity class mappingbean @entity @table(uniqueconstraints =@uniqueconstraint(columnnames = { "number" })) public class mappingbean { @id @generatedvalue(strategy = generationtype.identity) private int mappingid; private string number; private string name; ...} when call entitymanager.merge(this.mapping); on mappingbean instance 2015-04-22 16:32:08,552 error [org.hibernate.engine.jdbc.spi.sqlexceptionhelper] (default task-15) duplicate entry '03054445441' key 'number' 2015-04-22 16:32:08,568 error [org.jboss.as.ejb3] (default task-15) javax.ejb.ejbtransactionrolledbackexception: org.hibernate.exception.constraintviolationexception: not execute statement what may cause exception? best regards. edmond

c# - How to pass generic in an interface (nested generics) -

i don't know whether i'm approaching right angle or not, either way can't find syntax works. i want pass 3 generic types method - there i'll use reflection create objects when need them. object i'm passing generic. it sort of sounds nested generics. let's create interface: public interface iagent<trequest, tclient, tresponse> { } i have class implements iagent: public class myclass : iagent<?> then want call method this: public method mymethod<t>(t obj) t : iagent<?> { // somethings here } update here's @ class level. public sealed class t3agent : appagent<t3requestadapter, t3webclient, t3responseadapter> { } public abstract class appagent<trequest, tclient, tresponse> trequest : iagentrequestadapter tclient : customwebclient tresponse : iagentresponseadapter { public appresponse submit(iappform appform, servicelog log) { } } public sealed class appman

frameworks - How to connect to VPN of type L2TP programatically in ios8 -

i have mobile configuration file , vpntype l2tp . how can connect vpn programatically ? can use network/extension framework this? there 2 protocol classes - nevpnprotocolipsec , nevpnprotocolikev2 . no, can't use sdk 8 networkextension.framework connect l2tp. can used ipsec ikev1 , ikev2 only.

Are file permissions and owner:group properties included in git commits? -

are file permissions , owner:group properties included in git commits? how these properties of files , directories handled throughout git pipeline [commit, push, pull, merge, etc] ? files in git assigned either 644 (owner rw- , group , other r-- ) or 755 (owner rwx , group , other r-x ). ownership information not stored. this deliberate, , well-explained this post git's maintainer, junio hamano: actually in days, git used record full (mode & 0777) blobs. once people started using git, realized had unpleasant side effect resulting tree depended on user's umasks, because 1 person records blob mode 664 , next person modifies file record mode 644, , made hard keep track of meaningful changes source code. issue fixed long time ago commit e447947 (be more liberal file mode bits., 2005-04-16).

biginsights - BigSheets DateTime Formatting -

Image
i have csv being read bigsheets in biginsights 2.1.2. 1 of columns date in structure of mm/dd/yyyy. need convert column datetime format. when click on column name have option change data type datetime. gives me prompt enter format , select timezone. apparently i'm misunderstanding format does, because enter mm/dd/yyyy , fails convert data properly. does know proper way use bigsheets , convert data mm/dd/yyyy datetime? thank you! because output in datetime format, capitalization important here. putting mm/dd/yyyy in fact telling it read minute-minute/day-day/year-year-year-year. months denoted capital m's in format. when fixed mm/dd/yyyy able interpret input.

sql - Difference Max and Min from Different Dates -

i'm going try explain best can. the code below following: finds service address servicelocation table. finds service type (electric or water). finds how many days in past pull data. once has this, calculates "daily usage" subtracting max meter read day minimum meter read day. (max(mr.reading) - min(mr.reading)) 'daytimeusage' however, i'm missing max reading day prior , minimum reading current day. mathematically, should this: max(priordayreading) - min(readdatereading) essentially, if goes 5 days should kick out table reads follows: service location | read date | usage | 123 main st | 4/20/15 | 12 | 123 main st | 4/19/15 | 8 | 123 main st | 4/18/15 | 6 | 123 main st | 4/17/15 | 10 | 123 main st | 4/16/15 | 11 | where "usage" 'daytimeusage' + usage i'm missing (and question above). example, 4/18/15 'daytimeusage

go - golang printf float no leading zero -

http://play.golang.org/p/3mjfdttoxg printf int ok, float, got no leading zero. fmt.printf("%03.6f\n", 1.234) >1.234000 why happen ?how make leading 0 display ? golang v1.4.1 edit i figured out fmt.printf("%010.6f\n", 1.234) this ok now. edit from https://golang.org/pkg/fmt/ width , precision measured in units of unicode code points, is, runes. (this differs c's printf units measured in bytes.) either or both of flags may replaced character '*', causing values obtained next operand, must of type int. the reason set 6 precision of string printed , 3 width. fmt package. width specified optional decimal number following verb. if absent, width whatever necessary represent value. precision specified after (optional) width period followed decimal number. if no period present, default precision used. ... 0 pad leading zeros rather spaces; numbers, moves padding after sign thus 1.234000. le

Move empty copy of db from windows to linux -

i have postgresql db on windows 7 machine. need create copy of on linux mint machine. is there way create template (or something?) existing db on windows machine, use create same db on linux machine (with no data). when this, primary keys each table restart @ 1 in new db or have manually that? pg_dump --schema-only --host=database_ip --username=username datbase_name > schema.sql then run schema.sql on linux mint machine.

html5 - Input type="number" with not mandatory step attribute -

i have input in form step defined 3 : <form> <input name="surface" id="surface" type="number" step="3" /> </form> i able enter number not multiple of step, it's refused @ validation browser. in example, if insert "2.5" in input, message error i've got is: please select valid value. 2 closest values 0 , 3. is possible make step not mandatory? i've tried add novalidate="novalidate" attribute doesn't work. after more research, appears it's not possible make step non mandatory on html5 input. i'll have implement custom number input (in jquery or else) achieve this.

ios - Set up Delegate relationship between two views and send messages -

in ios, building app in swift. have view container view set within it, linking embedded view. has been set using storyboards. how set delegate relationship between views in swift code can send messages / trigger functions in 1 view other? any appreciated! suppose have 2 views viewa , viewb instance of viewb created inside viewa , viewa can send message viewb's instance, reverse happen need implement delegation (so using delegate viewb's instance send message viewa) follow these steps implement delegation 1) in viewb create protocol as protocol viewbdelegate{ func delegatemethod(controller:viewb, text:string) } 2) declare delegate in sender class class viewb: uiview { var delegate: viewbdelegate! = nil } 3) use method in class call delegate method as @ibaction func calldelegatemethod(sender : uibarbuttonitem) { delegate!. delegatemethod(self, text: colorlabel.text) //assuming delegate assigned otherwise error } 4) adopt

ios - SKMap not showing because of SKCoordinateRegion -

Image
i have strange issue started happening recently, , cannot figure out why. when initialise map piece of code, works perfectly: _mapview = [[skmapview alloc] initwithframe:cgrectmake( 0.0f, 0.0f, cgrectgetwidth(self.view.frame), cgrectgetheight(self.view.frame) )]; [self.view insertsubview:_mapview atindex:0]; _mapview.settings.rotationenabled = no; _mapview.settings.displaymode = skmapdisplaymode2d; [skroutingservice sharedinstance].mapview = _mapview; but, when want zoom in specific region on map, things go funky , screen blue. code: [self.locationmanager startupdatinglocation]; _lattitude = self.locationmanager.location.coordinate.latitude; _longitude = self.locationmanager.location.coordinate.longitude; skcoordinateregion region; region.center = cllocationcoordinate2dmake(_latitude, _longitude); region.zoomlevel = 14; _mapview.visibleregion = region; [self.locationmanager stopupdatinglocation]; screenshot: now, i'd mention blue screen appears on first laun

openmodelica - Modelica: Mixing connectors and direct inputs -

the following modelica package - while neither being particularly useful nor interesting - not yield warnings. package p connector c real c; end c; model input c x; output real y; equation y = x.c; end a; model b input c inp; output c out; a; equation a.x = inp; out.c = a.y; end b; end p; however, when a not use connectors in following case, there warning: the following input lacks binding equation: a.x . clearly, there binding equation a.x . why there such warning? package p connector c real c; end c; model input real x; output real y; equation y = x; end a; model b input c inp; output c out; a; equation a.x = inp.c; out.c = a.y; end b; end p; the issue here there not binding equation. there ordinary equation. binding equation 1 applied modification element, e.g. model b input c inp; output c out; a(x=inp.c) "binding equation"; equation

Was the event loop model used in web browsers to control interaction between DOM events concomitantly developed by Brendan Eich with JavaScript? -

was event loop evaluation model used in web browsers control interaction between dom events (and later network) concomitantly developed brendan eich javascript? or did pre- or post-date javascript? edit: asking placement of event-loop inside browsers. aware event loop long-standing invention. the event loop predates javascript.. tiny bit. the event loop introduced support progressive download of pictures in netscape. , used support rendering dom elements displayed on screen before images downloaded. at time, other browsers displayed blank white screen while images downloaded. net effect netscape appears faster though takes same amount of time download , render complete page. once event loop there (initially handle network code downloading images) javascript processing added loop.

Searching Array in .txt File VB.net -

i'm doing school project vb , have been asked write program creates single dimension string array consisting of names of last 6 people win golf tournament. user has enter name in text box search array. if name appear, message box should display players name , winning year if doesn't appear message should appear explaining also. i've written out code have come across error {'i' not declared. may inaccessible due it's protection level} i have researched error , have tried multiple things code still wont work. woul appreciate thank imports system.io public class form1 dim player() string = {"tim wood", "vince singer","donal clark", "patrick hartnett", "peter nicholson", "chris montgomery"} dim winningyear() integer = {2002, 2003, 2004, 2005, 2006, 2007} private sub btnsearch_click(sender object, e eventargs) 'searches array player dim st

mysql - Is this the right way to join tables to fetch data? -

i have database tables: student(sid,name,surname,age) registration(studentid,courseid) course(cid,name,cost) i extract name of courses students younger 20. query below that? select c.name course c inner join registration inner join student s cid = courseid , sid = studentid , age < 20 group c.name i extract number of students in each course having students younger 20. correct below? select count(s.name) ,c.name student s inner join course c inner join registration age < 20 , cid = courseid , sid = studentid group c.name you missing on part join otherwise cross join. your first query should if want distinct list of student names: select distinct c.name course c inner join registration r on c.cid = r.courseid inner join student s on r.studentid = s.sid age < 20 your second query shouldn't have c.name in select if want count unless want count of how many students have name. select count(*) student s inner join registration r

angularjs - how to run ngStorage with typeScript -

is possible include ngstorage within typescript? ts2304 error can't find .d.ts file @ definitelytyped include. wanna store tokens use in rest requests. other suggestions on this? couldn't make working $sessionstorage either. apparently don't have enough knowledge typescript, might not include should have. in advance. short answer yes! longer answer yes can use ngstorage typescript. being typescript superset of javascript, can in javascript can in typescript (note there differences, not in regards using other libraries). if unable find .d.ts file module have 2 choices use it. specify type of of services/factories have type of any create own .d.ts represent module, or @ least pieces of using if decide head down route of #2, nice community submit pull request typed repo include definition created.

c# - Silverlight Context Menu IsOpen Exception? -

i have project templated silverlight control. when add dll project (with templated control) in mainpage , want open context menu right click, error: mainpage.xaml <mycontrols:draw x:name="ctrdraw"></mycontrols:draw> draw.cs (templated silverlight control) _contextmenu.isopen = true; --> error errormessage errmsg "unhandled error in silverlight application code: 4004 category: managedruntimeerror message: das festlegen von eigenschaft 'system.windows.frameworkelement.style' hat eine ausnahme ausgelöst." init: private contextmenu _contextmenu; private menuitem _contextmenuitem; event: private void map_mouserightbuttonup(object sender, graphicmousebuttoneventargs e) { _contextmenu = new contextmenu(); _contextmenuitem = new menuitem(); _contextmenuitem.header = "edit"; _contextmenu.items.add(_contextmenuitem); _contextmenuitem.click += new routedeventhandler(menuitem_click); .....

laravel - Parse.com PHP SDK ParseFile Image 403 Forbidden -

i'm using parse php sdk , trying upload image. file saves, url file returned geturl() parsefile method returns 403 forbidden when try view it. viewing file via parse data browser returns 403 error. i'm using laravel, , have tried several different methods: 1) upload file parse, save object against user , access file via geturl() method: $contents = input::file('profile_picture'); $file = parsefile::createfromdata($contents, "profilepicture_".$contents->getclientoriginalname()); auth::user()->set('profilepicture', $file); // in view <img src="{{auth::user()->get('profilepicture')->geturl()}}"/> the url returned returns 403 forbidden. 2) upload file parse , store url against user $contents = input::file('profile_picture'); $file = parsefile::createfromdata($contents, "profilepicture_".$contents->getclientoriginalname()); auth::user()->set('profilepicture', $file->geturl

php - Menu bar flicker when goes to different page -

can suggest might problem on flickering menu bar? please suggest make flickering of menu bar stop. thanks much! #mainmenu{ margin-bottom: 2.5em; } .menubar{ position: fixed; top:0; left:0; max-height:10em; width:100%; list-style: none; background-color:#333333; text-align: left; margin:0; padding: 0; z-index: 1; border-bottom: 1px solid #ccc; } .menubar .first { margin-left: 1em; } .menubar li{ position: relative; display: inline-block; width:15em; text-align: center; font-family: 'oswald', sans-serif; font-size: 1em; border-bottom: none; cursor: pointer; } .menubar li:hover{ background-color:#6666ff; } .menubar a{ display: block; padding: 0.5em 0.5em 0.5em 0.5em; text-decoration: none; color:#ffffff; } /* submenus */ .menubar .first .submenubar { padding: 0; position: absolute; top:2em; left:0; width:auto; display: none;