Posts

Showing posts from May, 2014

graph - Group variables by clusters on heatmap in R -

Image
i trying reproduce first figure of this paper on graph clustering : here sample of adjacency matrix: data=cbind(c(48,0,0,0,0,1,3,0,1,0),c(0,75,0,0,3,2,1,0,0,1),c(0,0,34,1,16,0,3,0,1,1),c(0,0,1,58,0,1,3,1,0,0),c(0,3,16,0,181,6,6,0,2,2),c(1,2,0,1,6,56,2,1,0,1),c(3,1,3,3,6,2,129,0,0,1),c(0,0,0,1,0,1,0,13,0,1),c(1,0,1,0,2,0,0,0,70,0),c(0,1,1,0,2,1,1,1,0,85)) colnames(data)=letters[1:nrow(data)] rownames(data)=colnames(data) and these commands obtain following heatmap: library(reshape) library(ggplot2) data.m=melt(data) data.m[,"rescale"]=round(rescale(data.m[,"value"]),3) p=ggplot(data.m,aes(x1, x2))+geom_tile(aes(fill=rescale),colour="white") p=p+scale_fill_gradient(low="white",high="black") p+theme(text=element_text(size=10),axis.text.x=element_text(angle=90,vjust=0)) this similar plot on left of figure 1 above. differences (1) nodes not ordered randomly alphabetically, , (2) instead of having binary black/white pixel...

mysql - 3 tables and 2 independent JOINs with CONCAT expressions -

i have following 3 tables ids table: users user | name 1 | joe 2 | john table: user_id1 user | id1 1 | 2 1 | 3 2 | 5 table: user_id2 user | id2 1 | 3 1 | 4 i following result each user name | ids 1 | ids 2 joe | 2,3 | 3,4 john| 5 | null i use query: select user.name, group_concat(user_id1.id1) "ids1", group_concat(user_id2.id2) "ids2" users left join user_id1 on user_id1.user=users.user left join user_id2 on user_id2.user=users.user but result: name | ids1 | ids2 joe | 2,2,3,3 | 3,4,3,4 john | 5 | null what wrong? help using distinct should solve it select user.name, group_concat(distinct user_id1.id1) "ids1", group_concat(distinct user_id2.id2) "ids2" users left join user_id1 on user_id1.user=users.user left join user_id2 on user_id2.user=users.user

angularjs - Thinktecture IdentityServer V3 - Data is not binding and resources are not loading -

i've created web api i'd secured thinktecture's identityserver v3. imported package nuget, , able hit token endpoints create token. however, noticed bootstrap css not load on is's main page: this how appears i.imgur.com/dftmq7c.png vs https:/demo.getidentityserver.com it didn't bother me until started using views (and not endpoints) pages print variable names , function incorrectly resources not loading properly. like so. of course, can not log in since redirects me literal "loginurl" page . i've tried reverting previous version 1.2.1, still have same issue. alternatively, i've looked @ samples , don't have same issue @ all, i'm wondering if there's config in api project may causing this. has encountered problem or know of potential fix? be sure read through documentation thoroughly, guys. lesson learned. needed add rammfar web.config "otherwise of embedded assets not loaded correctly iis" <system.webs...

r - rCharts Sankey Diagram not plotting -

using code demo demo2 unable view plot. using rstudio , see in "viewer" window url http://timelyportfoli.github.ip/rcharts_d3_sankey//layouts/chart.html i must doing wrong, not getting errors or warnings, , cannot find solution. require(rcharts) require(plyr) gallery <- read.csv( "https://docs.google.com/spreadsheet/pub?key=0aovonzjt5getdehqvdgyyxpjmnz2m2j2ymtvx0i5snc&output=csv", stringsasfactors = false ) gallery.use <- gallery[,c("technology","visualizationtype","documenttype","author")] colnames(gallery.use) <- rep("column",4) gallery.edge <- rbind( gallery.use[,1:2], gallery.use[,2:3], gallery.use[,3:4], deparse.level=1 ) colnames(gallery.edge) <- c("source","target") gallery.edge <- ddply(gallery.edge,~source+target,nrow) colnames(gallery.edge) <- c("source","target","value") #verify no source = target #or ...

php - Ternary operator and string concatenation quirk? -

