Posts

Showing posts from August, 2014

multithreading - Accepting Multiple Clients in Java TCP and make each client wait for 5 minutes -

i trying make tcp server in java accepts 10 clients, each client should treated on thread no clients waiting. each thread receive client , make him wait 5 minutes. here's far code; public class threadserver { static class serverthread implements runnable { socket client = null; public serverthread(socket c) { this.client = c; } public void run() { try { system.out.println("connected client : "+client.getinetaddress().gethostname()); client.close(); } catch (exception e) { system.err.println(e.getmessage()); } } } public static void main(string args[]) { try { serversocket server = new serversocket(8787); while (true) { socket p = server.accept(); new thread(new serverthread(p)).start(); } } catch (exception ex) { system.err.println("error : " + ex.getmessage()); } } } this can solved scheduledexecutorservice this: public class respo

javascript - Old input-text-values in div when using innerHTML -

i have javascript/innerhtml-problem. make easier understand have written code: <div id="testdiv_from"> <input type="text" id="text1" value="13"/> </div> <div id="testdiv_to"> </div> <input type="button" onclick="save();"/> <script> function save() { document.getelementbyid("testdiv_to").innerhtml = document.getelementbyid("testdiv_from").innerhtml; } </script> i want copy content in testdiv_from testdiv_to . but: if change value on input text-element 13 14, new value doesn't want "accompany". do have ideas how transfer new input-text-values , not old ones inside div layer? wrong use innerhtml? http://jsfiddle.net/r8z55/ if @ input element in developer tools, see input element wrapper of hidden div element, when change value of input element, changes value of hidden div element, , not attribute. if want copy co

database - Error in Removing a file in python -

i trying write program elementary database management. the code provided below: class emp(): def __init__(self,**kwds): self.__dict__.update(kwds) e=emp() try: fp=open('c:/emp.txt','rb+') # open file reading except: try: fp=open('c:/emp.txt','wb+') # open file writing except: print 'cannot open file' while 1: print "1.add records" print "2.list records" print "3.modify records" print "4.delete records" print "0.exit" print "your choice" choice=eval(raw_input()) def add(): import os fp.seek(0,os.seek_end) another='y' while another=='y': print "\nenter name,age , basic salary:" e.name=raw_input() e.age=eval(raw_input()) e.bs=eval(raw_input())

Replace bibtex or latex {\dg} string command in java -

i want write parser bibtex file. in bibtex-file there string booktitle = {wohnen - pflege - teilhabe {\dq}besser leben durch technik{\dq}} . anyway, using junit-tests , method should detect , replace {\dg} ' or " . unfortunately not able write corresponding java code, example following code did not detect substring? inproceedingscitation1 += " booktitle = {wohnen - pflege - teilhabe {\\dq}besser leben durch technik{\\dq}},\n"; corresponding part of replace-method: string afterdg = ""; charsequence targetdg = "{\\dg}"; charsequence replacementdg = "\""; afterdg = afterae.replace(targetdg, replacementdg); this regular expression should solve problem: string afterdg = afterae.replaceall("\\{\\\\dq\\}", "\""); for more details according regular expressions, have @ vogellas java regex tutorial .

Get a 'clear' error message in Lua -

i using error function in quite few of functions , propagate error messages user. however, don't want include information where error occured exactly; information should go log files. for example, have class manages connection server. if connection times out, calls error("connection timed out!") the error message caught calling code via pcall . however, message contains not message passed, name of file caused error , line number: common/net/enetclient.lua:21: connection timed out! the question is: there way retrieve error message itself, or have manually following: local status, msg = pcall(somefunctionthatthrowserrors) if not status local file, msg = msg:match("(.-:%d+): (.+)") print("error: " .. msg) end cheers, from documentation of error function : error (message [, level]) terminates last protected function called , returns message error message. function error never returns. usually, error

python - Adding new objects in a list, all the objects look like the last one -

