Posts

Showing posts from July, 2012

java - How do I add a null object to an ArrayList inside an ArrayList -

i trying represent ad hoc network using adjacency matrix structure. this, creating arraylist inside arraylist. when add new vertex graph, create new arraylist (inside super arraylist) , have loop add new null object each arraylist, size of arraylists not increase correctly , can't figure out why. here code: public class matrix { public arraylist<arraylist<edge>> graph; public arraylist<vertex> verticies; public arraylist<edge> edges; public matrix() { graph = new arraylist(); verticies = new arraylist(); edges = new arraylist(); } public matrix(arraylist<vertex> verticies, arraylist<edge> edges) { this.verticies = verticies; this.edges = edges; } public void addvertex(vertex v) { verticies.add(v); graph.add(new arraylist()); for(int i=0; i<graph.size()-1; i++ ) { graph.get(i).add(null); } } any appreciated. the initial size of graph 0 , for loop in addvertex() runs

javascript - Animate CSS on selection of <option> -

i attempting trigger change of css objects further down in code when 1 of option tags selected. did not include them here not pertinent issue @ hand jquery. @ loss @ point. here have far...is possible? <script> $(document).ready(function(){ $("#feed-filter option:selected").change(function () { $("#ca, #ga, #gd").animate({height: '0px'}); }) }) </script> <div class="feed-filter"> <select id="feed-filter" name="feed-filter"> <option id="option-all" value="all" selected>all</option> <option id="option-ca" value="a">a</option> <option id="option-dad" value="b">b</option> <option id="option-ga" value="c">c</option> <option id="option-gd" value="d">d</option> </select> </div

sql - "ORA-01438: value larger than specified precision allowed for this column" when inserting 3 -

i'm running error when trying insert number except 0 field format number (2,2). update prog_own.prog_tporcentaje_merma set pct_merma = 3 idn_porcentaje_merma = 1 [error code: 1438, sql state: 22003] ora-01438: value larger specified precision allowed column column_name data_type type_name column_size buffer_length decimal_digits pct_merma 3 number 2 0 2 it happens if try decimal numbers. any idea why? you can't update number greater 1 datatype number(2,2) because, first parameter total number of digits in number , second 1 (.i.e 2 here) number of digits in decimal part. guess can insert or update data < 1 . i.e. 0.12, 0.95 etc. please check number datatype in number datatype .

Spring Security Logout session is not invalidated -

i tried find on stackoverflow , elsewhere make working , still not work. using spring framework 4.1.6.release, spring security 4.0.0.release. configured namespace logout tag , way able invalidate session doing programmatically in controller httpsession.invalidate() call. when requesting logout, redirected appropriate page, session never invalidated , jsessionid not deleted. , no not cache effect. tried fine cache suggestions , having @preauthorize annotations , user must authenticated call them , can call them if logs out. way invalidate session enter bad username/password in login panel redirected , refused authentication. @ point, session destroyed. i out of ideas , hints. here security-applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <b:beans xmlns:b="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://www.springframework.org/schema/secu

c# - Get parameter list from compiled Java binary -

we have compiled java binary i.e. file.jar , jar takes command parameter such file1.jar command1 , in addition each command takes command parameters such file1.jar command1 -p1=value -p2=value we want list of parameters each command , use in codebase. is there way list of commands , parameters compiled java binary programmatically bit how reflection done in .net? thanks in advance.

angularjs - Logging form field value when close modal in Angular -

i have trying console.log form field when user closes modal, unsure how this. when use code below, input in form field not reflected. ideas? javascript: .controller('contactformctrl', function($modal) { var contactform = this; contactform.agreement = agreement; contactform.contact.signature = ''; return; function agreement() { $modal.open({ templateurl: 'views/agreement.html' }) .result.then( function () { var agreement=contactform.contact.signature; console.log(agreement); (contactform.value1 = true); }, function () { contactform.value1 = false; } ); } }); html: <form name="paymentform"> <div class="form-group> <label class="control-label" for="signature">signature</label> <input type="text" id="signature" name="signature" ng-model="contactform.contact.signature" aria-descr

regex - extract all "ul a" entities from html page that have a certain String in the "title" -