hi want know why code yields (at least me) incorrect result. well, i'm in fault here $description = 'paper: ' . ($papertype == 'bond') ? 'bond' : 'other'; i guessing if papertype equals 'bond' description 'paper: bond' , if papertype not equals 'bond' description 'paper: other'. but when run code results description either 'bond' or 'other' , left me wondering string 'paper: ' went??? $description = 'paper: ' . ($papertype == 'bond' ? 'bond' : 'other'); try adding parentheses string concatenated string in right order.

postgresql - oracle evalname function equivalent in postgres -

oracle supports dynamic xmlelement name evalname function. there similar feature in postgres xmlelement name dynamically instead of using constant? example in oracle: select xmlelement(evalname(ename),empno) emp; this statement result in list of enames separate xml elements. <smith>7369</smith> <allen>7499</allen> <ward>7521</ward> not sure if postgres has similar. thanks. i able workaround construct xml dynamic element names in postgres using execute format. posting in case if had same issue. execute format('select xmlelement(name %i, $1)', emp_name) using empno emp; <smith>7369</smith> <allen>7499</allen> same worked xmlforest , having xmlattributes inside xmlelement.

PHP - what is wrong here? -

i'm making car rental system in school , have run issue cannot fix. when have completed query ask cars matching users search have buttun can click rent car , redirects them page. lets want rent ferrari f12 , click on rent. when other page says "rent opel corsa" no matter car choose. silly oversight on side. here search function function søk(){ define('db_host', 'db-kurs.hit.no'); define('db_name', 'v15gdb1'); define('db_user','v15g1'); define('db_password','pw1'); $con=mysql_connect(db_host,db_user,db_password) or die("kunne ikke koble til mysql: " . mysql_error()); $db=mysql_select_db(db_name,$con) or die("kunne ikke koble til mysql: " . mysql_error()); $sql = mysql_query("select * biler sted= '$_post[by]' , merke = '$_post[biler]'"); $resultat = $sql; $mld = "du har valgt å søke etter en <b>$_post[biler]</b> <b>...

How to obtain information from facebook graph api then the page is private? -

i wondering if there way read (and read without changes) facebook page (that not mine) using facebook graph api. for example have id "90689883513", if put https://graph.facebook.com/90689883513?access_token=xxxx info need (i need page basic information) there pages if understand right more "private", can read basic info user there no way grab facebook graph api, right ? or there way , missing ? i found manged same thing pages can't understand how manged that.

machine learning - How to use different dataset for scikit and NLTK? -

i trying implement inbuilt naive bayes classifier of scikit , nltk raw data have. data have set tab-separated-rows each having label, paragraph , other attributes. interested in classifying paragraphs. need convert data format suitable inbuilt classifiers of scikit/ nltk. want implement gaussian,bernoulli , multinomial naive bayes paragraphs. question 1: scikit, example given imports iris data. checked iris data, has precalculated values data set. how can convert data such format , directly call gaussian function? there standard way of doing so? question 2: nltk, should input naivebayesclassifier.classify function? dict boolean values? how can made multinomial or gaussian? @ question 2: nltk.naivebayesclassifier.classify expects called 'featureset'. featureset dictionary feature names keys , feature values values, e.g. {'word1':true, 'word2':true, 'word3':false} . nltks' naive bayes classifier cannot used multinomial approach....

c# - raw pixel array to gray scale BitmapImage -

i have array of raw pixel data. convert 8bpp bitmap. public static bitmap bytetograybitmap(byte[] rawbytes, int width, int height) { bitmap bitmap = new bitmap(width, height, pixelformat.format8bppindexed); bitmapdata bitmapdata = bitmap.lockbits(new rectangle(0, 0, width, height), imagelockmode.writeonly, bitmap.pixelformat); marshal.copy(rawbytes, 0, bitmapdata .scan0, rawbytes.length); bitmap.unlockbits(bitmapdata); return bitmap; } bitmap looks color image instead of grayscale. try adding before return bitmap: for (int c = 0; c < bitmap.palette.entries.length; c++) bitmap.palette.entries[c] = color.fromargb(c, c, c); it create typical grayscale palette.

Is their a way to insure that the load is close to evenly divided between the CPU's within each Apache/Drupal webserver? -