this question has answer here: how avoid having class data shared among instances? 7 answers i'm making first program in python. need add objects list, , create these objects inside loop. problem is, after filling list, if check value of object, last object added. class clsnumeros: numero = 4 oper = [int() in range(5)] def __init__(self, op1, op2, op3, op4): self.oper[1] = op1 self.oper[2] = op2 self.oper[3] = op3 self.oper[4] = op4 def countoperaciones(): return 5 def getvaloroper(self, idxoper): num = self.oper[idxoper] if num == 1: return num elif num == 2: return sqrt(num) elif num == 3: return factorial(num) elif num == 4: return 4/10 elif num == 5: return sqrt(0.4) def getexproper

mysql - I want to display an error if the employee had an account already -

here code: rs.open("select * tbl_emp_security emp_id='" & empid_account.text & "'", con) if empid_account.text = lvempaccount.items(rs(0).value) msgbox("this employee have existing account") else user_account.text = "emp" & lname_account.text passrandom() end if is if employee try add account , if had already... messagebox appear if none. proceeds next line.. empid_accout.text textbox comparing first item on table. lvempaccount.tems(rs(0),value) item on 1st column employee id on table i rewrite code follows hope helps dim outds new dataset outds = ("select * tbl_emp_security emp_id='" & empid_account.text & "'", con) if outds isnot nothing andalso outds.table.rows.count > 0 msgbox("this employee have existing account") else user_account.text = "emp" &am

javascript - How to set unchecked checkbox 1 When checkbox 2 was checked and set unchecked checkbox 2 When checkbox 1 was checked using script? -

how set unchecked checkbox 1 when checkbox 2 checked , set unchecked checkbox 2 when checkbox 1 checked ( make checkbox working radio button. ) <input type="checkbox" id="checkbox1" name="checkbox1" value="checkbox1"/> checkbox 1 <br> <input type="checkbox" id="checkbox2" name="checkbox2" value="checkbox2"/> checkbox2 <script type="text/javascript"> document.getelementbyid('checkbox1').onchange = function() { document.getelementbyid('checkbox2').unchecked = this.checked; }; </script> <script type="text/javascript"> document.getelementbyid('checkbox2').onchange = function() { document.getelementbyid('checkbox1').unchecked = this.checked; }; </script> you need use .checked , not unchecked , set property false document.getelementbyid('checkbox2').checked = false; fiddle

mysql - Magento 1.8 & Amazon RDS Lock wait timeouts -

firstly isn't duplicate of this question because i'm not behind load balancer @ moment. randomly restarting instance isn't satisfactory solution either. i moved our store using local mysql db on ec2 rds , we're getting errors on backend when they're moving categories around / adding products. sqlstate[hy000]: general error: 1205 lock wait timeout exceeded; try restarting transaction i've seen other variations of pdo errors. how 1 go eliminating these issues? i've read suggestions 'keep retrying' seems stupid. i've tried tinkering innodb_lock_wait_timeout , others doesn't seem resolve it. i have disabled magento logging db - see if helps going forward. unfortunately have wait while let staff tinker on backend , see if fix has effect. thanks update now seeing bunch of these user error: ddl statements not allowed in transactions

Php array modulo every second value -

i have question. have array of alphabet. , every letter needs !$letter, needs echo out !b, !d, !f i'm unsure how this. i've been told use modulo, % this. but reading lot on internet , things haven't gotten clearer me. i appreciate can me on matter! in advance! foreach ($alphabet $i => $letter) { echo (($i % 2) == 1 ? '!' : '') . $letter; } $i position of letter in array; since array indexes start 0, letters have odd indexes. $i % 2 0 when $i even, 1 when it's odd. grade school arithmetic, should prerequisite programming career.

java - Cannot export Interface in OSGI -

