Posts

Showing posts from March, 2010

c# - MVC4 Migrations from existing project -

i'm working on existing visual studio mvc 4 application migrations , trying rebuild/have run locally. have running exception of following error: system.invalidcastexception: unable cast object of type 'system.data.entity.dynamicproxies.queuemember_f9e4ddd7fda5c... type mvc4test.domain.entities.catergoryqueuemember" so thought importing migrations folder suffice-- didn't fix i'm getting same error. so question: there way 'clean' migrations in new solution don't keep getting invalid cast exception?? the method triggering error: public actionresult index() { ienumerable<catergoryqueue> queues = unitofwork.categoryqueuerepository.get(orderby: o => o.orderby(q => q.name), includeproperties:"queuemembers"); ilist<userqueuemodel> models = new list<userqueuemodel>(); foreach(catergoryqueue queue in queues) { catergoryqueuemember member = (catergoryqueuemember)queue.queuemembers.singleordefault(m=>m.user

html - Make 100% of height responsive for any device -

how give 100% height div when give height 100% (it's not working) give height 100vh min-height 100vh create space , div become more larger required try max-height not working. want give height 100% of element any small device it. in example height become greater screen , make scroll. how 100% out scroll out missing element. <!doctype html> <div class="header">asas </div> <div class="main"> </div> <div id="footer"> </div> <style> .header { width:100%; height:60px; background:#000; } .main { width:100%; min-height:100vh; background:#c00; } #footer {width:100%; height:100px; background:#0c3; } </style> you can use calc() take off values of header , footer: body {margin:0} .header { height: 60px; background: #000; } .main { min-height: calc(100vh - 160px); background: #c00; } #footer { height: 100px;

r - Look up from different dataframes depending on a column -

supposing have following dataframes: d1 <- data.frame(index = c(1,2,3,4), location = c('barn', 'house', 'restaurant', 'tomb'), random = c(5,3,2,1), different_col1 = c(66,33,22,11)) d2 <- data.frame(index = c(1,2,3,4), location = c('server', 'computer', 'home', 'dictionary'), random = c(1,7,2,9), differen_col2 = c('hi', 'there', 'different', 'column')) what trying location based on index , dataframe is. have following: data <- data.frame(src = c('one', 'one', 'two', 'one', 'two'), index = c(1,4,2,3,2)) where src indicates dataframe data should come , index , value in index index column. src | index ------------- 1 | 1 one | 4 2 | 2 1 | 3 2 | 2 and become: src | index | location ----------------------- 1 | 1 | barn 1 | 4 | tomb 2 | 2 | computer 1 | 3 | restaurant 2 | 2 | comput

php - How to remove page from pagination URL -

i have written seo-friendly pagination function working fine. however, current url looks this: 1. localhost/test/tastepage.php/test/testpage/page/123 but want accomplish is: 2. localhost/test/testpage.php/page/123 or localhost/test/testpage.php/123 when go url bar , edit url 2 working fine. want know, why url 1 whenever load page first time? here have in tastpage.php file: $page=1;//set page number 1 default $sitepath=explode('/',parse_url($_server['request_uri'],php_url_path));//removing slashes url , slicing url array if(is_array($sitepath)&& !empty($sitepath)){ if($keys=array_search('page',$sitepath)){; print_r($keys); $page=(int)$sitepath[$keys+1]; } } function paginate($page,$display,$total){ $sitepath=parse_url($_server['request_uri'],php_url_path); if($sitepath!='/'){ $sitepath=rtrim($sitepath,'/'); if(stristr($sitepath,'page/')){ $sitepath=rtrim($sitepath

How to match a symbol with a string in Ruby -

i have array contains both string , symbol in function getting string check if array contains or not. array = ["day",:night] def check(name) if array.include? name or array.include? name.to_sym return true else return false end end if input "day" returns true . if input "night" returns false . want return true in case of "night" converted check if symbol same name exists. how can make function work compares symbol ( :night ) string ( "night" ) , returns true ? def check(name, array) array.map(&:to_s).include?(name.to_s) end array = ["day",:night] check("day", array) #=> true check(:day, array) #=> true check("night", array) #=> true check(:night, array) #=> true check("cat", array) #=> false

group concat - How group_concate Mysql Select in one query -

my mysql query is: select products_id, options_id, options_values_id products_options po, products_attributes pa pa.options_id=po.products_options_id , po.products_options_name '%velikost%' , po.language_id=7 group products_id, options_values_id and gives output: products_id options_id options_values_id 3 3501 13227 3 3501 13230 4 3501 13226 4 3501 13227 4 3501 13230 4 3501 13231 5 3501 13226 5 3501 13227 5 3501 13230 5 3501 13231 6 3501 13226 6 3501 13227 6 3501 13230 6 3501 13231 and wish have output this: 3 3501 '13227, 13230' 4 3501 '13226, 13227, 13230, 13231' 5 3501 '13226, 13227, 13230, 13231' 6 3501 '13226, 13227, 13230, 13231' i trying query group_concat select products_id, options_id, group_concat( options_values_id ) products_options po, products_attributes pa pa.options_id = po.products_options_id , po.products_options_name '%veliko

django global object individual user relation -

i have 2 main models, comic , issue, single comic has multiple issues. trying figure out how issues specific user has read. thinking of creating model called readissue store read state can't figure out how read property on each issue depending on user. from understood in text, way build basic models class comic(models.model): name = models.charfield(max_length=100) class issue(models.model): comic = models.foreignkey(comic, related_name='issues') title = models.charfield(max_length=100) def was_read_by(self, user): return bool(self.users.filter(user=user).count()) class readissue(models.model): user = models.foreignkey(user, related_name='read') issue = models.foreignkey(issue, related_name='users') now can queries this user = users.objects.get(pk=1) comic = comic.objects.get(pk=1) first_issue = comic.issues.all().first() user_read_it = first_issue.was_read_by(user) so check if combination user-issue

python - Access denied when attempting to remove printer -

def on_printer_button_clicked(self, button): in range(len(self.printer_buttons)): if button == self.printer_buttons[i]: phandle = win32print.openprinter(self.printers[i]['pprintername']) win32print.deleteprinter(phandle) return so i'm doing opening printer handle , calling function delete printer, can see. here's in console when run function: uninstall_windowgui.py", line 57, in on_printer_button_clicked win32print.deleteprinter(phandle) pywintypes.error: (5, 'deleteprinter', 'access denied.') i've tried running ide (pycharm in administrator mode, , still same issue. idea on how move on? i'm kind of stuck until can figure out. (also: i'm using gtk , gdk create interface, if makes differece.) the documentation states printer handle must opened printer_access_administer . might work: printer_defaults = {"desiredaccess":win32print.printer_access_administer} win32print.ope

jquery plugins - When using Handsontable how to force a selected cell into edit mode? -

handsontable provides nice hooks when cell selected can't seem figure out way allow me force cell edit mode when has been selected. i can detect cell selection this: handsontable.pluginhooks.add( 'afterselection', function( row, column ) { var current_td = this.getcell( row, column ); }); and there can obtain cell element selected. there can't seem trigger cell edit mode (where has actively selected textarea field inside of it). triggered double click. doing obvious doesn't seem work: handsontable.pluginhooks.add( 'afterselection', function( row, column ) { var current_td = this.getcell( row, column ); $(current_td).dblclick(); }); anyone else ever done or have thoughts on how might work? for intersted in question, there better programmable way achieve same result. this.selectcell(row, col); this.getactiveeditor().beginediting(); this selects (row, col) cell , enters edit mode (i.e. same double click or pressing f2

regex - paste r commands inside rmarkdown file -

i want function place piece of markdown in readme.rmd file. include rcode that executed when new version of readme file rendered. this want in readme.rmd: [![last-changedate](https://img.shields.io/badge/last%20change- r gsub("-", "--", sys.date()) -yellowgreen.svg)](/commits/master)" which @ knitr time turn nicely formated shield date. however paste in document have escape of characters: paste0("`r ", "gsub(\"-\", \"--\", sys.date())", "`") but results [![last-changedate](https://img.shields.io/badge/last%20change-`r gsub(\"-\", \"--\", sys.date())`-yellowgreen.svg)](/commits/master)" , cannot rendered rmarkdown error: unexpected input: gsub(\ ^.... with suggestion of chinsoon12 : " using single quote works? i.e. use paste0(" r ", "gsub('-', '--', sys.date())", " ") " my problem solved! paste double ,

python - Extract Values from heavily nested list of dictionaries with duplicate key value pairs -

trying extract total cash , cash equivalent values complex , messy list of dictionaries. shortened version of structure follows below. i've tried: maps, dataframe.from_dict & .from_records. trying avoid using re. i'm stumped. [{u'fields': [], u'reportdate': u'2 june 2016', u'reportid': u'balancesheet', u'reportname': u'balance sheet', u'reporttitles': [u'balance sheet', u'test company', u'as @ 30 june 2016'], u'reporttype': u'balancesheet', u'rows': [{u'cells': [{u'value': u''}, {u'value': u'30 jun 2016'}, {u'value': u'30 jun 2015'}], u'rowtype': u'header'}, {u'rowtype': u'section', u'rows': [], u'title': u'a

python - Precision and Recall on PySpark DecisionTree model diverges from manual results -

i trained decisiontree model on pyspark dataframe. resulting dataframe simulated below: rdd = sc.parallelize( [ (0., 1.), (0., 0.), (0., 0.), (1., 1.), (1.,0.), (1.,0.), (1.,1.), (1.,1.) ] ) df = sqlcontext.createdataframe(rdd, ["prediction", "target_index"]) df.show() +----------+------------+ |prediction|target_index| +----------+------------+ | 0.0| 1.0| | 0.0| 0.0| | 0.0| 0.0| | 1.0| 1.0| | 1.0| 0.0| | 1.0| 0.0| | 1.0| 1.0| | 1.0| 1.0| +----------+------------+ so let's calculate metric, recall: metricsp = multiclassmetrics(df.rdd) print metricsp.recall() 0.625 ok. let's try confirm correct: tp = df[(df.target_index == 1) & (df.prediction == 1)].count() tn = df[(df.target_index == 0) & (df.prediction == 0)].count() fp = df[(df.target_index == 0)

android - NPE when instantiating a convertView -

here code create custom view listview . uses custom view named squareprogressbar : package com.example.simpledownloader.adapter; import net.yscs.android.square_progressbar.squareprogressbar; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import com.example.simpledownloader.r; import com.example.simpledownloader.sharable.sharable; public class taskadapter extends baseadapter { context ctx = null; public taskadapter(context ctx){ this.ctx = ctx; } //-------------------------------------------------------------------------------- @override public int getcount() { return sharable.downloads.size(); } //-------------------------------------------------------------------------------- @override public object getitem(int index) { return sharable.downloads.get(index); } //----------

jsf - Navigating outside of dir into a different directory in primafaces -

Image
i using templates primefaces , can't seem right. keep getting 500 error . trying navigate createorder.xhtml web-inf/templates/fullpagetemplate.xhtml . the path have in createorder.xhtml is: template="/web-inf/templates/fullpagetemplate.jsf" i keep getting exception: servlet.service() servlet faces servlet threw exception: javax.faces.view.facelets.tagattributeexception: /order/createorder.xhtml @7,53 <ui:composition template="/web-inf/templates/fullpagetemplate.jsf"> invalid path : /web-inf/templates/fullpagetemplate.jsf screenshot of file structure: you need go 1 directory first before navigating web-inf directory preceding file path .. this: template="../web-inf/templates/fullpagetemplate.jsf"

How does this rails route match any incoming action to it's correlated method on the controller? -

i have rails route defined this: match '/test_report(/:action)' => 'test_report#index', via: :all i not expert on rails routing, using context clues have expected route map request /test_report/some_action or /test_report/other_action index method on testreportcontroller , because of part of route definition after hash rocket: => 'test_report#index' . however, not behavior. instead, can create method on testreportcontroller called update_report , , can post /test_report/update_report trigger update_report method. route definition i'm using, wouldn't expect work, does. have expected post hit index method on controller. note: we're clear, understand (/:action) part of route marks optional part of url, , :action symbol special here , interpreted action's name. tl;dr : if => 'test_report#index' in above route doesn't map requests index method on controller, do? as know, whatever parameters de

c++ - Arduino, Calculating the resultant direction of the magnitude of three microphones -

i trying calculate direction theta range 0 - 2 pi indicate direction of resultant vector of 3 microphones placed @ 0 degree, 120, , 240 degree marks. of microphones working somehow can't seem correct degree values. can @ code? void detdirection(){ //mic1 float x0 =0; float y0 =volts[0]; //serial.println(x0); // serial.println(y0); //mic2 float x1 =volts[1]*cos(120.0/360 * 2*pi); float y1 =volts[1]*sin(120.0/360 * 2*pi); // serial.println(x1); //serial.println(y1); //mic3 float x2 =volts[2]*cos(240.0/360 * 2*pi); float y2 = volts[2]*sin(240.0/360 * 2*pi); //serial.println(x2); //serial.println(y2); //calculate resultant float sumx = x0 + x1 + x2; float sumy = y0 + y1 + y2; //serial.println(sumx); //serial.println(sumy); float resultant = pow(pow(sumx,2)+pow(sumy,2),0.5); float degree = atan2(sumy,sumx); float fixdegree= 0 ; //fix degree if(!isneg(sumx) && !isneg(sumy)){ fixdegree = degree; } else if(isneg(sumx) && !isneg(sumy)){ fixdegree = pi - degree; }

bigcommerce app development - custom payment portal -

i need create custom payment portal bigcommerce store. so can capture credit card information , store in own system. given bigcommerce supports development of private apps - can suggest approach how write app allow me change checkout screen not display, paypal checkout, instead display own? there 3rd party apps allow capture payment information facilitate recurring payments, , others change checkout page layout, seems possible inject javascript bigcommerce screens.

html - Canvas makes height of parent DIV grow, why? -

with code: <!-- gets: height: 504px, why? --> <div style="background-color:black"><canvas width="500" height="500"></canvas></div> the div container layout have 504px in chrome 49.0.2623.112 , 504.14px in ie 11.0.9600.18314 why container padding, margin , border set 0 grow beyond content size? https://jsfiddle.net/4gqk5dmw/1/ by default, canvas element inline element, letters inside of block of text. space seeing there accommodate descenders of characters j , p , q , etc. if want fix problem, add canvas: canvas { vertical-align: middle; }

Error while importing mice functions in R package -

i include mice::mice function in package perform imputation on data. i use roxygen list imports #' @param data dataset used imputation #' @importfrom dplyr select_ #' @importfrom mice mice complete #' @return list #' @export #' impute_data <- function(data, vars, seed) { data_used <- select_(data,vars) mice_data <- complete(mice(data_used, seed = seed)) return(mice_data) } this function works fine when test code, when build package , try use it, following error error in check.method(setup, data) : following functions not found: mice.impute.pmm,mice.impute.pmm, mice.impute.pmm, mice.impute.pmm, mice.impute.pmm i tried add imports functions mentioned in error had no effect whatsoever on outcome. what missing? i've never found such problem. you forgetting handle description file! handle impute_data.r. your question quite similar to: what roxygen should put when use function of package in function i gave

python - AgglomerativeClustering on a correlation matrix -

i have correlation matrix of typical structure of size 288x288 defined by: from sklearn.cluster import agglomerativeclustering df = read_returns() correl_matrix = df.corr() where read_returns gives me dataframe date index, , columns of returns of assets. now - want cluster these correlations reduce population size. by doing reading , experimenting discovered agglomerativeclustering - , appears @ first pass appropriate solution problem. i define distance metric ((.5*(1-correl_matrix))**.5) , have: cluster = agglomerativeclustering(n_clusters=40, linkage='average') cluster.fit(((.5*(1-correl_matrix))**.5).values) label_groups = cluster.labels_ to observe of data , cross check work pick out cluster 1 , observe pairwise correlations , find min correlation between 2 items group in dataset find : single_cluster = [] in range(0,correl_matrix.shape[0]): if label_groups[i]==1: single_cluster.append(correl_matrix.index[i]) min_correl = 1.0 x in single_c

Ruby - Merge two hashes with no like keys based on matching value -

i find efficient way merge 2 hashes , resulting hash must contain original data and new key/value pair based on criteria below. there no keys in common between 2 hashes, key in 1 hash matches value of key in adjacent hash. also note second hash array of hashes. i working relatively large data set, looking efficient solution hoping keep code readable @ same time since end in production. here structure of data: # hash hsh1 = { "devicename1"=>"active", "devicename2"=>"passive", "devicename3"=>"passive" } # array of hashes hsh2 = [ { "host" => "devicename3", "secure" => true }, { "host" => "devicename2", "secure" => true }, { "host" => "devicename1", "secure" => false } ] here need accomplish: i need merge data hsh1 hsh2 keeping of original key/value pairs in hsh2 , adding n

python - Find all the occurrences of a character in a string -

i trying find occurences of "|" in string. def findsectionoffsets(text): startingpos = 0 endpos = len(text) position in text.find("|",startingpos, endpos): print position endpos = position but error: position in text.find("|",startingpos, endpos): typeerror: 'int' object not iterable the function def findoccurences(s, ch): return [i i, letter in enumerate(s) if letter == ch] findoccurrences(yourstring, "|") will return list of indexes of yourstring in | occur

spring boot - Cannot build Docker image using spotify plugin -

i have been using spotify plug-in build docker images, stops working reason, , spews out error complaining exec failure on spotify plug-in [info] [info] --- maven-jar-plugin:2.5:jar (default-jar) @ simplewebapp --- [info] building jar: /home/test/opd_workspace/my_simple_webapp/target/simplewebapp-0.0.1-snapshot.jar [info] [info] --- spring-boot-maven-plugin:1.3.5.release:repackage (default) @ simplewebapp --- [info] [info] --- docker-maven-plugin:0.2.3:build (default-cli) @ simplewebapp --- slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. [info] copying /home/test/opd_workspace/my_simple_webapp/target/simplewebapp-0.0.1-snapshot.jar -> /home/test/opd_workspace/my_simple_webapp/target/docker/simplewebapp-0.0.1-snapshot.jar [info] copying src/main/docker/dockerfile -> /home/test/opd_workspace/my_simple_webapp/targe

ruby - Create an array of users based on each user's weekday and time attributes -

i have following code creates array of users depending on "global" weekdays , times. def current_time # server_time = time.now server_time = time.local(2013,8,19,8,30) # time simulation local_offset = (2 * 60 * 60) local_time = server_time + local_offset end def hours_mon_to_thurs?(date) ["monday", "tuesday", "wednesday", "thursday"].include?(date.strftime("%a")) && ("08:30"..."17:00").include?(date.strftime("%h:%m")) end def hours_fri?(date) ["friday"].include?(date.strftime("%a")) && ("08:30"..."15:00").include?(date.strftime("%h:%m")) end def hours_lunch?(date) !("12:00"..."13:00").include?(date.strftime("%h:%m")) end if hours_mon_to_thurs?(current_time) && hours_lunch?(current_time) p "[user1, user2]" elsif hours_fri?(current_time) && hours_

java - jOption message not closing -

hello apologises if stupid question i'm struggling work out why joptionpane message not closing. i'm wanting use nested control structure countup amount of calculations performed user. i figure it's how i'm either counting or how i'm testing see if condition has been met dispose of calculator frame (i'm going new thing happen i'm wanting whole thing close) package ac.uk.valley.forth; import java.awt.borderlayout; import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.border.emptyborder; import javax.swing.jbutton; import java.awt.event.actionlistener; import java.awt.event.actionevent; import javax.swing.jtextfield; import javax.swing.joptionpane; public class calculator extends jframe { protected static final string operatorbutton = null; private jpanel contentpane; private jtextfield textfield; private double total = 0.0; private double actualtotal = 0.0; private char operator; public int counter

ios - Significant lag using UISlider when custom refresh is called -

a uislider embedded in tableview cell, however, significant amount of lag seems "build up" move uislider around , interact custom tableview reloading method call when uislider value changes. whenever uislider moved around, method called updates label in uitableview (the label in same uitableviewcell uislider). that method added uislider via: [discoverycell.radiusslider addtarget:self action:@selector(radiussliderchanged:) forcontrolevents:uicontroleventvaluechanged]; here code update. (i didn't call reload uitableview, since want prevent tableview scrolling top upon reload). the logic behind nsinteger "prev_value" exists prevent excessive tableview reloading. code called when uislider moved: cgfloat prev_value=-1; -(void)radiussliderchanged:(uislider * )sender { if (prev_value==-1) { prev_value=sender.value; return; } cgfloat currentvalue=sender.value;

How to inject a custom Spring PropertySource into Environment in a non-web project? -

i have custom propertysource reads external source. inject spring environment in non-web , non-spring-boot project. i think there ways via applicationcontextinitializer seems specific web application registration involves setting contextinitializerclasses . my use-case tests in small project require loading app context , need access properties set custom property source. mocking values not option , find if there's way register custom propertysource environment in non-web project?

xCode and Swift tutorial confusion -

Image
i'm following apple's tutorial ios app development , says viewcontroller.swift file, files showing in xcode viewcontroller.h , viewcontroller.m. what's difference between these files , .swift file? it depends on language select if choose objective-c you'll have viewcontroller.h , viewcontroller.m choose swift you'll have viewcontroller.swift file simple that.

java - My Hangman Code Isn't Registering Incorrect Guesses Immediately, is Printing Double Sets of Underscores, and more -

Image
i'm having 3 primary issues code replicate hangman game: the "fill-in" portion randomly printed twice, correct guesses randomly logged incorrect and incorrect guesses not counted code main class: public class main { public static void main(string[] args) { hangman manhang = new hangman(); } } hangman class: import java.util.random; public class hangman { random r; getdata get; string[] bank = {"consider","minute","accord","evident","practice","intend","concern","commit","issue","approach","establish","utter","conduct","engage","obtain","scarce","policy","straight","stock","apparent","property","fancy","concept&q

Include files in Makefile at the start of a makefile or at the end of the makefile -

i want know if there difference when include *.mk @ start of makefile or include *.mk @ end of makefile: include *.mk all: xxxxx clean: xxxxxx include *.mk include statement not introduce logic of own. mere convenience, , equivalent pasting included lines root makefile . so, order or placement of include statements matters as order of lines in makefile .

java - Explanation of execSQL (String sql) function of SQLiteDatabase -

what execsql (string sql) function belongs sqlitedatabase do? i've read android documentation not getting it..please explain in easy words. thanks in advance. i know you've said you've read android documentation, i'm going link again it's pretty explained there. taken android documentation here public void execsql (string sql) execute single sql statement not select or other sql statement returns data. it has no means return data (such number of affected rows). instead, you're encouraged use insert(string, string, contentvalues), update(string, contentvalues, string, string[]), et al, when possible. in other words, it's used execute queries don't return data, such updating database's tuples or inserting new tuples database.

Oracle Exception problems in ASP.NET MVC -

Image
i facing problems when use connection string below: <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> <section name="oracle.manageddataaccess.client" type="oracleinternal.common.odpmsectionhandler, oracle.manageddataaccess, version=4.121.1.0, culture=neutral, publickeytoken=89b483f429c47342" /> </configsections> <connectionstrings> <add name="oracleconnectionstring" providername="oracle.manageddataaccess.client" connectionstring="user id=testdb;password=testdb;data source=testdb" /> </connectionstrings> <entityframework> <defaultconnectionfactory type="oracle.manageddataaccess.entityframework.oracleconnectionfactory, oracle.manageddataacc

android - ListView item state color -

i trying change background color of listview during item selection , it's various state. , have wrote markup: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/my_color" android:state_activated="true"/> <item android:drawable="@color/my_color" android:state_selected="true"/> <item android:drawable="@color/my_color" android:state_pressed="true"/> <item android:drawable="@android:color/transparent"/> </selector> the problem - desied color applied in every state of list item except post selection of listitem. mean when user select , immediate after touch, shows default blue color millisecond. missing handle state? <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/my_color" android:state_enabled="true

Reading uninitialized unsigned int arrays from a packet in C -

im stuck problem of reading bytes in c tcp socket server receives request python client. have following struct receive template struct ofp_connect { uint16_t wildcards; /* identifies ports use below */ uint16_t num_components; uint8_t pad[4]; /* align 64 bits */ uint16_t in_port[0]; uint16_t out_port[0]; struct ofp_tdm_port in_tport[0]; struct ofp_tdm_port out_tport[0]; struct ofp_wave_port in_wport[0]; struct ofp_wave_port out_wport[0]; }; ofp_assert(sizeof(struct ofp_connect) == 8); i can read first 2 32 bit fields problem in_port[0] after pad field seems wrong. way being read is uint16_t portwin, portwout, * wportin; wportin = (uint16_t*)&cflow_mod->connect.in_port; //where cflow_mod main struct encompasses connect struct template described above memcpy(&portwin, wportin, sizeof(portwin) ); dbg("inport:%d:\n", ntohs(portwin)); unfortunately doesnt give me expected inpo