the cpu usage test environment showed usage on single cpu (per server) , 0% usage on other cpus each apache/drupal webserver. in production, there imbalance observed, while 1 cpu @ ~70% others around 15%. is way insure load close evenly divided between cpu's within each apache/drupal webserver?

arduino - AX.25 protocol interfering with sending data packet -

i sorry not able provide code question more of logical situation. termination sequence ax.25 protocol "111111" 6 1s. if sequence of 1s found inside data packet, denote end of packet file , send without correctly sending rest of packet. best explain conclusions , test results such can understand dilemma. ***programming in arduino****** byte 1 contains 8 bits. below , attempt picture byte in rectangular box. right next byte 2 contains 8 bits. situation 1: ||_1_0_1_1_1_0_1_0_ ||_1_1_1_1_1_1_0_0_|| attempted solution 1: change 1 0 , keep track of it. situation 2: ||_1_0_1_1_1_0_1_1_ ||_1_1_1_1_0_0_1_0_|| attempted solution 2: attempted solution 1 breaks apart. , stuck here. individually bytes safe activating ax.25 termination sequence combined bytes results in problem. here list of possible cases: 1) 6 1s = termination sequence activated end of packet 2) 6 1s inside actual data of packet = premature termination 3) if 1s changed 0s sequence of 6 0s can ...

java - JScrollPane and autoscroll: Disturbing scrolling behavior -

i writing application uses jscrollpane. in jscrollpane want automatically display search results, means, have dynamically add , remove results within jscrollpane. results realised jtextarea, embeded within gridbaglayout. when there high number of search results, jscrollpane automatically scrolls bottom (it should @ top). have solved solution found here. problem hereby is, can see, how scrolls top. possible remove behaviour? the following things found out: i have remove previous search results display new ones. if don't remove previous ones, displays correctly. it neither solves prblem wgeb update jscrollpane every tune after adding arow nor when updating after adding rows. the best disable autoscroll. have created executable example demonstrate behavior. when clicking button "add row", 500 rows added. when clicking several times, becomes clear. thank help! import java.awt.gridbagconstraints; import javax.swing.jtextarea; public class scrollpanetest ext...

java - Delay a for loop for a certain number of seconds -