i trying export interface (itestrunable) sure have linked correctly in context.xml , osgi.xml files wont work. error is: application context initialization 'me.overlaymanagement' has timed out waiting (objectclass=me.overlaymanagement.testing.itestrunable) any got idea? code: spring files itestrunable context.xml <bean id="testingrunable" class="me.overlaymanagement.testing.testing" init-method="startup" destroy-method="shutdown"> </bean> osgi.xml <osgi:service id="testingrunable" ref="testingrunable"> <osgi:interfaces> <value>me.overlaymanagement.testing.itestrunable</value> </osgi:interfaces> </osgi:service> spring files import main system context.xml <bean id="overlaymanagementsystem" class="me.overlaymanagementsystem.overlaymanagementsystem" init-method="startup" destroy-method=&quo

javascript - Appcelerator / Titanium Alloy - how to manipulate a string before it gets added to the view -

i have titanium alloy view, outputs tableview image thumbnail each one. achieved passing url image attribute of imageview element. alloy view populated alloy collection, handles looping of data me: <tableview id="brandslist" datacollection="brands"> <tableviewrow brandid="{brand_id}"> <view class="vgroup"> <imageview height="45" width="80" id="image" image="{image}" /> <label id="name" text="{name}" /> </view> </tableviewrow> </tableview> however, i'd change url string bit before gets view above. specially need add values in middle of url change image quality , size. how can catch string string value , make changes? from looks of code appears doing data-binding. can transform data before presented in view http://docs.appcelerator.com/titanium/latest/#

mysql - SQL get the latest records from a set of data -

so have table of holdings each holding has date column. e.g. id | holding_name | value | holding_date ---------------------------------------------------- 1 | ishares msci | 2032 | 2013-12-31 2 | vanguard bonds | 5332 | 2013-12-31 3 | ishares msci | 2241 | 2014-01-31 4 | vanguard bonds | 6236 | 2014-01-31 if wanted select latest holdings go select * holdings holdings.holding_date = '2014-01-31' but if don't know latest date 2014-01-31? there way build query? select * holdings holding_date = (select max(holding_date) holdings)

c# - How do I remove the back color or a tab control? -

Image
i tried putting color each of tab pages - space buttons of tab control still takes default color. you make window smaller overall, width of list of tabs. although i'm not sure if can sacrifice space. other that, i'm not sure if can default windows controls. try looking infragistics, adds on default windows controls own.

Python file copying using regex -

i have large log file. want extract lines containing java/javax/or/com followed ./: . every line this, want extract of corresponding lines stack traces , starts at . example: line1: java.line.something.somethingexception line 2: @ something line 3: @ something line 4: @ something line 5-20:junk don't want extract. line 21: javax.line.something.somethingexception line 22: @ something line 23: @ something line 24: @ something and on... here want copy line 1-4 , again line 21-24. far code collects line contains keywords i'm unable figure out how write specific no of lines after that, skip few lines , start writing again.these lines starts @ random, i.e can 100 lines or can 250 lines, no pattern. here's code: import re import sys itertools import islice file = open(sys.argv[1], "r") file1 = open(sys.argv[2],"w") = 0 line in file: if re.search(r'[java|javax|org|com]+?[\.|:]+?', line, re.i) , not (re.search(r'at\s', line, r

mysql - Trying to select from database specific column value using php -