in style of example on this page i'm trying of senses in particular name applied specific person based on wikipedia disambiguation page. the trouble wikipedia pages highly non-uniform. one common feature though list of names appear in ul element part of link a , in title= component of link there reference name we're looking for. since these links associated wikipedia pages. using jsoup, or other method, how recognize these components? h2:contains(people) + ul a ^that works when they're in section entitled people mentioned, not case. perhaps in pseudocode this: ul && title contains *string* maybe this: a[href], [title] but matching part of title, not whole thing. this example of non-structured page such method called for. this example of 1 it's not important. but i'm trying make generalizable apply equally both types. this kind of works: elements linx = docx.select("a:contains(corzine)");

java - Unable to Access files in Directory -

i have directory structure follows: db_set -d1 - db_1.txt -d2 - db_2.txt -d3 - db_3.txt -d4 - db_4.txt -d5 - db_5.txt i want store db_1.txt , db_2.txt , db_3.txt , db_4.txt , db_5.txt in arraylist . how can this? partial code: file folder = new file("./webcontent/datasets/db_set/"); file[] listoffiles = folder.listfiles(); system.out.println("listoffiles: "+listoffiles); arraylist<file> sub_dir = new arraylist<file>(); (int = 0; < listoffiles.length; i++) { if (listoffiles[i].isfile()) { system.out.println("file " + listoffiles[i].getname()); } else if (listoffiles[i].isdirectory()) { sub_dir.add(listoffiles[i]); } } you need go 2 levels deep. file folder = new file("./webcontent/datasets/db_set/"); file[] listofsubdirectories = folder.listfiles(new filefilter() { @override public boolean accept(file file) {

javascript - bootstrap navbar mobile toggle not working -

i loaded bootstrap css , js files , added html code of following. both succesfully loaded - css in head tag , js below footer. other functions working fine. <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container container-header"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="{{ url_for('public.home') }}"> nektime </a> </div>

linq - How to take X elements from a group by in C# lambda -

i want take last 4 elements groupby , add list. i'm using mysql database , asp mvc5. tried this: list<payments> payments= db.payments .where(e => e.account.active==true) .groupby(e => e.idaccount) .select(e => e.orderby(x => x.paiddate).take(4)) .selectmany(e => e).tolist(); i got following error: unknown column 'join2.idaccount' in 'where clause' this payment class: public partial class payment { public int id { get; set; } [foreignkey("account")] [displayname("id account")] public int idaccount { get; set; } [foreignkey("client")] [displayname("id client")] public int idclient { get; set; } public nullable<decimal> amount { get; set; } [displayname("paid date")] public system.datetime paiddate { get; set; } public virtual account account { get; set; } public virtual client client { get; set; } }

Ruby on Rails - PUT Method Creates Extra Params Entry -

so observed weird behaviour while implementing endpoint restful api creating mobile client. using put method update attribute on user model. send user's id url parameter , value update inside json object. seems work fine when check parameters via rails logs noticed strange. reason there parameter being sent backend can't seem explain. here logs seeing when call endpoint mobile client: parameters: {"enable_security"=>true, "id"=>"7d7fec98-afba-4ca9-a102-d5d71e13f6ce", "user"=>{}} as can seen above additional "user"=>{} appended list of parameter entries. see when print out params object well. can't seem explain coming from. checked mobile client safe , there no in code send parameter key user . puzzling me , makes me think missing simple. why there empty object user key being sent backend restful api? update provide more information here code gets called when user hits endpoint updates use

WEIRD: Javascript string.split() and forloop split prepends mysterious comma ',' to resulting string -

so messing around js objects, trying stuff out. taking request, json, object. selec .api path. want traverse object , store it's name can pull more json orm expirement. doesn't matter really. here json: var fakerestresponse = function() { return { "swaggerversion": "1.2", "apiversion": "1.0.0", "apis": [{ "path": "/users" }, { "path": "/skills" }, { "path": "/resumes" }], "info": {} }; }; function createsubstr(strin, thechar) { var substr = []; (var = 0; < strin.length; i++) { var str = ' '; if (strin[i] === thechar) { console.log("found first match" + strin + ' str[i] ' + strin[i] + ' thechar ' + thechar + ' str: ' + str); i++; while (strin[i] !== thechar && strin[i] !== ',' &&a

jquery - id of dynamically created button undefined -

i have dynamically created buttons: <input type='button' id='remove_"+ii+"' class='removeitem' value='remove'> the value of ii irrelevant. i trying listen of these buttons clicked , something: $(document).on('click',$('.removeitem'),function(){ alert($(this).attr('id')); }); however, alert giving me "undefined". @ least expect see "remove_".. what missing? i think problem way registering event handler. in case passing jquery object second parameter while trying use event delegation. for event delegation need pass string selector second param .on() $(document).on('click', '.removeitem',function(){ alert($(this).attr('id')); }); demo: fiddle why? because on() method allows pass object parameter, passed handler in event.data property, handler instead of using event delegation adding handler document object event data jquery objec

How to get maximum value in inner array elements in php -

this might easy not me i have var_dump($array) this. array (size=12) 0 => int 1 1 => int 7 2 => int 8 3 => int 9 4 => int 3 5 => int 8 6 => int 3 7 => int 6 8 => int 5 9 => int 3 10 => int 4 11 => int 5 i need max value index 2 5 , index 4 8 , 8 11 how can acheive this. tried max() function getting errors. you can iterate through array searching max value. first set var $max negative value , inside loop if value in index $i greater $max , change value. <?php $array = array( 0 => 1, 1 => 7, 2 => 8, 3 => 9, 4 => 3, 5 => 8, 6 => 3, 7 => 6, 8 => 5, 9 => 3, 10 => 4, 11 => 5 ); function maxarray($from, $to, $array) { $max = -1; for($i = $from; $i <= $to; $i++) { if($array[$i] > $max) { $max = $array[$i]; } } return $max; } echo maxarray(2, 5, $array) . "<br>"; echo maxarray(4, 8, $array) . "&l

java - Android Proguard: Exclude jar file that already proguarded -

i'm trying apply proguard features in android project, i'm getting error message: (can't process class [com/ipay/ipayacitivity.class] (unknown verification type [14] in stack map frame)) i have tried searching solutions, no luck fixing

php - Replacing values using .csv file -

i'm building schedule board our university. i'm done uploading .csv file , showing data. problem is, there way can replace whole data i've uploaded before in uploading new .csv file? mean delete/replace old data.. this php code upload csv file. <?php $conn = mysql_connect("localhost","root","") or die (mysql_error()); mysql_select_db("testing",$conn); if(isset($_post['submit'])) { $file = $_files['file']['tmp_name']; if($file == "") { ?> <script type="text/javascript"> alert('no file selected!'); </script> <?php } else { $handle = fopen($file,"r"); while(($fileop = fgetcsv($handle,1000,",")) !==false) { $subj_desc = $fileop[0]; $subj_code = $fileop[1]; $units = $fileop[2]; $day = $fileop[3]; $start_time = $file

datetime - How to get AM/PM by ADDTIME() in MySQL -

i have 1 field starttime in database , value '7:00:00 pm' , want add 20 minutes in time , store in new field endtime . want endtime in same format starttime '07:20:00 pm', used addtime , , many more function this, unable format of am/pm , used date_add('next_contact_time', interval 20 minute), date_format(addtime(next_contact_time,'00:20:00'),'%h:%i:%s %p') endtime but, i'm not able am / pm use this declare @starttime time(0) = '07:00:00 am'; --time declare @minutestoadd int = 20; --added 20 minutes select substring((convert(varchar(8), dateadd(minute, @minutestoadd, @starttime), 109)),0,8) + ' ' + right(convert(varchar(30), dateadd(minute, @minutestoadd, @starttime), 9), 2) time

javascript - How to manipulate history with history.go? -

function del_cookie(name) { document.cookie = name + '=; expires=thu, 01-jan-70 00:00:01 gmt;'; } <!doctype html> <html lang="en"> <head> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="keywords" content="spanish chat, child abuse chat, child abuse support, child abuse discussion, suvivor, chat, discussion, support, domestic violence, violencia domestica, abuso infantil, abuso de niño"> <meta name="description" content="moderated chat rooms victims , survivors of child abuse , domestic violence."> <title>yes ican: international child advocacy network</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesh

Code to Automatically Post Images To My Twitter Account via Python Script -

i want post images programmatically on own (not other peoples') twitter account. end, tried using tweepy library -- have method called api.update_with_media('the image') not work. it seems twitter has deprecated method: ...statuses/update_with_media (sorry truncated html -> i'm new here, won't let me post many links) twitter instructs use instead: ...public/uploading-media basically, 2-step method. step 1) upload media , id in json step 2) use id update status both of these steps require authentication. problem twitter libraries, (which can found here twitter-libraries) don't support new method. have simple 1 before in documentation. it seems possibly 1 fixed it, docs didn't updated (i didn't play -- @ point decided contract out). can found here . it seems options are: 1) build code scratch, including a) oauth (breakable, complex) b) update status script (re-writing code libraries have) 2) same above use generic oauth library 3)

selenium - How to automate a windows screen that has a webpage embed in it? -

Image
i have msi installer, after installation opens configuration screen. before start configuring, need enter login credentials. now, login screen opens in window has web page embed it. need automate login screen enter user name , password. in below image, windows screen. 1 red border windows pane, inside web page can see fields enter credentials. when see using uispy, can see url in 'value' field when pointed inside pane. if use ui automation, cannot detect web page. if use selenium cannot detect windows screen. how handle scenario. suggestion of great help. forget selenium , start looking @ autoit or similar tools, can operate native windows frames , possible elements inside. https://www.autoitscript.com/site/autoit/

angularjs service,provider and factory? -

this question has answer here: angularjs: service vs provider vs factory 30 answers i little bit confusing on service,provider , factory. differences between angularjs module's service, provider , factory?please tell , give examples on this have read this. tutorial may you: http://viralpatel.net/blogs/angularjs-service-factory-tutorial/

r - Why do I need to use mode = wb with download.file() for this .rds file? -

i getting hung on shiny apps tutorial lesson 5 because unable open counties.rds file. readrds() threw: error reading connection . i figured out open .rds fine if downloaded download.file(url, dest, mode = "wb") or used browser download file local directory. outstanding question: why counties.rds file not open if use download.file() without setting mode = "wb" ? expect answer obvious like: "duh, counties.rds binary file." however, before try answer own question, i'd confirmation more experience. repro steps: download.file("http://shiny.rstudio.com/tutorial/lesson5/census-app/data/counties.rds", "counties.rds") counties <- readrds("counties.rds") error in readrds("counties.rds") : error reading connection resolution: download via browser or use binary mode ( wb ). download.file("http://shiny.rstudio.com/tutorial/lesson5/census-app/data/counties.rds",

wget - download an article using DOI in R -

i have doi article, wondering if there r functions can download pdf file based on doi without user having download pdf manually ? you can use httr see doi points constructing url doi.org , getting headers: library(httr) headers = head("http://doi.org/10.7150/ijms.11309") headers$url # [1] "http://www.medsci.org/v12p0264.htm" in case, pdf seems @ same location page, .pdf extension. not true journals. so journal, pdf at: sub(".htm$",".pdf",headers$url) # [1] "http://www.medsci.org/v12p0264.pdf" so can do: download.file(sub(".htm$",".pdf",headers$url),"paper.pdf") to pdf.

c - Why does popt segfault when a string is too short? -

why popt segfaulting when argdescrip string isn't long enough? take following example: #include <popt.h> struct poptoption options[] = { popt_autohelp { .longname = "color", .shortname = '\0', .arginfo = popt_arg_string | popt_argflag_optional | popt_argflag_show_default, .arg = (void*) "auto", .val = 1, .descrip = "whether or not use colored output", .argdescrip = "always|never|auto (checks if tty)" }, popt_tableend }; int main(int argc, const char** argv) { // popt context poptcontext ctx = poptgetcontext( "program", argc, argv, options, popt_context_posixmeharder); // parse poptgetnextopt(ctx); return 0; } the above segfaults: /tmp$ ./a.out --help usage: a.out [option...] [1] 47468 segmentation fault ./a.out --help although changing .argdescrip to .argdescrip = "always|never|auto (check

string - What does %c character formatting do in Python and it's use? -

going through string formatting operations can't wrap head %c operation , use. learn python hard way, gave following example makes little sense without proper context. "%c" % 34 == '"' here link if wants check out: http://learnpythonthehardway.org/book/ex37.html it gives character represented ascii code "34". if ascii table notice 34 = "

Unable to locate Spring NamespaceHandler for XML schema namespace Persistence.xml -

exception in thread "main" org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [ http://java.sun.com/xml/ns/persistence] i error when trying run app, persistence.xml any idea might have gone wrong? <?xml version="1.0" encoding="utf-8" standalone="no"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="persistenceunit" transaction-type="resource_local"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <!-- <properties> --> <!-- <property name="hibernate.dialect" va

c# - Not able to export russian or turkish characters to csv from asp.net mvc -

i exporting data csv asp.net mvc controller using file method below. works fine english,french not working other languages likes russian,turkish. thoughts or helpful. var bytes = encoding.unicode.getbytes(csv); var finaldata = new system.text.unicodeencoding().getpreamble() .concat(bytes).toarray(); actionresult result = this.file(finaldata, "text/x-csv", filename); i think has encoding, try this: encoding iso = encoding.getencoding("iso-8859-1").getbytes(); in combination resource: https://www.terena.org/activities/multiling/ml-docs/iso-8859.html

java - What is wrong with my if-else syntax? -

Image
currently new java, , right i'm doing assignment involving if else statements. can please why javac reading else dangling? syntax should right unless missing here. you have remove semicolon after if-statement. otherwise braces after if not executed. i hope fix problem. if(statement); { //the content not executed in realtion if-statemen } otherwise: if(statement) { //the content executed in realtion if-statemen }

angularjs - Trigger onChange event of Kendo Editor widget -

suppose have following kendo-editor: <div kendo-editor ng-model="name" k-options="editoroptions"></div> then, have following editoroptions : function onchange(e) { alert("i changing."); } $scope.editoroptions = { change: onchange }; how can access actual kendo-editor object me trigger onchange event without using normal jquery selection: example: $("#myeditor").kendoeditor().trigger("change") you must define control reference in current scope ( http://docs.telerik.com/kendo-ui/angularjs/introduction#getting-widget-references ) , can define events attribute: <div ng-app="app" ng-controller="myctrl"> <div kendo-editor="kendoeditorcontrol" ng-model="name" k-options="editoroptions" k-on-change="onchange()"></div> </div> <script> angular.module("app", [ "kendo.directives" ]).controller(&quo

oracle 11g connectivity with java -

i've oracle[11g] database on remote server(on lan). how configure oracle jdbc drivers how connect database. i've tried lot of code samples nothing worked. want read data table , put access(.accdb) file. regards try { class.forname("oracle.jdbc.driver.oracledriver"); system.out.println("oracle drivers loaded"); string dburl="jdbc:oracle:thin:@[ip goes here]:xe"; string user="reportuser"; string pwd="report"; connection conn=null; conn=drivermanager.getconnection(dburl,user, pwd); statement stmt=conn.createstatement(); } catch(classnotfoundexception e){ system.out.println("there error in connection "+e); } the question generic on scenario on how connecting database. if using eclipse java development can configure jpa in project , define url(your lan machine ip db running) user name , password. set jar in path. if not using eclipse open od

cordova - How to Display PDF File with in the same App in phonegap -

how show pdf file in same phonegap app. tried inappbrowser,mupdf,pdfjs displaying pdf using other pdf viewer.i open pdf file in same app.can me out.thanks in advance (excuse poor english) don't know mean "in same app", because inappbrowser , mupdf , pdf.js can that. in android platform, popular solution send intent , open via other pdf viewers because users can choose there favorite(you can try file opener 2 ). if don't that, can build activity displaying pdf in app, mupdf viewer . if want open pdf file in cordova/phonegap webview, need mozilla's pdf.js , that's pure-js lib rendering pdf file on html5 canvas, pretty slower using native solution (even build crosswalk ), dont suggest that. it's easier in ios platforms. ios's uiwebview can open pdf files natively, need using inappbrowser plugin . if want more features, there're many plugins (like cordova pdfreader ios ) can choose. hope helps you.

wordpress - how to exclude out of stock product by size by using yith ajax navigation filter woocommerce? -

i using yith ajax navigation filter woocomerce store. here problem arise. product size different 6,7,8,9,10. , have put quantity different size. problem when product "out of stock" in size although product show when filter. suppose product size 10 out of stock show when filter size 10. have set woocommere "hide out of stock" , recount terms , clear transient. not working. please help.

hadoop - Hive Updates Efficiency (Version 0.14) -

how can hive efficiently handle updates on columns not partitioned? suppose want update row specific transactionid (not partitioned), how hive handle internally. understand hive first search (which slow) , update particular partition (if any) particular row containing transactionid stored. though provided abstraction user update data efficient perform lot of updates ? row level updates may not efficient in hadoop hadoop designed large data processing. hive version 0.14 supports row level updates on hive tables support acid. check hive tutorial further details on how implement row level updates. https://cwiki.apache.org/confluence/display/hive/languagemanual+dml#languagemanualdml-update

How to deal with decimal number in scala -

i have file this: 1 4.146846 2 3.201141 3 3.016736 4 2.729412 i want use todouble but, it's not working expected : val rows = textfile.map { line => val fields = line.split("[^\\d]+") ((fields(0),fields(1).todouble)) } val num = rows.sortby(- _._2).map{case (user , num) => num}.collect.mkstring("::") println(num) the result print out 4.0::3.0::3.0::2.0 . expect 4.146846::3.201141::3.016736::2.729412 how do this? your regular expression stopping @ decimal point in 4.146846 . try line.split("[^\\d.]+")

testing - IntelliJ - rerunning part of a testcase -

let's have testcase testsomething testa testb testc ... if run "testsomething", "testa", "testb", ... run in sequential order. unfortunately, that's falsifying statistics (time run each individual test) due caching. if select single testcase, say, "testb" , re-run one, lose information other tests result "testsomething"-run thrown away , "testb" displayed. there way prevent happening? i.e. keep displayed , update results "testb"? no, there no way update results of single test in test tree. can pin entire tab results of executing testsomething (right-click on tab header , select "pin tab" context menu) , run testb again - results displayed in separate tab , you'll still have access results of testsomething .

sql - Basic counting queries -

i have 2 tables class , grade . this sample rows in class table: c_name....c_time...f_name..c_room...semester inss300...m5:30....dwight..219bc....fall11 inss300...t5:30....keen....216bc....fall11 mkt300....m5:30....lee.....112bc....sp11 mkt300....w5:30....lee.....112bc....sp11 inss421...t5:30....cory....212bc....fall11 fin300....th5:30...keen....219bc....fall11 inss300...w5:30....cory....219bc....fall11 inss300...f5:30....cory....216bc....fall11 inss422...f5:30....keen....219bc....fall11 and sample data in grade table s_name c_name g larry....inss300....b larry....fin300.....a sony.....inss300....c sony.....inss421....c gray.....inss300....c gray.....inss421....d trudy....inss300....b drum.....inss421....a drum.....fin300.....b puri.....inss422....c apple....inss422....c larry....inss422....c larry....inss300....b sony.....inss300....c gray.....inss300....c trudy....inss300....b my question have answer is: assume these tables in account ordb002. need give re

winapi - C++ Read PE Optional Headers to determine DEP and ASLR -

i wish parse pe file , read optional headers it, , other data enables me know if 32bit pe or 64 bit. know imagehlp , dbghlp header files give me structures such image_optional_header . not sure how parse file yield these. can use documentation , write own parser using offsets, if knows correct api parse pe? my objective : 1) determine if file x64 or x86 executable. in header?? 2) check aslr, dep , safeseh. first 2 think in pe optional headers. so there api parse pe , return me these structures? you should take @ image helper library. there method mapandload give pointer various parts of pe file ( loaded_image structure ), i.e. image_nt_headers , image_section_header . image_nt_headers structure contains pointer image_optional_header structure . the field dllcharacteristic contains various flags image_dllcharacteristics_nx_compat or image_dllcharacteristics_no_seh example. to use these api include imagehlp.h , link imagehlp.lib.