Posts

Showing posts from August, 2013

c# - Iterating through a list of paths from a config file? -

i have console app few foreach loops iterate through paths , parses out email addresses csv files. however, need loop read config file instead of going through directory, call existing api endpoint each email address. have now: static void runtask(string[] args) { foreach (string folders in directory.enumeratedirectories("c:\\tests"))//looks @ every folder within main folder called tests --this needs read list of paths { foreach (string path in directory.enumeratefiles(folders, "*.csv"))//looks @ every file extension ".csv" in each folder { debug.write("\n" + path + "\n"); //writes out file names using (streamreader sr = new streamreader(path)) { string line; while ((line = sr.readline()) != null) { string[]

routing - 2 external IP address mapped to 1 internal -

is possible map same internal ip address 2 different external ip's on cisco firewall? in process of getting new circuit have them both mapped until ready cutover. with cisco firewall mean cisco asa guess. if so, never tried should possible static nat. asa version prior 8.3: (config)# static($internal_net, $public_net), $public_ip1 $private_ip netmask 255.255.255.255 (config)# static($internal_net, $public_net), $public_ip2 $private_ip netmask 255.255.255.255 with asa version 8.3 , later: (config)# object network $my_name1 (config-network-objct)# host $private_ip (config-network-objct)# nat($private_net, $public_net) static $public_ip1 (config)# object network $my_name2 (config-network-objct)# host $private_ip (config-network-objct)# nat($private_net, $public_net) static $public_ip2 then need proper acl of course.

javascript - large gap underneath floated columns? -

i have created typical 3 column layout. reason, middle column creating large , unwanted gap between top 3 , bottom three. there way make gap between of container same? jsfiddle * { margin: 0; padding: 0; box-sizing: border-box; } html, body { font-family: 'lato', sans-serif; } column-container { width: 100%; background: #eeeeee; } wrapper-container { width: 80%; margin: auto; } column-three { padding: 25px; } .container { background: #ffffff; border-radius: 2px; box-shadow: 0px 2px 1px 1px rgba(0,0,0,0.05); } .container h2 { padding: 25px; font-size: 18px; text-align: center; font-weight: bold; color: #22313f; } .container:hover h2 { color: #22313f; } .container .image { margin: auto; width: 150px; height: 150px; border-radius: 100%; background: #22313f; } .container .text { padding: 25px; font-weight: 400; line-height: 30px; } .buy-button { padding-left: 25px; paddi

jquery - Prevent text from wrapping around input -

i have simple multi select drop down list i'm trying checkbox , label stay inline each other, without label text wrapping around checkbox. below code shows issue i'm having. in this fiddle tried wrapping checkbox , label each in own div , floating them, causes label break next line. $(document).ready(function() { var el = $(".msddl_selectitem"); el.find(".msddl_selectlisttoggle").on("click", function () { var container = $(this).parents(".msddl_selectitem"); var list = container.find("ul"); if (list.is(":visible")) { list.slideup("fast"); } else { list.slidedown("fast"); } }); }); body { background: #eee; } /*msddl*/ .msddlgroup { display: block; float: left; margin: 0 0 0 1.6%; width: 32.26%; } .msddlgroup:first-child { margin-left: 0; } @media screen , (max

login - Java- Test for Word -

i using netbeans , code is private void passwordactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: } how make java scan password, that, if wrong not work , if password correct works , performs action. you should have simple text/password input field awt, read input variable , compare if.

performance - Multiples INNER JOIN is too slow SQL SERVER -

i'm having performance problem. i created table receives data file, bulk insert . select multiple inner join s (11 inner joins) insert table right data. when run select , takes long (more hour) , stop it. solution break query 3, creating @temp tables. surprise, takes 3 minutes. that's i'm trying understand, why breaking query 3 faster 1 select statement. here query: select t1.returnint, t1.returnbit, t2.returnint, t3.returnint, t5.returnint, t1.returndatetime t1 inner join t2 on t2.my_column_varchar = t1.my_column_varchar inner join t3 on t3.my_column_number = t1.my_column_number , t2.my_column_id = t3.my_column_id inner join t4 on t4.my_column_varchar = t1.my_column_varchar inner join t5 on t5.my_column_int = t1.my_column_int , t5.my_column_int = t4.my_column_int , t2.my_column_int = t5.my_column_int inner join t6 on t6.my_column_int = t5.my_column_int , t6.my_column_int = t2.my_column_int inner join t7 on t7.my_column_int = t6.my_colum

in line css is not working for HTML in email using java -

i trying apply, styles in html. positioning content etc. i can on lay text on image, using auto code generated bulletproof website. cannot apply styles on text. i have following snippet of html in email: here's server code creating email: mimemultipart mimemultipart = new mimemultipart("related"); mimebodypart textbodypart = new mimebodypart(); mimemultipart = new mimemultipart("related"); string cid = contentidgenerator.getcontentid(); textbodypart.settext(messagebody, "us-ascii", "html"); mimemultipart.addbodypart(textbodypart); imagepart.attachfile(file); imagepart.setcontentid("<" + cid + ">"); mimemultipart.addbodypart(imagepart); msg.setcontent(mimemultipart); transport.send(msg); <!doctype html public '-//w3c//dtd xhtml 1.0 transitional//en' 'http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd'> <html xmlns:v="urn:schemas-microsoft-com:vml"> &

java - OpenCV video capture not loading -

i trying load webcam on jpanel using java not working. new java opencv. code not showing error not running. this java code: public void run(){ synchronized (this) { while(true){ if (websource.grab()) { system.out.println("err"); try { websource = new videocapture(0); websource.retrieve(frame); graphics g = webcampanel.getgraphics(); facedetector.detectmultiscale(frame, facedetections); (rect rect : facedetections.toarray()) { // system.out.println("ttt"); core.rectangle(frame, new point(rect.x, rect.y), new point(rect.x + rect.width, rect.y + rect.height), new scalar(0, 255,0)); } highgui.imencode(".bmp", frame, mem); image im = imageio.read(new bytearrayi

matplotlib - Repositioning windows in python -

Image
i started using python. output have 2d-graphs, figured matplotlib way go. when coding position windows similar following screenshot. assigned hotkeys these positions using bettersnaptool on osx. problem is, cannot reposition python output. instead of graph, python notebook repositioned. there possible workaround? [of course manually move figure every time, costs time , focus.]

python - Writer.add_document() function error Whoosh - mysql loop -

i'm trying index large amount of articles db encoded in latin1. i've solved encoding issue charset, not able add index each row. i've tried : 1) writer.add_document(id = unicode(row["id"]),body = unicode(row["body"]), name = unicode(row["name"]), brand = unicode(row["brand"]), familia = unicode(row["familia"])) this indexes docs not respects index labels. 2) writer.add_document(doc) this reports add_document() takes 1 argument (2 given) error here full code : # open writer index ix.writer() writer: con= mdb.connect(host="myhost", user="myuser", passwd="pass", db="db", charset="utf8", use_unicode=true) con: cur = con.cursor(mdb.cursors.dictcursor) #cur.execute("select id, body, name, brand, familia articles") rows = cur.

c# - How do I prevent Long / Int64 ToString() converting to Exponential Format? -

running .net 4.6 , x64 build options. no tostring() format option seems work numbers on 15 digits in length, converts them exponential format. what have tried far: long.tostring("#"); long.tostring("g"); long.tostring("0"); long.tostring("#,#"); long.tostring("0,0"); the thing partially works is: long.tostring("0,0"); //ex.) 5,149,673,432,170,230 however, prefer plain number. prefer not use: string.replace(",", ""); any suggestions? edit: solution 1 tried. .tostring("0") ran full repair of vs2015 , cleaned solution. it's working intended. you can use "0" format. long num = 1234567890123456789; system.diagnostics.debug.writeline("str=" + num.tostring("0")); output: str=1234567890123456789

ios - Objective-C how to convert a keystroke to ASCII character code? -

i need find way convert arbitrary character typed user ascii representation sent network service. current approach create lookup dictionary , send corresponding code. after creating dictionary, see hard maintain , determine if complete: __asciikeycodes[@"f1"] = @(112); __asciikeycodes[@"f2"] = @(113); __asciikeycodes[@"f3"] = @(114); //... __asciikeycodes[@"a"] = @(97); __asciikeycodes[@"b"] = @(98); __asciikeycodes[@"c"] = @(99); is there better way ascii character code arbitrary key typed user (using standard 104 keyboard)? objective c has base c primitive data types. there little trick can do. want set keystroke char , , cast int . default conversion in c char int char 's ascii value. here's quick example. char character= 'a'; nslog("a = %ld", (int)test); console output = a = 97 go other way around, cast int char; int asciivalue= (int)97; nslog(&quo

android - When is SQLiteOpenHelper onCreate() / onUpgrade() run? -

i create tables in sqliteopenhelper oncreate() receive sqliteexception: no such table or sqliteexception: no such column errors. why? note: (this amalgamated summary of tens of similar questions every week. attempting provide "canonical" community wiki question/answer here questions can directed reference.) sqliteopenhelper oncreate() , onupgrade() callbacks invoked when database opened, example call getwritabledatabase() . database not opened when database helper object created. sqliteopenhelper versions database files. version number int argument passed constructor . in database file, version number stored in pragma user_version . oncreate() run when database file did not exist , created. if oncreate() returns (doesn't throw exception), database assumed created requested version number. implication, should not catch sqlexception s in oncreate() yourself. onupgrade() called when database file exists stored version number

Translate model name by string in Rails -

there following code: model_name = self.class.name.demodulize.sub("controller", "").singularize message = t('activerecord.exceptions.not_found', model_name: model_name) render json: message, status: :not_found and there yaml: ru: activerecord: exceptions: not_found: "%{model_name} не найден" as can see have russian text in translation, model name still in english. how can translate model name in russian too? in advance! ru: activerecord: models: user: пользователь model_name = self.class.name.demodulize.sub("controller", "").singularize model_klass = model_name.constantize message = t( 'activerecord.exceptions.not_found', model_name: model_klass.model_name.human ) render json: message, status: :not_found http://guides.rubyonrails.org/i18n.html

ios - Understanding boldSystemFontOfSize: -

i'd know why bold font isn't bold in app? tried setting label in interface builder system-bold font didn't bold. started investigating , found font label using .helveticaneueinterface-mediump4 weight of bold . looks medium instead of bold. went , tried setting font in code bold using boldsystemfontofsize: , font returned again wrong. so calling boldsystemfontofsize return medium font. nslog(@"%@", [uifont boldsystemfontofsize:24]); <uictfont: 0x7f9ed0f4f380> font-family: ".helveticaneueinterface-mediump4"; font-weight: bold; font-style: normal; font-size: 24.00pt is bug in uifont? or problem here? there no problem. works intended. these methods return fonts appropriate operating system using. "bold" doesn't mean "bold", means "bold in comparison other user interface elements". when apple decides change way text in ios or macos x looks, don't have change code. in ios 7 , 8 fonts tend rathe

java - how to add two 1-d array and arrange it using for loop? -

the user should input 10 integer values list1 , 10 integer values list2. program should add contents of list1 , list2 store sum list3. program should display horizontally values of list1, list2, , list3. use loops. here output: list1 : 1 3 2 5 7 8 5 6 9 4 list2 : 2 1 4 3 2 1 4 2 0 2 list3 : 3 4 6 8 9 9 9 8 9 6 here code import java.io.*; public class list { public static void main(string[] args) { int list1[] = new int[10]; int list2[] = new int[10]; int i, j, k, num = 0, num1 = 0, num2 = 0; string input = " "; bufferedreader in = new bufferedreader(new inputstreamreader(system. in )); (i = 0; < 10; i++) { list1[i] = 0; } (j = 0; j < 10; j++) { list2[j] = 0; } try { (i = 0; < 10; i++) { system.out.print("input value list[" + + "] = "); input = in .readline(); num

ssl - IIS 7.0-7.5 IP address rebinding when adding IP's through netsh -

i have 50 or websites bound "unassigned" ip address binding in iis, means they'll respond ip address assigned server. dns records point specific one, works. want bind ssl certificate specific site, have no way target specific ip address, since aren't listed in ip address dropdown list. google led me support doc: https://support.microsoft.com/en-us/kb/954874 it makes sense, question is.. if add ip addresses assigned server netsh, restart services.. "unassigned" option go away? sites automatically become unbound, or stay "unassigned" , respond everything? went ahead , did anyway, did indeed break sites, had add 0.0.0.0 ip list have "unassigned" option work again. hope helps in future

maven - Mule - call a controller from inside onCall() method of java class -

i working on project mavenized web application having mule support in it. there requirement call controller inside java class implements callable interface. achieved creating object of controller against mvc rules. tried use @autowired annotation doesn't work in oncall() method. there solution can call controller method java class? use spring inject controller field of callable bean.

osx - SQLITE3 error: malformed database schema (is_transient) - near "where": syntax error -

Image
i m using os x 10.9.5 , google crome: version 44.0.2403.107 (64-bit) google crome store cookies @ path: /users/(logged user)/library/application support/google/chrome/default/cookies opened file through app "sqlite free - datum"; show column name "cookies" shown in image. i opened same file through terminal of osx 10.9.5. getting "malformed database schema (is_transient) - near "where": syntax error" while executing command "select * cookies" shown in pin below. os x 10.9.5 (mavericks) comes sqlite 3.7.13 installed default. database schema chrome cookies has been changed utilize partial indexes, supported on sqlite 3.8.0 , higher ( https://www.sqlite.org/partialindex.html ). os x 10.10 (yosemite) ships sqlite 3.8.5 installed default, can access database through terminal fine in yosemite. it looks chrome team aware partial indexes not supported on earlier versions of sqlite, shown in bug report: https://groups.goog

css - Oneline horizontal list with middle item that fits its content width -

i have horizontal list of items, arranged display:table-cell. the middle item can vary in content length, , should expand accordingly. , siblings should shrink make space it. here sample of did until now: http://codepen.io/pictor13/pen/mjoyxw but middle item still overflows on right sibling, when content grows. is possible achieve want? display: table-cell , white-space: nowrap right approach? note: width, if specified, should generic , not fixed specific px/em. wellll.... flexbox can that. .container { background-color: yellow; padding: 1px; } li { text-align: center; border: 2px solid #ccc; background-color: green; color: red; list-style: none; } ul { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; padding: 0; margin: 3px; background-color: brown; } li { -webkit-box-flex: 1; -webkit-flex: 1 0 auto; -ms-flex: 1 0 auto; flex: 1 0 auto; } input { width: 2

jquery - Applying isotope js affects the css of the div -

after applying isotope js div section, library applied elements inside div , works. however, previous div animation worked isn't working expected more. here fiddle worked before applying isotope js: url: https://jsfiddle.net/eugensunic/ttf1wkcn/2/ and here fiddle when isotope get's applied , elements overwritten hidden css: url https://jsfiddle.net/eugensunic/so1axnup/10/ here code i'm using (same both fiddles): $(this).animate({ position: "relative", left: "200px", top: "200px", zindex: "55" }, 1200, function () { $(this).animate({ position: "relative", left: "0px", top: "0px", zindex: "55" }); }); i know can hard code previous animation (fiddle num.1) there more easier way solve , why elements deteriorate isotope a

How to create a matlab object of a specific version using vb.net -

i trying create application in vb.net. during 1 of step, if user click "launch matlab cmd window" button matlab cmd window(only matlab cmd window, not application) launched. the snipe of code : private sub matlab_cmd_click(sender object, e eventargs) handles matlab_cmd.click dim matlab object = createobject("matlab.application") end sub i know simple, 1 line of code problem have different versions(3 versions of matlab) installed on computer different development environment purpose. code launches matlab 2009b cmd window want launch matlab 2013a cmd window. there way define specific version of matlab cmd window launch? there shared progid "matlab.application" let's start matlab version , version specific progid let's start specific version, example "matlab.application.8.1" start matlab 2013a. of progids registered matlab explained here. version of matlab installation, use ver command.

ios - Two classes, callback and unit testing -

i have 1 class static methods : class wraps calls twitter api in second class, have business logic. due asynchronousness behaviour of methods in wrapper class, have difficulties design communication. here i've done : apimanager.swift public class apimanager { class func getpermission(callback : () -> void) { let accountstore = acaccountstore() let accounttype = acaccountstore().accounttypewithaccounttypeidentifier(acaccounttypeidentifiertwitter) let callbackrequestaccess = { (granted: bool, error: nserror!) -> void in ... if(granted) { callback() } } accountstore.requestaccesstoaccountswithtype(setaccounttype, options: nil, completion: callbackrequestaccess) } } welcome.swift public class welcome { public func checkpermission() { apimanager.getpermission(gettweet) } public func gettweet() { ...

c# - Error: Only primitive types or enumeration types are supported in this context EF -

this piece of code keep making error. : unable create constant value of type 'repository.dbmodel.subscriber'. primitive types or enumeration types supported in context. i've changed few times keeps coming error. using (subscriberdbhandler db = new subscriberdbhandler()) { ienumerable <subscriber> newsubscribers = subscribers .where(sub => db.subscriber .any(asub => !asub.email.equals(sub.email))); list<subscriber> updatesubscribers = db.subscriber .where(dbsub => subscribers .any(lsub => lsub.email .equals(dbsub.email))).tolist(); if(newsubscribers.count() >= 1) { db.subscriber.addrange(newsubscribers); } updatesubscribers.foreach(asub => asub.state = subscribers

iOS/Swift/Parse - Struct not storing data -

i'm having trouble storing data parse in struct. have set uitableviewcontroller use separate struct file get/manage data parse. struct gets data parse (confirmed using println), when try , reference data populate table, struct empty again. below 2 files (several methods omitted try , make more concise here). had working correctly when used separate class (instead of struct) parse data, have since decided struct better needs. can spot going wrong struct? many thanks. console output resultsarray.count = 45 filled objectlist.count = 1 objects @ index0.count = 45 testprint objectlist.count = 0 uitableviewcontroller import uikit import parse class exercisemuscletypetableviewcontroller: uitableviewcontroller { // mark: variables var citadel: citadel = citadel() // mark: ibactions @ibaction func refreshbutton(sender: uibarbuttonitem) { citadel.testprint() } // mark: override override func viewdidload() { super.viewdidload() citadel =

Remove Twilio recording Beep -

is there anyway turn off default twilio beep sound start recording. want use our own customer beep. basically want single beep when mp3 completes playing. after want 20 seconds blank , once 20 seconds completes, play 3 beeps can start recording answer. twilio developer evangelist here. you can turn off beep! can use attribute playbeep on <record> verb , set false. simple twiml example of description might be: <response> <play>http://example.com/your.mp3</play> <record playbeep="false"/> </response> let me know if helps.

sorting - Let In Statement Error -

i have problem following haskell statement: insertsort3 xs = let sort3 [] ys = ys sort3 (x:xs) ys = sort3 xs (insert x ys) in sort3 xs [] my compiler says: parse error on input ‘=’ (the error occurs in line three). the problem indentation in second line of let : insertsort3 xs = let sort3 [] ys = ys -- next line should line previous sort3 sort3 (x:xs) ys = sort3 xs (insert x ys) in sort3 xs []

ios - "Renders with edge antialiasing" Makes UIViews look worse with transform -

i have uiviews have transform both translation , rotation , looking aliased turned on "renders edge antialiasing" in -info.plist , makes worse! instead of being jaggy, seem have black mixed in jaggy edges. there shadow, layer behind not black. is there i'm missing here? i found lot of different advice on this, seems "renders edge antialiasing" doesn't lot in grand scheme of things. however, helps little solution found below: self.layer.shouldrasterize = yes; self.layer.rasterizationscale = [[uiscreen mainscreen] scale]; these 2 lines go on uiview gets transformed layer [uicolor clearcolor] background. colors or images or content subview. otherwise, rounded corners i'm using, saw little black on edges.

Error with index global in Lua recipe for foldit.org -

i starting writing scripts foldit . first experience of lua, status "noob insight". in first script, want print out contactmap data. have copied , pasted functions http://foldit.wikia.com/wiki/foldit_lua_functions . error is: attempt index global 'structure' (a nil value) here code: segmentcount = structure.getcount() print ("segment count: " .. segmentcount) source = 1, segmentcount target = source + 1, segmentcount incontact = contactmap.iscontact(source, target) heat = contactmap.getheat(source, target) print("segments "..source..", ".. target..": heat = "..heat) end end thanks in advance enlightenment. edit the problem had loaded v1 recipe, , foldit continued treat v1 syntax. solution create new (scriptv2) recipe, , load same code. you seem doing according documentation. error means contactmap not defined (has nil value) , code fails on accessing elements. i'd check version

c# - How can I parse the following string into DateTime? -

this strange date fromat have never seen before coming api in json. "tue aug 04 2015 00:17:38 gmt+0000 (utc)" that generating following error: system.formatexception: string not recognized valid datetime. which understandable when using following method parse: datetime.parse(x.process_date.value) anyone dealt complex date formats may know how parse that? you can use datetime.parseexact method (or datetime.tryparseexact , cleanly handle parsing failures) accomplish this. these methods allow explicitly specify format string. something work: var datestring = "tue aug 04 2015 00:17:38 gmt+0000 (utc)"; var format = "ddd mmm dd yyyy hh:mm:ss gmt+0000 (utc)"; var parsed = datetime.parseexact( datestring, format, system.globalization.cultureinfo.invariantculture); or, using tryparseexact : datetime parsed; if (datetime.tryparseexact( datestring, format, system.globalization.cultureinfo.invariantculture,

android - How to implement OnScrollistener in a fragment -

i can't seem implement/extend onscrollistener recyclerview know when recyclerview hits bottom public class upcomingfragment extends fragment how implement if: implements recyclerview.onscrolllistener and implements onscrolllistener give me "interface expected here" error my build gradle module: android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { applicationid "company.com.movieapp" minsdkversion 15 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } build grade project buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files } }

RUBY do loop and if statements not executing correctly -

i novice ruby coder completing homework exercise related building loops. rspec criteria problem shown below. have tried number approaches. i have been able pass first 2 conditions totally stuck on how match , transform english articles (a, an, the). doesn't appear correctly looping , using if construct correctly within method. can suggest ideas can approach solve or if there simple syntax issue missing? describe "title" describe "fix" "capitalizes first letter of each word" expect( title.new("the great gatsby").fix ).to eq("the great gatsby") end "works words mixed cases" expect( title.new("little red riding hood").fix ).to eq("little red riding hood") end "downcases articles" expect( title.new("the lord of rings").fix ).to eq("the lord of rings") expect( title.new("the sword , stone").fix ).to eq(&quo

Passing a string saved in a bash variable with an apostrophe to psql query using a bash script -

in bash script, reading in list of strings text file may contain apostrophe ( ' ). each string in list saved bash environment variable passed psql query. have tried far still when loop through list, if counter apostrophe, query fails. here snipit of code fails: select * table_1 id = $myid , name = '$namelist'; namelist file has entries may contain apostrophes. thanks help use prepared sql statement avoid sql injection. you may need solution this post .

ios - UIButton setTittle not working in a specific case -

i have 2 views in app , plist file store values. in first view i've created button called frequenciesbutton opens second view , button restore default values. in second view there pickerview , "done" button. on .m of first view: - (void)viewdidload { [super viewdidload]; // self.gamesettings = [[nsmutabledictionary alloc] initwithcontentsoffile:gamesettingsfilepath]; } -(void)viewwillappear:(bool)animated { [self refreshview]; } - (void)refreshview { [self.frequenciesbutton settitle:[nsstring stringwithformat:@"%@ hz , %@ hz", [self.gamesettings objectforkey:@"freq-freq1"], [self.gamesettings objectforkey:@"freq-freq2"]] forstate:uicontrolstatenormal]; ... } - (ibaction)setdefaultvalues:(uibutton *)sender { [self.gamesettings setvalue:@880 forkey:@"freq-freq1"]; [self.gamesettings setvalue:@1122 forkey:@"freq-freq2"]; ... [self.gamesettings writetofile:gamesettin

machine learning - how to get contribution of features in feature set -

i have features , using weka classify instances for example, have number of adj number of adverb number of punctuation in feature set. i want know contribution of each feature in feature set. metrics or parameters helpful contribution of features?

c - "Incompatible integer to pointer conversion" -

the following program refusing compile because of these errors: vigenere.c:52:31: error: incompatible integer pointer conversion assigning 'string' (aka 'char *') 'int' [-werror,-wint-conversion] ...ciphertext[i] = ((((plaintext[i] - 65) + keyword[num % keylength]) % 26) + 65); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vigenere.c:56:31: error: incompatible integer pointer conversion assigning 'string' (aka 'char *') 'int' [-werror,-wint-conversion] ...ciphertext[i] = ((((plaintext[i] - 97) + keyword[num % keylength]) % 26) + 97); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and here's program, meant implement simple vigenere cipher: #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { if(argc != 2) { printf("invalid input; try again!\

java - How to show/hide different row sections in a JTable -

i have jtable rows list files , folders in directory. folder rows have button hide , show rows listing files in folder. when application starts up, files rows come after folder row hidden. used rowfilter hide these rows after table created in subclass method: ... public void createtable(){ //create , populate table ... //add filter hide subfile rows tablerowsorter<defaulttablemodel> sorter = new tablerow sorter<defaulttablemodel>(tablemodel); rowfilter hidefilter = getrowfilter(); sorter.setrowfilter(hidefilter); mytable.setrowsorter(sorter); } ... private rowfilter getrowfilter() { rowfilter<defaulttablemodel, integer> filter = new rowfilter<defaulttablemodel, integer>() { @override public boolean include(rowfilter.entry<? extends defaulttablemodel, ? extends integer> entry) { int modelrow = entry.getidentifier(); if(/

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

i realize question might seem trivial some, it's these types of things find myself fighting quite bit , want make sense of despite seeming losing battle in .net (for me anyway). so, if following: using system.web; ... applicationuser user = system.web.httpcontext.getowincontext().getusermanager<applicationusermanager>().findbyid(system.web.httpcontext.user.identity.getuserid()); that produces error in title , red getowincontext() , error cannot resolve symbol 'getowincontext()' however, if following (remove system.web in front of httpcontext ), works expected (or @ least no errors): using system.web; ... applicationuser user = httpcontext.getowincontext().getusermanager<applicationusermanager>().findbyid(system.web.httpcontext.user.identity.getuserid()); however, if (same line that's working using system.web commented out): //using system.web; ... applicationuser user = httpcontext.getowincontext().getusermana

javascript - Submitting form values to a JS array object rather than to an AJAX request -

been working on issue while , cant head around it. there few similar answers nothing seems tackle exact issue. so have form. values going numbers. want capture values inside array perform calculations on them before sending seperate ajax call new variables. im surprised @ how hard seems to working. my code should outputting values of form key/value pairs within array x, array seems empty (contains {object object} pairs every form name/value pair. any ideas? if there better method achieving this, i'm ears (or eyes, whatever!). guess easy way bind click rather submit event, dont want lose other user form submission abilities (pressing enter etc). javascript: $('#zombieform').submit(function(event) { event.preventdefault() var x = $(":input").serializearray(); alert(x); //currently using sandbox without console }); html: <form id="zombieform" method="post"> <select name="multi2" required>

c++ - deducting a type T for std::function from a lambda function -

i trying understand how following code works : #include <iostream> #include <functional> using namespace std; template <typename t> struct identity { typedef t type; }; template <typename t> void foo(t val, typename identity<function<void(t)>>::type f) { f(val); } int main () { foo(1337,[](int x){ cout << "lambda " << x << endl; }); return 0; } there no choice of t make lambda type equal std::function(void(t)) type, that's why metafunction needed. i know nested-name-specifier :: brick wall make compiler not try deduce type t parameter. so tried same code without t val function parameters , t not deduced. does mean compiler following steps when call foo(1337,[](int x){ cout << "lambda " << x << endl; }); arg 1337 , param t val // t deducted int brick wall, won't try deduce type second argument will compiler call identity<function<voi

ember.js - Is there a way to specify which variable to use in ember relationship -

after specifying relationship between app.post = ds.model.extend({ comments: ds.hasmany('comment') }); app.comment = ds.model.extend({ post: ds.belongsto('post') }); but accepts integer id in 'post' , an array of integers in 'comments' can please tell me how use any other variable reference name or title instead of array. with associations, referencing ember models not specific types. in case comments in post model references individual comment ember objects

python - What is the recommended approach to implement admin-actions-alike functionality outside admin? -

i've been searching way reproduce admin-actions behavior on own tables using django-tables2. haven't found module introduce functionality listview derive , looking @ modeladmin see there many methods implied on this. of course, can add form around table checkboxes , submit button pointing view works ids i'm looging combo choose among different actions in django-admin have 'actions' meta option list methods possible actions perform. found django-actions still young introduces it's own page operations , need integrate functionality on own model can connect input type=select model actions. comment appreciated :) there no built-in solution it. have implement actions in views , functionality templates. add, edit , delete operations easy implement in views.py . depends on models, can trigger database manipulations within templates , keep logic in views.py . you can add form templates described in docs : # forms.py django.forms import modelform my