i have database want value from. have website i'm allowing user create new username based on first name, last name, selected username, , password. have working except checking duplicate usernames. have tried following code returns 500 error. $usernamequery = mysqli_query("select * users username = $username"); if(!empty($usernamequery){ $usernameerror = "username exists, try again"; $dontsubmit = true; } i've been racking brain on couple of days now. appreciated. :) try this, have missed close bracket in ) if condition if(!empty($usernamequery)){ instead of if(!empty($usernamequery){

r - Find month from week numbers using lubridate -

i have list of dates: library(lubridate) my.dates = ymd(c("2013-12-14", "2014-01-18", "2014-01-27", "2013-12-13", "2013-12-29", "2013-12-06")) the following lubridate::week functions outputs numeric vector when convert these dates week numbers: week(my.dates) [1] 50 3 4 50 52 49 can lubridate output date ("posixct" "posixt") object converts my.dates week number , year number. output should date object (not character or numeric vector) formatted this: [1] "50-2013" "3-2014" "4-2014" "50-2013" "52-2013" "49-2013" i'm interested in solution uses lubridate . in response comments question, question has changed number of times @ moment requested input my.dates , output of form week-year (and not described in subject of question). to convert my.dates week-year format try following week , year lubridate functions:

c# - Sitecore sorting by created date issue -

i having trouble figuring out how can sort list of items in descending order according created date (i know sitecore allows sorting items in ascending order created date). i'm still pretty new sitecore, i'm not sure do...any suggestions helpful! item[] blogposts = homeitem.axes.selectitems(@"child::*[@@templatename='blogcomment']"); if (blogposts != null) { dataset ds = new dataset(); datatable posts = ds.tables.add("posts"); posts.columns.add("postname", type.gettype("system.string")); posts.columns.add("datecreated", type.gettype("system.string")); posts.columns.add("postcomment", type.gettype("system.string")); foreach(item postitem in blogposts) { datarow dr = posts.newrow(); dr["postname"] =

c - Is it a given or an assumption that all POSIX/SUS signals are a #define? -

signals differ between implementation. there nice tables in apue (advanced programming in unix environment), such "figure 10.1 unix system signals" on page 292 of 2nd edition. so let's take exemplary sigwaiting . signals appear in documentation int , implementations seem use #define instead of const int . however, standard stipulate anywhere 1 can rely on signals being #define d? or can assume based on fact that, say, virtually every existing implementation uses #define . or bad assumption altogether? the rationale this: if can rely on #define being used, can use #ifdef hide more exotic signals implementations don't use it. const int constant names not aware of similar mechanism allow compile time decision made. see posix (2008, 2013) specification <signal.h> . in part, says: the <signal.h> header shall define following macros used refer signals occur in system. signals defined here begin letters sig followed uppercase letter.

python - Django south illogical error -

so using south django project, , have been changing model logic. changed bunch of things, regardless, model looks now : class group(models.model): '''table of organizational groups''' group_id = models.autofield(primary_key=true) group_name = models.charfield(max_length=100,unique=true) #name of group string icon_path_clicked = models.charfield(blank=true,max_length=255) #location icon stored icon_path_unclicked = models.charfield(blank=true,max_length=255) #location icon stored group_description = models.charfield(max_length=255) #description of group is_active = models.booleanfield(default=true) date_created = models.datetimefield(auto_now_add=true) now previously, both icon_path_clicked , icon_path_unclicked had unique=true , took out, yet when try , migrate, following error: django.db.utils.integrityerror: not create unique index "everything_group_icon_path_clicked_key" detail: key (icon_path_clicked)=(

sql - Querying all data from multiple tables -

so have 3 tables...structured so a location table locationid locationname 1 location 1 2 location 2 3 location 3 a sub area table subareaid locationid subareaname 1 1 subname1 2 1 subname2 3 2 subname3 4 2 subname4 and details table subareaid locationid username 1 1 bob 2 1 frank 3 2 jeff null 3 dave every location can have sub area every sub area can have details every sub area must have location every details can have sub area every details must have location ideally, result follows. how structure query? location name sub area name username location 1 subname1 bob location 1 subname2 frank location 2 subname3

Call JavaScript from window to another in Adobe AIR -

in adobe air application hide initial window , create window loads in separate html file. possible call function in 1 window exists inside another? i have read examples such as: possible call javascript method in context of window? but i'm using native windows , not html windows don't think it'll work. any ideas? the structure like: `file1.html` function dosomething() { } so want call dosomething function inside file1 file2 `file2.html` dosomething();

Linked List and Double Linked List -

as part of university work need understand linked list code have been given. having problems insert method-the part deals general case-as code below: //in general case, need chain down linked list //from head until find location new //list node. if reach end of list before finding //the specified location, know given index out //of range , throw exception. else { node nodepointer = listhead; int = 1; while (i < index) { nodepointer = nodepointer.next; += 1; if (nodepointer == null) { throw new sequencelistexception("indexed element out of range"); } } //now we've found node before position of //new one, 'hook in' new node. nodepointer.next = new node(o, nodepointer.next); the problem having can see method inserts node , makes point next node, node replaced. far can see there has been no change node replaced, meaning there 2 nodes pointing same next.

xslt - WSO2 : Which Message Transformation Mediator? -

i have scenario message transformation in esb. want know message transformation mediator (xslt, enrich, payload factory) suitable , common each of these scenario? 1- changing data type of 1 or more field of message 2- deleting 1 or more field of message 3- adding 1 or more new field message 4- changing name of 1 or more field of message 5- changing order of message's fields thanks in advance. the xslt mediator provides lot of flexibility on transforming messages on other mediators. so, can using xslt mediator. see, can achieve scenarios 2-5 using payload mediator quite easily. i'm not sure meant in first scenario though.

Favicon won't load, even when going to the direct URL -

the favicon isn't working on site. if go google.com/favicon.ico see image displayed. reason on site, lucasjohnson.co.uk/favicon.ico prompts me download file. have tried replacing own favicon google's, still have same problem. edit: file ico file converted png using dynamic drive's favicon generator. i checked http://www.lucasjohnson.co.uk/favicon.ico , , response content-type text/plain . there several content types can used favicon, text/plain not 1 of them. the common ones image/x-icon , image/vnd.microsoft.icon . so basically, choose 1 of following content types , add link tag: <link rel="icon" type="image/vnd.microsoft.icon" href="http://www.lucasjohnson.co.uk/favicon.ico" /> <link rel="icon" type="image/png" href="http://www.lucasjohnson.co.uk/favicon.ico" /> <link rel="icon" type="image/gif" href="http://www.lucasjoh

r - Add selection crteria to read.table -

let's take following simplified version of dataset import using read.table : a<-as.data.frame(c("m","m","f","f","f")) b<-as.data.frame(c(25,22,33,17,18)) df<-cbind(a,b) colnames(df)<-c("sex","age") in reality dataset extremely large , i'm interested in small proportion of data i.e. data concerning females aged 18 or under. in example above last 2 observations. my question is, can import these observations without importing rest of data using subset refine database. computer's capacities limited , have been using scan import data in chunks extremely time consuming. is there better solution? some approaches might work: 1 - use packages ff can ram issues. 2 - use other tools/languages clean data before load r. 3 - if file not big (i.e., can load without crashing), save .rdata file , read file (instead of calling read.table): # save each txt file once... save.rda

html - Mobile email ignoring max-width CSS -

i'm trying build html email works on mobile devices, when use max-width css property define width of main table element, ios , android both ignore , stretch entire email out fit default widths. breaks design. here code: <html> <head> <title>html email</title> </head> <body yahoo bgcolor="#ffffff" style="margin: 0; padding: 0; min-width: 100%!important;"> <table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff"> <tr> <td align="center"> <table class="content" cellpadding="0" cellspacing="0" border="0" style="width:100%; max-width: 550px;"> <tr> <td>my content</td> </tr> </table> </td> </tr> </table> </td> </tr&

c# - my login is always successful, whether it is correct/wrong username or password -

the login form using patient table login. whether type in correct or wrong username/password redirect me home page index.aspx means sucessful. below code, select patientid because store patientid in session. problem : need understand valu types never hold null . checking id against null retur true hence able login system in conditions. solution : should have mechanism can identify actual value of executescalar() . return null if incase there no records.but wont converted int null should first check null against executescalar() retur value , if not null convert integer otherwise assign zero. try this: int id =(cmd.executescalar()!=null)?convert.toint32(cmd.executescalar()):0; if (id > 0) { session.add("id", id); session.add("pusername", txtusername.text); session.add("ppassword", txtpassword.text); formsauthentication.setauthcookie(txtusername.text, true);

javascript - JSON parsing not working in jQuery -

i have text field id search_json on form contains: {"standard_id":"2","attribute1":["","stan"],"attribute2":[""],"attribute3":["","air force"],"attribute4":["","bob"],"selected_index":3} upon event, call button click, want to: 1) read in json , parse object: search_json = $.parsejson($("#search_json").val()) 2) remove "attribute1" object delete search_json["attribute1"] 3) write json out text field: $("#search_json").val(json.stringify(search_json)) i'm kind of surprised it's not working, though. delete call nothing. matter of fact, search_json.hasownproperty("attribute1") returns false . , yet can log object console , indeed object values. going wrong here? update: actually, search_json.hasownproperty("attribute1") does work. but, if attribute nam

c# - Populating dropdown list after selecting a value from another dropdown list -

i want able populate dropdown list(ddlexercise) after selecting value dropdown list(ddltype) @ moment getting values ddltype dropdown sql query populating dropdown list when select something, 2nd dropdown list remains empty. have 3 values in ddltype dropdown(gym,core,cardio) , once select 1 of these, using dropdownlist.selectedvalue retrieve corresponding results. here code: protected void page_load(object sender, eventargs e) { sqlconnection con = new sqlconnection(@"con string"); if (!ispostback) { bindexercisetype(); } } public void bindexercisetype() { con.open(); sqlcommand cmd = new sqlcommand("select exercisetype exercisetype", con); sqldatareader dr = cmd.executereader(); ddltype.datasource = dr; ddltype.items.clear(); ddltype.items.add("--please select country--"); ddltype.datatextfield = "exercisetype"; ddltype.datavalue

shell - Newsyslog is not automatically rolling over my log files -

i have configured log in newsyslog.conf in following way: /var/log/test.log 644 10 10 * z /var/run/parser.pid 31 and understanding man newsyslog.conf 4th field size @ roll on file in kilobytes. though size of file crosses doesn't seem roll on automatically. however if manually run /etc/rc.d/newsyslog restart the roll on seems happen without pid not getting signalled. i'm confused - what's happening here? why roll on happen when restart newsyslog not automatically - missing here? , why restart triggered roll on not signalling pid? i'm using freebsd, , newsyslog configuration in custom file within /etc/newsyslog.d/ directory.

Cassandra not picking up log4j-server.properties file -

i starting cassandra instance own start script sets cassandra_conf directory (which outside of cassandra_home directory). export cassandra_conf=/path/to/conf cassandra -f -dcassandra.config=file://path/to/yaml when process begins, noticed logs not respecting log4j-server.properties file. after further investigation, seems though log4j-server.properties file not being picked though reference appears in command line arguments generated cassandra: -dlog4j.configuration=log4j-server.properties in script, output contents of log4j-server.properties file make sure @ least reading right place , was. there configuration option i'm missing makes cassandra read log4j-server.properties file? which version running? if you're running 2.1+ (which not stable build), there has been switch log4j logback, , old configuration files no longer affect anything. logback configured through xml files, , argument you'd have use -dlogback.configurationfile=logback.xml more d

Getting a book on C and C++ for Xcode -

i live in canada, , have been learning make apps ios in xcode 5 month now, off scraps internet. wondering if recommend , easy learn book xcode (like c , c++ (i know c++ hard) available in canada. cocoa , objective-c: , running that's book i've read. it's available in canada among other countries.

ios - How to detect a flick gesture using UISwipeGestureRecognizer? -

i heard uiswipegesturerecognizer can used distinguish between slow swipe , fast flick. can't find api tell difference. do need use uiswipegesturerecognizer , or can use uipangesturerecognizer instead? uipangesturerecognizer gives precise movement data whereas uiswipegesturerecognizer more basic , detects whether or not swipe happened (and in direction). uipangesturerecognizer has -velocityinview: method returns cgpoint, expressing points per second, vertically , horizontally.

corona - base32 encode in Lua -

trying find way base32 encoding in lua, corona sdk. i have found library: https://github.com/b4ldr/nselib/blob/master/base32.lua but seems require "bin" library not come corona sdk , not able find in anywhere on web. so, know how fix "bin" dependancy or base32 lib works corona sdk? the basexx library supports base32 encoding , decoding, , not have dependencies.

windows - SetThreadExecutionState preventing manual sleep -

on windows 7, i'm seeing call setthreadexecutionstate parameter es_continuous | es_system_required | es_awaymode_required preventing user manually putting system sleep. upon opening start menu , selecting 'sleep,' display turns off, application continues processing. evident fact fan continues @ full speed , upon waking computer, can see operations being carried out when sleep occurred have progressed. how can allow user manually put computer sleep while setthreadexecutionstate in effect? inclusion of es_awaymode_required option causes problem. quoting msdn article: the es_awaymode_required value should used when absolutely necessary media applications require system perform background tasks such recording television content or streaming media other devices while system appears sleeping. applications not require critical background processing or run on portable computers should not enable away mode because prevents system conserving power entering t

Android Expanding a single ListView Item -

i have list view 3 buttons it. functionality of button when clicked single view should expand in height show text box. havent done code in customadapter of listview provide reference it. what described expandablelistview . edit : also, can have textview's visibility set "gone" , become visible when button clicked.

Trying to get a property set based on a combobox selection in access 2010 -

i thought had figured out i'm trying set value of field in form based off of 2 combobox selections. first few tested worked out ok when added more stopped getting results. snippet of code far: if (product_select = "krystar 20kg") if (batch_number_select = "batch 1") docmd.setproperty "text5", , "60" elseif (batch_number_select = "batch 2") docmd.setproperty "text5", , "61" elseif (batch_number_select = "batch 3") docmd.setproperty "text5", , "62" elseif (batch_number_select = "batch 4") docmd.setproperty "text5", , "63" elseif (batch_number_select = "batch 5") docmd.setproperty "text5", , "64" end if end if anyone see wrong? syntax looks eyes. i don't use docmd.setproperty , had up. default value second parameter acpropertyenabled , wherea

eigenvector - Eigen Values and Eigen Vectors Matlab -

i have matrix a a = [ 124.6,95.3,42.7 ; 95.3,55.33,2.74 ; 42.7,2.74,33.33 ] the eigenvalues , vectors: [v,d] = eig(a) how show eigenvalues mutually perpendicular? i've tried if dot product of eigenvalues zero, demonstrates mutually perpendicular, how compute in matlab? tried following code transpose(diag(d)) * diag(d) %gives 4.1523e+04 also, how can verify definition of eigenvalues , vector holds: a e_i - l_i e_i = 0 the above equation: equal 1 3. real, symmetric matrix eigenvales positive numbers , eigenvectors basis matrix i tried following code, doesn't seem give me 0. ideas? a*v(1) - d(1)*v(1) to show orthogonality >> v'*v-eye(size(v)) ans = 1.0e-15 * 0.2220 0.1110 0.2498 0.1110 -0.4441 0.1388 0.2498 0.1388 0.4441 to show definition of eigendecomposition satisfied, >> a*v - v*d ans = 1.0e-13 * 0.4086 0.0400 0.8527 0.3908 0.0355 0.5684 0.1954 0.0355

c++ - Dynamic Integer Size: int64_t, int32_t, uint32_t, etc -

i programming app allows user select bit-size of integer storage , math it. can select 8, 16, 32, or 64 bit storage signed or unsigned. set , changed @ runtime, , app math given type. user interaction example: enter 16 bit mode type 5c press plus type 2a press evaluate return { value1.getsigned16() + value2.getsigned16(); } i avoid programming 8 cases each operator. figure pointer or function-pointer might work this. evaluate method doesn't care size of integer i'm using long both same. problem can't figure out how implement this, pointers care kind of variable returned. considered using generic pointer doesn't me when need dereference, still need 8 cases. value1.getpropersize() + value2.getpropersize(); // * won't work int* getpropersize() { if (size == 16) return (int16_t)storagevalue; if (size == 32) return (int32_t)storagevalue; // etc... } any thoughts or suggestions on attacking problem appreciated. you cannot have &

java - inserting values in to SqlLite database. Android -

i learning android development through video tutorials. using idea in tutorial. have created own class, database handler (dbhandler.java) file , (kovil.java) file. these files working perfectly. my aim add values database table. once main activity (mainactivity.java) loads. want know how add values table in mainactivity.java file on create event code. can 1 me. thank you.. here codes.. dbhandler.java file package lk.adspace.jaffnadb; import java.util.arraylist; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; public class dbhandler extends sqliteopenhelper { private static final int database_version = 1; // database name private static final string database_name = "jaffnatemplete

python - Howto 16bit left logical shift all ip addresses in CSV file (octets 3&4 become 1&2) -

i'd 16 bit logical left shift on ip address in csv file (thosands of rows) example (octets 3&4 become 1&2) 172.22.200.5 -> 200.5.0.0 (octect #1 [172] , octect #2 [22] shifted away) 10.1.1.0 -> 1.0.0.0 (octect #1 [10] , octect #2 [1] shifted away) each row have ip address in field #4 , #5 2014-01-24 12:10:39.760,760,0.000, 10.1.40.27,10.1.40.2 ,17,40424,514,502000,2000,......,0 before 2014-01-24 12:10:39.760,760,0.000,10.1.40.27,10.1.40.2,17,40424,514,502000,2000,......,0 2014-01-24 12:12:07.760,760,0.000,172.14.40.37,1.127.40.2,17,57278,514,558000,2000,......,0 2014-01-24 12:12:42.760,760,0.000,10.1.40.250,10.1.40.2,17,42347,514,500000,2000,......,0 2014-01-24 12:12:07.760,760,0.000,1.168.40.37,192.13.40.2,17,57278,514,558000,2000,......,0 after 2014-01-24 12:10:39.760,760,0.000,40.27.0.0,40.2.0.0,17,40424,514,502000,2000,......,0 2014-01-24 12:12:07.760,760,0.000,40.37.0.0,40.2.0.0,17,57278,514,558000,2000,......,0 2014-01-24 12:12:4

c# - I want to open a text file in notepad using text in a richtextbox -

i have app lists text files in combo box. user can select file add strings list search selected file these strings. line found search criteria copied richtextbox. looking able click text , open selected file in notepad @ location clicked in rtb. something this: void startinnotepad(string filename) { process notepad = new process(); notepad.startinfo.filename = "notepad.exe"; notepad.startinfo.arguments = filename; notepad.start(); }

android - Algorithm to space/filter Google Maps Markers for readability? -

in android app plot airports on google maps. when zoomed out far, density gets high. i'm familiar marker clustering libraries, rather have solution distribution of airports shown, leaving out overlapping ones, , when zoom in more airports filled in needed. tips on this. clustering need. you need to: position cluster @ same latlng 1 of markers in cluster use same icon cluster regular markers taking example android maps extensions, i'm familiar with, have modify code in clustermarker.java from private latlng calculateclusterposition() { latlngbounds.builder builder = latlngbounds.builder(); (delegatingmarker m : markers) { builder.include(m.getposition()); } return builder.build().getcenter(); } to like private latlng calculateclusterposition() { return markers.get(0).getposition(); } or bit more sophisticated algorithm, calculates center , iterates on markers again find nearest marker , use position.

objective c - segue.identifier coming up (null) -

i noobie trying figure why segue.identifier coming (null), before segue (prepareforsegue) , after segue (unwindtolist). doing wrong, or missing? i've set segue identifier correctly scenes involved (in segue attributes). (another member here kindly tried help, no avail.) here code: in addtodoitemviewcontroller.m (source unwind): - (void) prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nslog(@"segue identifier sender: %@", segue.identifier);//comes (null)...?? self.todoitem = [[todoitem alloc] init];//this code works fine if not conditional in unwind scene if (sender != self.donebutton) return;//this code works fine if not conditional in unwind scene if (self.textfield.text.length > 0 ) {//this code works fine if not conditional in unwind scene self.todoitem.itemname = self.textfield.text;//this code works fine if not conditional in unwind scene self.todoitem.completed = no;//this code works fine if not condit