i have loop this: for (int = 0; < 10; i++) { //do //delay 5 seconds go next iteration of loop } how specify delay in java? the default way thread.sleep(5000). used in context of multithreading . for (int = 0; < 10; i++) { //do //delay 5 seconds go next iteration of loop try { thread.sleep(5000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } }

knockout.js - Bind kendoui visible to calculated condition in markup? -

can somehow bind binding 'visible' in markup calculated value in same way possible knockout.js: <input data-bind="value: somevmprop, visible: (someothervmprop === 'custom')" /> the syntax i've tried hasn't worked. want avoid defining calculated field in view model when simple condition inline do.

javascript - firefox-addon : Get the distance between screen edge and webpage -

Image
ok, consider image. i develop add-on firefox , : - distance in red, between top of screen , top of `visible webpage` - distance in red between left of screen , left of `visible webpage` - distance in green what point ? i have thousand screen coordinates (x,y), have calcul coordinate relative webpage. example : considering screen size : 1200 * 800 webpage size : 400*300 red distance between left screen border , left webpage border : 200 red distance between top screen border , top webpage border : 300 coordinates screen => relative webpage becomes : ( 100, 100 ) => outside webpage( ignored ) ( 1100, 650 ) => outside webpage ( ignored ) ( 200, 300 ) => ( 0,0 ) ( 250, 400 ) => ( 50, 100 ) i have width , height of page with $(window).width() $(window).heigth() so if can left corner coordinates of tab, can determinate bot corner of tab on screen. i have ask question here, ie extension. if need more details. can't use answer ...

html - How can I make all table cell sizes the same width in css? -

i have assignment creat periodic table of elements. using css, how can make individual cells of table1 , table2 same width instead of being wide text inside them? appreciated. thank time in advance. table.table1 { border:none; width:75%; margin:auto; } table.table1 td { font-family: arial, helvetica, geneva, swiss, sans-serif; font-size:100%; text-align:center; } table.table2 { border:none; width:75%; margin-left:17.8%; margin-top:20px; } table.table2 td { font-family: arial, helvetica, geneva, swiss, sans-serif; font-size:100%; text-align:center; } table.table3 { border:none; width:30%; margin:auto; } table.table3 td { font-family: arial, helvetica, geneva, swiss, sans-serif; font-size:115%; text-align:left; width:15px; } .biggerbold { font-size:300%; font-weight:bold; } .bigbold { font-size:150%; font-weight:bold; } .bggray { background-color:gray; } .bggreen { background-color:green; } .bgyellow {...

asp.net - Open DataTable in Excel VB -

ok, interesting issue. have been tasked modifying existing vb project. user selected series of dropdowns select sql query , run query. user selects , environment dropdown, results of dropdown populates category dropdown. once category selected, dropdown of available queries. once select query , hit "run" button, gridview results of query. of query results huge. query i'm running test has 40 columns , 20,000 records. query runs in less 5 seconds takes on minute render gridview. once gridview done rendering, user has option export results excel. , this, mean code opens instance of excel through gridview.rendercontrol , displays results in excel. user doesn't want save excel file , navigate file, want open right webform using code currently. however, user doesn't care gridview. don't care if see @ all. want open excel. instead of using gridview.rendercontrol, want open excel , populate datatable (or dataset) in memory. thoughts on best way th...

git - How can I install QtWebEngine on Ubuntu -

when qml program (e.g. ethereum, installed ppa in case) tries to import qtwebengine 1.0 import qtwebengine.experimental 1.0 then these errors file:////usr/share/mist/qml/views/browser.qml:5 module "qtwebengine" not installed file:////usr/share/mist/qml/views/browser.qml:6 module "qtwebengine.experimental" not installed qtwebengine in qt 5.4 have installed #> qmake --version qmake version 3.0 using qt version 5.4.0 in /usr/lib/x86_64-linux-gnu i tried build qtwebengine myself no joy: #> git clone git@gitorious.org:qt-labs/qtwebengine.git cloning 'qtwebengine'... permission denied (publickey). fatal: not read remote repository. please make sure have correct access rights , repository exists. 1) why isn't qtwebengine installed if it's in qt 5.4, is installed? 2) there way install other building myself? 3) wrong git clone command? thanks reading. i'm doing on ubuntu 14.10. this specific ethereum , ethere...

windows - What is [not] an audio endpoint? -

selectively quoting blog piece entitled what's audio endpoint 1 of chief architects of post-xp windows audio system: an endpoint "piece of plastic" (hopefully wires in it) "to users relate" such "the microphone or headset connected laptop". which sounds great. except on every desktop machine have ever used in past 15 years, there has been microphone , line-in input jack, , exist (at least in mind) equal status. user, relate "pieces of plastic" connect line-in jack. audio endpoint me. trouble is: when use immdeviceenumerator , immdevicecollction discover devices on desktop machine, , use microsoft's own example code (e.g. "capturesharedtimerdriven" audio sample in microsoft's sdk) list microphone endpoint. so if line-in jack not audio endpoint, it, how access it, set volume on it, , on? how can make application use (exclusively) when user has selected microphone default endpoint? partial (and perpl...

css - Set the default color of a link within a container, without overriding other rules? -

i have 2 containers: left , right i'd set default color of links in left blue , right red this not want: .left { color: #00f; } .right { color: #f00; } the reason don't want that, because snippet overwrite every other color a tags due css specificity rules. see jsfiddle -- http://jsfiddle.net/jvanasco/q4oxmpxc/ -- in color bootstrap's label class gets overridden is possible achieve want? one option select a elements without class. achieve combining :not() pseudo class , the attribute selector [class] . in doing so, negating anchor elements with class. example here .left a:not([class]) { color: #00f; } .right a:not([class]) { color: #f00; }

newline - Haskell new line not working -

been messing around 20 minutes trying new line working shows in ghci single line. here enter ghci: displayfilm ("skyfall",["daniel craig", "judi dench", "ralph fiennes"], 2012, ["bill", "olga", "zoe", "paula", "megan", "sam", "wally"]) here printed: "skyfall----------\n cast: daniel craig, judi dench, ralph fiennes\n year: 2012\n fans: 7\n" displaylist :: [string] -> string displaylist [] = "" displaylist [x] = x ++ "" ++ displaylist [] displaylist (x:xs) = x ++ ", " ++ displaylist xs displayfilm :: film -> string displayfilm (title, cast, year, fans) = title ++ "----------" ++ "\n cast: " ++ (displaylist cast) ++ "\n year: " ++ (show year) ++ "\n fans: " ++ show (length fans) ++ "\n" to print string is, without escaping special characters, ...

javascript - cookie is not a function -

cookie plugin included , working fine on first click, when try click on link different data-id have error $.cookie not function, cookie can not updated new value $(document).ready(function(){ $('#row').live('click',function(){ var msg_id = $(this).data('id'); $('#table_2').html('loading...'); $.cookie("chat_", msg_id, { expires: 1 }); $('#table_2').load('http://google.com/mail_ajax.php?id='+msg_id,function(){ $("#table_2").html(); }); }); var chat_d = $.cookie('chat_'); var timeout = setinterval(reloadchat, 3000); function reloadchat () { $('#table_2').load('http://google.com/mail2ajax.php?id='+chat_d); } }); why can't update cookie on 2nd click, , can problem ?

html - Display image from directory using jQuery? -

i'm learning basics of web development, 1 thing haven't encountered solution yet getting image directory using jquery. if have checkbox defined follows... <input id="check" type="checkbox"> ... how can image directory, , display in <div> based on current state of checkbox (without messing html)? i've found far this, showing existing contents of <div> , correct? $(document).ready(function(){ $('#check').click(function(){ if(!$(this).is(':checked')){ ("div").show(); } }); }); the reason don't want touch html want gain more in-depth understanding of more powerful functions of jquery (i don't want build bad habits), proving difficult thing on own. i'd appreciate (or hints)! tl;dr: checked box = image, unchecked = no image. jquery because of reasons. you can(assuming div present) $(document).ready(function () { //create refere...

jquery - Javascript plugin appending duplicate data in Wordpress -

i'm using currency conversion plugin called curry.js that's being called on custom wordpress page bootstrap tabs , advanced custom fields. as wp loops through each tab it's appending list of currencies when open dropdown in third tab see list of currencies repeated 3 times. here's portion of code curry.js running each time: var generateddm = function( rates ){ output = ''; // change target elements drop downs dropdownmenu.each(function(){ (var in rates ) { rate = rates[i]; output += '<option value="'+ +'" data-rate="'+ rate +'">' + + '</option>'; } $( output ).appendto( ); }); }; i've tried creating counter variable outside block of code after runs once , creates list of currencies, stores list in global output variable no longer appended to, no avail. if further cla...

regex - I'm using PSPad and need a regular expression that will find 4 numbers in a six number set -

i have pages of data in following format: {1,2,3,4,5,6} {1,3,4,5,6,7} {1,2,4,5,6,7} {1,2,3,5,6,7} for clarification, i'm going call each instance of 6 comma separated numbers surrounded {}, "word". so in example above, {1,2,3,4,5,6} word. so i'm trying find each word contains 4 numbers of choosing. example, in sample above, find of words contain numbers 1, 2, 6 , 7. key point here and. know how find 1, 2, 6 or 7 -- need and . if possible, replace whole word, if finds numbers, can delete remaining 2 numbers of word regular expression. some more information data: numbers range 1-25. (so need has capability of finding 1, without including numbers 21 or 10-19 or 2, without including 12 or 20-25.) there never repeat of number within single word. numbers within word in order lowest (1) highest (25). update: you told using pspad , want in editor. don't think possible using regular expression. use awk or programming language of choice. here ...

php - How can I use Middleware to define a section of a blade template? -

i have navigation bar i'd show link admin dashboard if user logged in admin. if not, should display nothing. have similar set guests e.g. @if (auth::guest()) <li><a href="{{ url('/auth/login') }}">login</a></li> <li><a href="{{ url('/auth/register') }}">register</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ auth::user()->name }} <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="{{ url('/profile') }}">profile</a></li> <li><a href="{{ url('/auth/logout') }}">logout</a></li> ...

eclipse - JGraph has unresolved AttributeMap on precompilation -

i writing first simple class see if install can build something. have import org.jgrapht.listenablegraph; import org.jgrapht.ext.jgraphmodeladapter; import org.jgrapht.graph.defaultedge; import org.jgrapht.graph.listenabledirectedgraph; public class some<jgraph> { private some() { listenablegraph g = new listenabledirectedgraph( defaultedge.class ); jgraph graph = new jgraph(new jgraphmodeladapter( g )); } } i working in eclipse , have jgrapgt-core , jgrapht-ext , jgraphx , jgraphx-3.2.2.0 setup user libraries. my problem when try create jgraphmodeladapter error: the type org.jgraph.graph.attributemap cannot resolved. indirectly referenced required .class files any great. jgrapht uses old jgraph 5 library visualization. org.jgraph jgraph 5, com.jgraph jgraphx. replace jgraphx libraries jgraph 5. jgraph 5 on github here .

sockets - SOCKET_RWGROUP=postfix in ClamAv? -

i have read guides install postfix on server , there written set parameter: socket_rwgroup = postfix in file / etc / default / clamav-milter installed clamav , unfortunately not have such file. how set up? i have followed instructions on page: https://greenqloud.zendesk.com/entries/74986716-how-to-make-your-e-mail-truly-green-part-2-fighting-spam in newer versions handled in /etc/clamav/clamav-milter.conf. change line: miltersocketgroup clamav miltersocketgroup postfix

c# - Post Multipart with text and file -

i'm trying send file app webservice , have write code featured form : <form action="/api/v1/photo.json" method="post" enctype="multipart/form-data"> <label for="udid">udid:</label> <input type="text" name="udid" id="udid" value="web "/><br /> <label for="file">file:</label> <input type="file" name="file" id="file" /><br /> <label for="movie">movie:</label> <input type="file" name="movie" id="movie" /><br /> <input type="submit" name="submit" value="submit"> i have picture in byte[], things tried return me internal error 500 :/

poker - Exception in thread "main" java.util.NoSuchElementException Scanner error -

i getting error , cannot figure out how fix it. class tutor couldn't figure out. poker program deals out hand, allows user replace 4 cards, , analyzes it. designed allow user play many hands want, scanner input decides if play or not isn't working , can't figure out why. here main code import java.util.*; public class poker { public static void main(string[] args) { string game = "continue"; run runpoker = new run(); system.out.println("enter 2 play hand or 1 quit game: "); while (game == "continue") { game = ((run)runpoker).playhand();//this line 18 } } } here method playhand calling, real main code import java.util.scanner; public class run { public string playhand() { int r = 1; int limit = 0; // create new, shuffled deck deck d = new deck(); hand h = d.deal(); h.sort(); system.out.println(h...

javascript - Mongoose find one and push to array of documents -

i'm new mongodb , mongoose , i'm trying use save stock ticks daytrading analysis. imagined schema: symbolschema = schema({ name:string, code:string }); quoteschema = schema({ date:{type:date, default: now}, open:number, high:number, low:number, close:number, volume:number }); intradayquotesschema = schema({ id_symbol:{type:schema.types.objectid, ref:"symbol"}, day:date, quotes:[quotesschema] }); from link receive information every minute: date | symbol | open | high | low | close | volume 2015-03-09 13:23:00|aapl|127,14|127,17|127,12|127,15|19734 i have to: find objectid of symbol (aapl). discover if intradayquote document of symbol exists (symbol , date combination) discover if minute ohlcv data of symbol exists on quotes array (because repeated) update or create document , update or create quotes inside array i'm able accomplish task without veryfing if quotes exists, method can creates repeat...

php - distribute a number without remainder -

i want distribute item specific pieces without cutting excess piece, example: $persons = 7; $rooms = 2; for($i = 0; $i < $rooms; $i++) { //distribute persons per room } //the endpoint should $the_room[0] = 4 //instead of 3.5 $the_room[1] = 3 //instead of 3.5 how approach first equally distributes pieces, randomises remainder? $persons = 7; $rooms = 2; $the_room = array(); for($i = 0; $i < $rooms; $i++) { $the_room[$i] = floor($persons / $rooms); } // random distribution while( $persons - array_sum($the_room) > 0) { $the_room[array_rand($the_room)]++; } // sequential distribution // $index = 0; // while( $persons - array_sum($the_room) > 0) // { // $the_room[$index++]++; // } print_r($the_room);

Android cannot start Activity - java.lang.RuntimeException: Unable to start activity ComponentInfo -

here's problem that's getting me, whenever try launch application's main activity, error in logcat: java.lang.runtimeexception: unable start activity componentinfo{me.kworden.atic/me.kworden.atic.mainactivity}: android.content.res.resources$notfoundexception: resource id #0x7f0c00a9 the stack trace says problem super.oncreate(savedinstancestate) in oncreate() method, frustrating me, because can't control superclass method. the content layout i'm using linearlayout , don't think necessary see xml file, although post on request. i've seen other similar problems on so, answers "clean/rebuild project" hasn't done me. i'm using android studio ver. 1.1.0 if known problem, haven't seen known bugs. here mainactivity, i've stripped out of code in order pinpoint problem, seems super.oncreate culprit; despite being extremely barebones, app still fails start (i.e. "unfortunately, app has stopped."). import andro...

c++ - Unwanted Carriage Returns in ofstream -

Image
this question has answer here: why ofstream insert 0x0d byte before 0x0a? 1 answer the following c++ code: ofstream out("file.txt"); const char *str = "0\r\n1\r\n2\r\n"; out << str; creates following file (file.txt above): why there cr's , lf's? platform windows 7 , compiler vs 2013. the situation above cause problem of program parse file line line , program assumes every line contain data. remove empty lines want understand why when str saved, there cr's , lf's. \n outputs platform-specific newline, in case each \n written \r\n . not need manually add own \r , source of duplication.

javascript - The onclick remove affecting other button -

i have function delete button (to delete based on click) , working, when clicked on other button delete function not supposed do. how can prevent affecting other button? function mydelete() { $(document).on('click', '.item', function(){ $(this).remove(); var sum = 0; }); } you better bind 'click' event particular dom object, rather document object. please try code : function mydelete() { $('.item').on('click', function(){ $(this).remove(); var sum = 0; }); } also, looks weird me have wrap in function. simple wrapper (equivalent of "on dom load") should enough in cases : $(function(){ // code here such : $('.item').on('click', function(){ $(this).remove(); var sum = 0; }); });

c# - Deserializing descendent objects -

i'm communicating json-based api can't change. returns response object varying result object inside. typically looks this: { "ver": "2.0", "result": { "code": 0 } } for commands result object 'grown' adding properties: { "ver": "2.0", "result": { "code": 0, "hostname": "sample", "hostport": 5000 } } i've used newtonsoft attributes define objects follows: internal class rpcresponse { [jsonproperty(propertyname = "ver")] public string version { get; set; } [jsonproperty(propertyname = "result")] public rpcresponseresult result { get; set; } internal class rpcresponseresult { [jsonproperty(propertyname = "code")] public int code { get; set; } } internal class rpcextendedresponseresult: rpcresponseresult ...

vb.net - Allow user to insert a custom image -

i in middle of making vb.net (visual basic 2010 express) application when hatched idea. want users able insert own images application. how so? know has open file dialog. you can following code. if want show in picturebox, can follow below code, else can save byte data of image db. openfiledialog1.showdialog() picturebox1.image = image.fromfile(openfiledialog1.filename)

php - Pros and cons of connecting more than one database in single script -

let's user have 2 databases hosted on single host , need connect both of them can use table anytime without adding connection code multiple times. i have implemented in codeigniter adding authorization details of both databases in database.php file , load required database $this->load->database('dbname'); in script. now, core php, can like: mysql_connect ('host','user','password','port','dbname'); // connection 1 database. it connected first database. now, want connect second database: 1) have not closed above connection , connected second 1 mysql_connect ('host','user','password','port','dbname1');. 2) bad practice ? consume more objects ? should required close first 1 anyhow? it not neccessary open 2 connection use tables 2 databases on same server. need use database.table notation. doing means can join tables different databases in same query...

jquery - Column filter on button click in datatables -

morning all, new datatables, python , jquery bear me. i'm trying datatables table imported through python filter on column results on button click. i've searched answers already, seem geared around text filters or selector filters, isn't i'm looking for. here's jsfiddle mockup created: https://jsfiddle.net/4m5up9bx/2/ <div align=center><a href="a" class="navy small btn">mapping tools</a> <a href="b" class="teal small btn">charting tools</a> <a href="c" class="green small btn">analyzing data</a> <a href="d" class="yellow small btn">programming tools</a> <a href="e" class="orange small btn">other data tools</a></div> <table id="tools" border=1 cellpadding=7> <thead> <th>program</th> <th>type</...