Posts

Showing posts from February, 2013

sql server - SSIS connection to Informix does not save password -

i'm using ssis 2012 connect informix database (avaya cms) via n ado net connection. i've set debugging run64bit false in project properties. should use 32bit informix openlink drivers. we've got openlink odbc connection set works access , i'm able create connection manager in ssis with. when enter password in connection manager , test connection it's fine. i go create ado net datasource , prompted input password. fine , can see tables cms , choose 1 data source. when go preview errors: whole lot of error [hy010] [openlink][odbc][driver]function sequence error followed @ end at system.data.odbc.odbcdatareader.nextresult(boolean disposing, boolean allresults) @ system.data.odbc.odbcdatareader.close(boolean disposing) @ system.data.odbc.odbcdatareader.close() @ microsoft.sqlserver.dts.pipeline.datareadersourceadapter.reinitializemetadata() @ microsoft.sqlserver.dts.pipeline.managedcomponenthost.hostreinitializemetadata(idtsmanagedcomponentwr...

java - multiple columns with two foreign key column in Hibernate -

i have 3 tables: 1. @table(name = "vrtl_pi_boi_dlvr") vrtlpiboidlvr private list<vrtlpiboidlvractions> vrtlpiboidlvractions; @onetomany(mappedby = "vrtlpiboidlvr", fetch = fetchtype.eager,cascade = cascadetype.all) @fetch(value = fetchmode.subselect) @cache(region = "business", usage = cacheconcurrencystrategy.read_write) public list<vrtlpiboidlvractions> getvrtlpiboidlvractions() { return vrtlpiboidlvractions; } public void setvrtlpiboidlvractions( list<vrtlpiboidlvractions> vrtlpiboidlvractions) { this.vrtlpiboidlvractions = vrtlpiboidlvractions; } 2. @table(name = "vrtl_pi_boi_dlvr_actions") vrtlpiboidlvractions private list<vrtlpiboidlvrifn> vrtlpiboidlvrifn; private vrtlpiboidlvr vrtlpiboidlvr; @onetomany(mappedby = "vrtlpiboidlvractions", fetch = fetchtype.eager,cascade = cascadetype.all) @fetch(value = fetchmode.subsel...

how to protect request information from 3rd party android apps using python -

how protect request information 3rd party android apps using server side. hello, can help, how identify 3rd party android apps , protect access 3rd party assuming using rest-based setup might want using ssl certificates , use https verification , signal protection. for simpler solution, use pre-shared-key , put in header of request. with said setup safe key management. encryption , information security hard . good luck!

java - How do I exit my program without using return and System.exit()? -

so code :- import java.io.*; class railways { bufferedreader br=new bufferedreader (new inputstreamreader(system.in)); void main () throws ioexception { system.out.print("\f"); system.out.println("welcome irctc railway reservation system! please proceed further book train!"); system.out.println(); string[] trainname = {"rajdhani exp", "aug kranti exp", "chennai exp", "aravali exp", "paschim exp", "gareeb rath", "punjab mail", "dehradun exp", "swaraj exp", "aravali exp"}; int[] trainno = {57835, 87612, 15384, 16512, 65265, 51654, 31543, 56416, 85484, 78455}; string[] origin = {"mumbai", "mumbai", "delhi", "kolkata", "mumbai", "goa", "durg", "aligarh", "jaipur", "bhuj"}; string[] destination = {"surat", ...

r - Plot barplot as density plot in ggplot -

Image
could me plot data below density plot colour=variable ? > head(combined_length.m) length seq mir variable value 1 22 tgaggtattaggttgtatggtt mmu-let-7c-5p ago1 8.622468 2 23 tgagggagtaggttgtatggttt mmu-let-7c-5p ago1 22.212471 3 21 tgaggtagtaggttgcatggt mmu-let-7c-5p ago1 9.745199 4 22 tgaggtagtatgttgtatggtt mmu-let-7c-5p ago1 11.635982 5 22 tgagttagtaggttgtatggtt mmu-let-7c-5p ago1 13.203627 6 20 tgaggtagtaggctgtatgg mmu-let-7c-5p ago1 7.752571 ggplot(combined_length.m, aes(factor(length),value)) + geom_bar(stat="identity") + facet_grid(~variable) + theme_bw(base_size=16 i tried without success: ggplot(combined_length.m, aes(factor(length),value)) + geom_density(aes(fill=variable), size=2) error in data.frame(counts = c(167, 9324, 177, 150451, 62640, 74557, 4, : arguments imply differing number of rows: 212, 6, 1, 4 i want this: http://i.stack.imgur.com/qi...

python - Homebrew, Python3 and additional packages -

i installed python3 homebrew: $ brew install python3 everything went fine, python3 installed additional packages: gdbm, openssl, python3, readline, and sqlite. i'm using os x yosemite , not sure if replacing openssl idea. know opinion. far know openssl part of os x base system. your time appreciated. thank you. the whole point of homebrew never replaces on host system. contained in own package hierarchy under cellar . version of openssl used other packages installed homebrew.

ruby on rails - Using a joins query with multiple conditions -

i have query supposed fetch category names based on conditions. every category has number of subcategories, , every subcategory has providers. want display categories subcategories number of providers positive. doing this: controller @categories = category.with_providers model: category.joins(subcategories: [:service_providers]).uniq based on task need show categories service_providers count more 0 and there @ least 1 provider published: true property. my legacy problem here categories not relate service_providers. categories have subcategories subcategories have service providers this problem solved establishing through connection on category provider relation, since have spent time trying write correct query on initial question, know answer it. you don't need check condition service_providers count more 0 , since joins applies inner join . need is: category.joins(subcategories: [:service_providers]).where(service_providers: {published: true}) ...

c# - log4net - Append errors to an xml file -

i trying append error xml file, not able append way wanted. i using custom layout overriding xmllayout format method shown below. public class myxmllayout : log4net.layout.xmllayout { public static bool isfirsttime = true; protected override void formatxml(system.xml.xmlwriter writer, loggingevent loggingevent) { if (isfirsttime) { writer.writestartdocument(); writer.writestartelement("exceptions"); } writer.writestartelement("exception"); writer.writestartelement("error"); writer.writeattributestring("date", loggingevent.timestamp.touniversaltime().tostring()); writer.writeattributestring("user", loggingevent.username); writer.writestring(loggingevent.renderedmessage); writer.writeendelement(); writer.writeendelement(); if (isfirsttime) { writer.writeendelement(); write...

c# - HtmlElement setAttribute access denied -

i have class called input.cs, i'm passing existing form instance in constructor. then there code: private async task populateinput(htmlelement file, string value) { file.focus(); var populatetask = task.delay(500).continuewith((_) => { file.setattribute("value", value); // <- access denied error }, taskscheduler.fromcurrentsynchronizationcontext()); await populatetask; await task.delay(500); } public async task populate(string fieldselector, string fieldidentificator, string value, string fieldtype = "input") { var elements = mainform.webbrowser.document.getelementsbytagname(fieldtype); foreach (htmlelement file in elements) { if (file.getattribute(fieldselector) == fieldidentificator) // example file(input?) name == title { file.focus(); if (fieldtype == "input") { await populateinput(file, value); } ...

java - Getting distinct elements from HTML -

i want distinct elements contains text, html page, such redundancy minimal. example: <div class="business_card"> <p><span id="title"><b><a href="board" target="_self">john abc</a></b></span> <br> director <br> 123 456 78<br> <span class="email"> <a href="mailto:john.abc@example.com">send me email &raquo;</a> </span></p> </div> for above html have these items element : <a href="board" target="_self">john abc</a> <a href="mailto:john.abc@example.com">send me email &raquo;</a> <p>director<br>123 456 78</b> here code have written, far it's working quite well, except on above example, text director 123 456 78 not collected. tried add || element.owntext() != "" after !element.isblock() causes m...

sql server - Equivalent to Compiler Options in T-SQL -

i have database running customers under sql 2012 , other under sql 2014. want use in memory tables , - possible - native compiled procedures access them. is there way write create / alter procedure functions in way (for example compiler options) same sql script file runs under 2012 , 2014 , adds native keyword under 2014? of course, duplicate procedure , use simple if check server version / configuration / whatever , run either script native_compilation or 1 without duplicated code tends differ in unwanted lines, particularly if not 10-liner procedure :-( example (with delphi compile option syntax): create procedure dbo.compute_salaries @datefrom date {$ifdef inmemoryon}with native_compilation{$endif} begin declare ... another purpose of using "compiler options" be, name of partition schemes / functions differ , nice have way create new tables / indexes without duplicating create script or using dynamic sql.

batch file - Prompted by "Google Chrome didn't shut down correctly.... " -

using google chrome 38.0.2125.111 m in windows 7 environment. launched batch file & set go specific (internal) url. windows environment going locked down, permitting handful of options available user. chrome being used because ie accessing different site. without going boring detail, using both sites on single browser allowed user access account wasn't theirs. both browsers launched using 1 of 2 batch files. chrome batch file supplies username & password bypass login screen on application. to keep opening multiple windows in chrome, following batch file used: taskkill /f /t /im chrome.exe > nul ping -n 3 127.0.0.1 > nul start /max chrome "http://myinternalwebsite?uid=x&pwd=y" taskkill used close chrome (/f = force /t = terminates process & child ones /im = image name). if chrome session closed (using x @ upper right corner of screen), batch file works fine. however, if there chrome instance running, yellow bar frowning folder ...

How to write a c++ program using linux system call which gives output about free memory, used memory, kernel version? -

on linux system, using c++ program, need find way print out following information: amount of memory in use. amount of free memory linux kernel version. can me on how achieve this? thank you. you use proc(5) file system (it specific linux). might read sequentially /proc/meminfo , /proc/version (these pseudo-files should read sequentially, , quick, not involving disk io). use uname(2) version of kernel. if want query virtual memory own process , use /proc/self/maps if need information related malloc(3) , use malloc_info(3) , mallinfo(3) , malloc_stats(3) , ... the comment mlwn mentions rightly sysconf(3) see linuxatemyram . , read advanced linux programming it possible limit used (or available) memory, see this answer . use getrlimit(2) query resource limits. ps. mention of amount of memory in use very ambiguous ! notice syscalls(2) not same system(3)

php - Unresolvable dependency resolving in Laravel Repository -

i'm having "unresolvable dependency resolving [parameter #1 [ $mainpage ]]" error after trying manage dependency injection in repository. i've managed build controller, repository, interface , service provider. missing here? i'm doing wrong in logic? home controller use repositories\mainpagerepository; class homecontroller extends basecontroller { protected $cpage, $mainpage; public function __construct(mainpagerepository $cpage, $mainpage) { $this->cpage = $cpage; $this->mainpage = $mainpage; } public function getpages($lang, $slug) { $cpage = $this->cpage->getcurrentpage($lang, $slug); $mainpages = $this->mainpage->getallmainpages($cpage); $allpages = $this->getallpages($mainpages); return view::make('index') ->with('cpage', $cpage) ->with('mainpages', $mainpages) ->with('allpages', $allpages); } private function getallpages($pages) { $allpage...

Augmented Reality with Cordova, javascript -

i'm working on project consists developing application allows visualize geolocated elements using camera device. have implement augmented reality based on geolocations services. i have develop application javascript/cordova including plugins. don't have modify things directly in native code, using cordova specifications. i've made research , i've found 3 things. 1) wikitude: plugin cordova, perfect kind of implementation. big problem: not free! i'm developing not myself start-up not applicable. maybe there way use wikitude without "trial" text in middle of screen, didn't find it. 2) intel xdk: main problem here have install new software allows use functionalities of api , not convenient if want use javascript/cordova. moreover, demos don't work me (maybe wrong manipulation) 3) simulate video background capturing image camera every ms approximately (maybe every cs) , continusly update canvas in background (works film if want). problem:...

json - Retrieving the keys in the insertion order with ng-repeat -

i have json string assigned angular model , used loop through , display key , value on ui . <tr ng-repeat="(key,value) in profile> <td>{{key}} :</td> <td>{{value}}</td> </tr> this works except order of keys not same model or model looks below "profile": { "userid": 1234, "user name": "somename", "email address": "someone@yahoo.com", "age": 29, "occupation": "" } the out put , in same order json string , how can achieve it? age :29 email address : someone@yahoo.com occupation : userid : 1234 user name : somename your need workaround objects unordered, described in question : here workaround expressed example: or jsfiddle : html <div ng-controller="myctrl"> <table> <tr ng-repeat="key in keys(profile)"> <td>{{key}}: {{profile[key]}}...

c# - I still can't clear the rectangle i drawn over a control inside OnPaint event why i can'y clear it? -

by clear mean redraw or paint or color control it's original. working code: using system; using system.componentmodel; using system.collections.generic; using system.diagnostics; using system.text; using system.threading; using system.windows.forms; using system.drawing; namespace ftp_progressbar { public partial class form1 : form { public form1() { initializecomponent(); txthost.textchanged += anytextbox_textchanged; txtuploadfile.textchanged += anytextbox_textchanged; txtdir.textchanged += anytextbox_textchanged; anytextbox_textchanged(null, null); if ((txthost.text == "") || txtuploadfile.text == "") { btnupload.enabled = false; } if (txtdir.text == "") { checkbox1.enabled = false; } } private void anytextbox_textchanged(object sender, ...

mysql - ruby on rails file download binary files from the database and provide a link -

i have 3 files in mysql database. 2 of them of type 'text' , 1 'longblob'. |username| |pem | |key | |cert | |test1 | |some text| |some text | | binary text | |test2 | |some text| |some text | | binary text | i can query them , have array activerecord relation object in @user_files variable. now, want create 3 files filename1.pem, filename1.key, filename1.cert each user , provide them link download. something like: <%- @user_files.each |user_info| %> <tr> <td><%= link_to 'download files', download_path(user_info) %></td> </tr> <% end %> here had in mind far in controller: def download(user_file) temp = tempfile.new("temp-filename-#{time.now}") zip::zipoutputstream.open(temp.path) |z| z.put_next_entry("some_name.pem") z.print io.read(user_file.pem) z.put_next_entry("some_name.key") z.print io.read(user_fil...

r - How to call top level from lapply loop (skip/pass) -

i want create lapply loop if attends requirement, stop... example: score <- 0 lapply(1:100, function(z){ score <<- score + 1 if(score >=10){ break } }) however, there no stop argument break/pass in lapply loop. i know example sounds stupid. however, original code has many dependencies understood... original loop removes item vector object every time, however, if there nothing else removed can stop. i've gain @ least 0.10 seconds in normal loop short sized function with normal "for loop" skip argument > time <- system.time({cyclopeptide_score(sequence, spectrum)}) > time usuário sistema decorrido 6.58 0.00 6.58 with laplly no skip argument > time <- system.time({cyclopeptide_score2(sequence, spectrum)}) > time usuário sistema decorrido 6.72 0.00 6.72 to directly answer question, here option (assuming have control of code lapply happens, , of functio...

php - Add first name and last name automatically on facebook registration for wordpress user -

i'm using code create facebook user when logging facebook connect button: if($_request['option'] == "fblogin"){ global $wpdb; $appid = get_option('afo_fb_app_id'); $appsecret = get_option('afo_fb_app_secret'); $facebook = new facebook(array( 'appid' => $appid, 'secret' => $appsecret, 'cookie' => true, )); $fbuser = $facebook->getuser(); if ($fbuser) { try { $user_profile = $facebook->api('/me'); } catch (exception $e) { echo $e->getmessage(); exit(); } $user_fbid = $fbuser; $user_email = $user_profile["email"]; $user_fnmae = $user_profile["first_name"]; if( email_exists( $user_email )) { // user member $user = get_user_by('login', $user_email ); $user_id = $user->id; wp_set_a...

excel - Get Top Performer by Subgroup Using Index and Match -

Image
i trying rank names in column c largest smallest score. category score name total rank apple rank orange rank apple 10 joe rachel rachel 0 orange 15 don natalie 0 natalie apple 20 james tom tom 0 apple 1 rob nothing nothing 0 orange 3 mary gina 0 gina orange 100 rachel james 0 james orange 99 natalie don 0 don orange 87 tom joe 0 joe apple 27 gina mary mary 0 orange 30 nothing rob 0 rob this works in column e apples , oranges, formula in e2 =index($c$2:$c$25,match(1,index(($b$2:$b$25=large($b$2:$b$25,rows(e$1:e1)))*(countif(e$1:e1,$c$2:$c$25)=0),),0)) however, goal compare apples apples , oranges oranges. only, formulas in columns f , g show "0" values rows aren't in right apple/orange category. for f2: =if($a:$a="apple",index($c:$c,match(1,index(($b:$b=large($b:$b,rows(f$1:f1)))*(countif(f$1:f1,$c:$c)=0),),0)),0) for g2: =if($a:$...

sql - jMeter: randomizing queries across an list of key values -

i using jmeter conduct series of database load tests. database table contains several billion transactions ~500k key values. need issue queries retrieve records randomized key values. easy if key values numeric , consecutive, randomize across numeric range of values (0 .. 500000) - strings, need extract distinct list of key values first jmeter can pick random values issue queries. can query key values database, or place them in csv @ start of each test run. performance test, , machine has lots of memory, prefer if jmeter can load key values memory before beginning test. i dont know best technique use configure jmeter pick randomized values list - there technique this? thanks! i believe __stringfromfile function can help. reads next string input file (or multiple files) each time being called. when end of file reached function starts on beginning. extended information on using , other jmeter's functions check how use jmeter functions post series.

Get column values after doing a Find in Excel using VBScript -

i use following code find specific text in whole excel sheet , able specific cell. information, wanted read each of column values active row. dim objxl const xlwhole = 1 set objxl = createobject("excel.application") objxl.workbooks.open ("c:\config.xls") set objworksheet = objxl.worksheets("sheet1") set objrange = objworksheet.usedrange set objtarget = objrange.find("honda", , , xlwhole) ' searched value on column 3. i tried using offset method , seems work: msgbox objtarget.offset(, -2).value the excel sheet has 7 columns , passing -2 offset method gets me value in first column. how first , last column indexes dynamically row pass them offset method. or better, able column values based on column names. thanks. not entirely clear want, first cell in row probably: cells(objtarget.row, objrange.column) and last cell cells(objtarget.row, objrange.columns(objrange.columns.count).column) a range object representing...

inheritance - Why don't Java's number classes extend each other? -

in java, why don't built-in number classes extend each other? shouldn't long extend integer extends short extends byte, , double extend float? in general, inheritance used when there's "is a" relationship. every integer long? think so. the possible explanation can think of overflow won't handled correctly. example, (byte)100 + (byte)100 -112 , whereas (short)100 + (short)100 200 . however, seems there should better reason preserving buggy behavior. you question can approached in 2 different ways: if talking primitives, have relationship backwards. but, if asking integer , double , long , etc. classes, there relationship between numbers. it's important point out numbers objects in java stem common number class found here . doesn't make sense break them down in hierarchy how described because methods between numbers same, despite varying sizes in memory take up. in short, hierarchies in java defined relationships (typically me...

php - Give unique value for submit button -

in table each , every row has cell submit button. here code <?php # init mysql connection mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("selfie") or die(mysql_error()) ; # prepare select query $selectsql = 'select * `image_upload` inner join user_table on image_upload.user_id=user_table.user_id flag="0" order timestamp desc'; # execute select query if( !( $selectres = mysql_query( $selectsql ) ) ){ echo 'retrieval of data database failed - #'.mysql_errno().': '.mysql_error(); }else{ ?> <table border="2"> <thead id="head"> <tr> <th id="head">user name</th> <th>category</th> <th>description</th> <th>image</th> <th>location</th> <th>status</th> </tr> </thead> ...

javascript in php: Document.forms not function -

in php: if (isset($close_subject)) { $sql_close = "delete content_tree user_id='$id' , subject_id='$close_subject'"; $result_close = mysql_query($sql_close); } function xxx() { <a href="#" onclick="closesubject('<? echo $set_subject[subject_id] ?>')"><img border="0" align="absmiddle" src="../../pic/tree/open.png"></a> } in html: xxx(); <script type="text/javascript"> function closesubject(id) { document.close_subject_form.close_subject.value = id; document.close_subject_form.submit(); } </script> <form name="close_subject_form" method="post"> <input type="hidden" id="close_subject" name="close_subject"> </form> hi, have codes above. wan delete record in database. not function >.< can help? function deleteshit($id,$close_subject){ mysql_quer...

php - MySQLi query looping over array returns throws Undefined offset: 1 -

i performing queries. problem looping on array throws undefined offset: 1 this code used: $id=1; $books=""; $prep_stmt= "select * books id=?"; $stmt = $mysqli->prepare($prep_stmt); $stmt->bind_param('i', $id); $stmt->execute(); if (!$stmt) { die('there error running query [' . $mysqli->error . ']'); exit(); } $meta = $stmt->result_metadata(); while ($field1 = $meta->fetch_field()) { $parameters[] = & $row[$field1->name]; } call_user_func_array(array($stmt, 'bind_result'), $parameters); while ($stmt->fetch()) { foreach ($row $key => $val) { $x[$key] = $val; } $results[] = $x; } if ($stmt->num_rows>0){ ($i = 0; $i <= sizeof($results[0]) - 1; $i++) { $id=$results[$i]['id']; $name=$results[$i]['name']; $books=$books."<option value='".$id."'>".$naziv."</option>"...

Ruby on Rails saving two fields and combining them as a third -

i have authors model, has first_name last_name full_name i need 3 because when searches author, need search through full names, when sort them, need sorted last name , can't separate them on space, because authors might have more 2 names. so, in form user creates new author, have 2 entry fields - first_name , last_name. since adding third field full_name bad, , putting hidden field combines value of first/last names bad, wondering how can have 2 fields, on save combine values , save full_name column, without having field, hidden or not? authors_controller.rb class authorscontroller < applicationcontroller def index @authors = author.order(:last_name) respond_to |format| format.html format.json { render json: @authors.where("full_name ?", "%#{params[:q]}%") } end end def show @author = author.find(params[:id]) end def new @author = author.new end def cr...

Find and delete files that contain same string in filename in linux terminal -

i want delete files folder contain not unique numerical string in filename using linux terminal. e.g.: werrt-110009.jpg => delete asfff-110009.jpg => delete asffa-123489.jpg => maintain asffa-111122.jpg => maintain any suggestions? i understand question, think. want remove files contain numeric value not unique (in particular folder). if filename contains value found in filename, want remove both files, right? this how (it may not fastest way): # put files in folder in list # array=(*) work make sure have enabled nullglob: shopt -s nullglob array=(*) delete=() elem in "${array[@]}"; # each elem in list extract number num_regex='([0-9]+)\.' [[ "$elem" =~ $num_regex ]] num="${bash_rematch[1]}" # use extracted number check if unique dup_regex="[^0-9]($num)\..+?(\1)" # if not unique, put file in files-to-delete list if [[ "${array[@]}" =~ $dup_regex ]]; delete...

android - Putting WebView in ScrollView causes WebView to not display content -

i have simple relativelayout elements inside. <!-- header bar --> <linearlayout android:id="@+id/header_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true"/> <!-- note header view --> <framelayout android:id="@+id/note_header_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_below="@id/header_bar"/> <!-- web view container view --> <framelayout android:id="@+id/web_view_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/note_header_view"/> i trying place these elements in scrollview: <scrollview android:layout_width="fill_parent" android:la...

windows - How to automatically create folder with name being current day and move existing files and subfolders into that folder? -

i need simple tool repeating job. wrote commands in text file , saved file *.bat file. create new folder current day in month folder name. example: today 13-11-14 (format date: dd-mm-yy) md=%date:~0.2% created folder: 13 move existing files or folders folder 13 . example: before batch file execution current folder contains: folder a folder b file c file d after batch file execution current folder should contain: 17 folder a folder b file c file d i drew image show need. i don't know how write second part of task. which commands needed move files , subfolders in current folder new folder name of current day in month? okay, here small batch file task comments , check. @echo off rem name of batch file in case of being in current directory, too. rem verified if batch file executed in current directory. set "batchfilename=" if "%~dp0"=="%cd%\" set "batchfilename=%~nx0" rem current day of mon...

Python: how to use Python to generate a random sparse symmetric matrix? -

Image
how use python generate random sparse symmetric matrix ? in matlab, have function " sprandsym (size, density) " but how in python? if have scipy, use sparse.random . sprandsym function below generates sparse random matrix x, takes upper triangular half, , adds transpose form symmetric matrix. since doubles diagonal values, diagonals subtracted once. the non-zero values distributed mean 0 , standard deviation of 1. kolomogorov-smirnov test used check non-zero values consistent drawing normal distribution, , histogram , qq-plot generated visualize distribution. import numpy np import scipy.stats stats import scipy.sparse sparse import matplotlib.pyplot plt np.random.seed((3,14159)) def sprandsym(n, density): rvs = stats.norm().rvs x = sparse.random(n, n, density=density, data_rvs=rvs) upper_x = sparse.triu(x) result = upper_x + upper_x.t - sparse.diags(x.diagonal()) return result m = sprandsym(5000, 0.01) print(repr(m)) # <5000x5...

objective c - What can't be stored in NSDictionary? -

i have online quiz trying complete , question: one of following can't stored in nsdictionary. can't stored because _____ type: uiview nsnumber nsinteger uicolor fill in in blank. i can't seem find answer anywhere online. far can tell have way of being stored in nsdictionary, ideas? nsinteger! because it's primitive type

asp.net - COM Service Error: Received an unexpected EOF or 0 bytes from the transport stream -

i have .net application uses 3rd party web service authentication. my code: var sso = new com.myclient.auth.service(); string userid = sso.decryptuser(encrypteduserstring, decryptionkey); this has been working quite time. i've since been forced convert application .net 2.0 in vs 2008 .net 3.5 in vs 2010 , no longer works. error @ "decryptuser": "received unexpected eof or 0 bytes transport stream". i don't see changes made code during conversion. tried used solution error of forcing securityprotocoltype.ssl3 -- did not work either. if revert vs 2008 , build, page works -- no error. okay -- did full file compare entire project, , found change in properties/settings.designer.cs occurred during vs conversion: public string myproj_com_myclient_auth_service { { string urlsetting = system.configuration.configurationsettings.appsettings["com.myclient.auth"]; if (urlsetting != null) { ...

javascript - How to rotate an image when reaching the footer -

i have navigation arrow on website http://samverdycktest.be/marcuscatering/index-nl.html want rotate points top when reached footer. , ofcourse has scroll upfront when clicked on. the arrow has scrolling effect on it, didn't figure out yet how rotate elements , change scrolling effect when reaching points @ website. this de link/arrow element: <a href="footer" class="to-the-bottom"> <i class="fa fa-arrow-circle-o-bottom"></i> </a> try below, have used javascript instead of jquery in case not using jquery library. jsfiddle html <i id="icon" class="fa fa-arrow-circle-o-bottom"></i> js // function detect when scroollbar reaches bottom of page var whenscrlbottom = function() { // http://coursesweb.net/javascript/ var win_h = (self.innerheight) ? self.innerheight : document.body.clientheight; // gets window height // gets current vertical scrollbar position ...

makefile - How do I tell GNU make to remove intermediate files right away? -

i'm using make automate creation of file depends on several other files, each of depends on intermediate file being created, , on file on hard drive. / \ a1 a2 | | b1 b2 | | file1 file2 all depends on a1 , a2 , depend on intermediate files b1 , b2 , in turn made file1 , file2 on hard drive. here's makefile. all: $(patsubst %, a%, 1 2) echo "making all" a%: b% echo "making $@ $^" b%: file% echo "making $@ $^" when make -n , see following output (after touching file1 , file2 ). echo "making b1 file1" echo "making a1 b1" echo "making b2 file2" echo "making a2 b2" echo "making all" rm b1 b2 my problem b1 , b2 extremely large, , can't keep them both on hard drive @ same time (in real situation, it's not 2 dozens of these files). there way tell make dispose of b1 a1 finished, before starting make a2 ? in other words, see fol...

java - How can I resort (RowSort) after an insert in JTable? -

i know: how can reorder (re-sort) jtable rows after insert row? i use next code: tablemodel model = new defaulttablemodel(rows, columns) { public class getcolumnclass(int column) { class returnvalue; if ((column >= 0) && (column < getcolumncount())) { returnvalue = getvalueat(0, column).getclass(); } else { returnvalue = object.class; } return returnvalue; } }; jtable table = new jtable(model); rowsorter<tablemodel> sorter = new tablerowsorter<tablemodel>(model); table.setrowsorter(sorter); jscrollpane pane = new jscrollpane(table); this code works fine, , can add new rows without problem, want after insert new row re-sorts again using first column asc... if want real time updates, try calling tablerowsorter#setsortsonupdates on tabkerowsorter , pass true ... otherwise, if want control when updates sorted, call tablerowsorter#sort if want modify sort order programically, take @ sorting , filtering ...

ios - Create static librarys including different components -

in static library including different components, , want package libraries including several components meet requirement of different developers. for example have 4 .m files a.m b.m c.m d.m for 4 modules. now want create 1 target compile sources, create shell targets package kinds of libraries, example if there target called createlibrarywitha&bcomponent, want compile a.m , b.m in compile sources of build phases. know can use xcodebuild command gcc_preprocessor_definitions="a=1 b=1 " create create library , b components, don't know how control including or excluding compile files.

c# - Programmatically set WinRt button content to image -

for given button control in winrt want dynamically set it's content image. have thought dead simple: _subjectfileposter = new bitmapimage(); _subjectfileposter.setsource(t); _btnplayvideo.content = _subjectfileposter; but it's not, instead button typename windows.ui.xaml.media.imaging.bitmapimage written on it. need set content <image> , <image> 's source bitmapimage _subjectfileposter = new bitmapimage(); _subjectfileposter.setsource(t); image = new image(); i.source = _subjectfileposter; _btnplayvideo.content = i;

com - IServiceProvider::QueryService returned E_INVALIDARG in mfc -

i working on small application. want embed activex control , want remote in mfc application. need iserviceprovider interface of com. iserviceprovider gives access of iwmpremotemediaaccess interface. using this: but returnes e_invalidarg every time. can tell me problem. ioleobject* oleobject; ccomptr<iserviceprovider> m_spprovider; ccomptr<iwmpremotemediaservices> m_spservices; hresult hr = cocreateinstance(__uuidof(windowsmediaplayer), 0, clsctx_inproc_server, iid_ioleobject, (void**)&oleobject); hr = oleobject->queryinterface(__uuidof(iserviceprovider), (void**)&m_spprovider); if(succeeded(hr)) { //here return e_invalidarg (hr = e_invalid_arg) hr = m_spprovider->queryservice(__uuidof(iwmpremotemediaservices), iid_iserviceprovider, (void**)&m_spservices); } i not able understand argument wrong. more sure first argument. can tell me be. thank iwmpremotemediaservices interface supposed implement on side, not query via query...

angularjs - Searching a map and retrieving key if matching -angular js -

angular-js searching map , retrieving key if matching user given input key my map luks this var mymap= { k:1000, l:100000, m:1000000, c:10000000 }; if user input "l" , want search map , retrieve l along value "100000" , further operation as mymap object (aka associative array, aka hash) can access value using [] operator. angular.module('mymodule', []) .controller('mycontroller', function($scope) { $scope.mymap = { k:1000, l:100000, m:1000000, c:10000000 }; }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app='mymodule' ng-controller='mycontroller'> <input type='text' ng-model='mymapkey' /> <p>mymap value = {{mymap[mymapkey]}}</p> </div>

How to Add An array into Array index by index in iOS? -

i newbie in ios development. want add json parsing data dictionary array key value in array add last array index in new array. my code -(void)fetcheddata:(nsdata *)responsedata { if (responsedata.length > 0) { nserror* error; self.json = [nsjsonserialization jsonobjectwithdata:responsedata options:kniloptions error:&error]; if ([[_json objectforkey:@"data"] iskindofclass:[nsarray class]]) { nsarray *arr = (nsarray *)[_json objectforkey:@"data"]; [self.imagearray addobjectsfromarray:arr]; [self.storeviewtable reloaddata]; } self.storeviewtable.hidden=false; } nsmutablearray *imagearray=[[nsmutablearray alloc]init]; (index=0; index <[self.imagearray count]; index ++) { for(nsdictionary *dict in self.imagearray ) { imagearray = [dict valueforkey:@"demopage"]; self.imagesa = imagearray; } } nslog(@"array count %d...

mysql - Second inner join doubles count result -

i have tables a, b , c. has many b , c. have 6 b records , half of them marked deleted (deleted_at != null). when select query select a.id, count(b.id) table_a inner join table_b b on a.id = b.a_id , b.deleted_at null a.id = 5; answer correct (id: 5, count: 3) but when add 1 more inner join select a.id, count(b.id) table_a inner join table_b b on a.id = b.a_id , b.deleted_at null inner join table_c c on a.id = c.a_id , c.deleted_at null a.id = 5; it doubles count result (id:5, count: 6) how can fix it? as othered have mentioned can count distinct b ids here. however, problem quite common when 1 needs aggregates various tables. problems occur, because people join records , try aggregates. for instance: select a.id, sum(b.value) table_a inner join table_b b on a.id = b.a_id , b.deleted_at null inner join table_c c on a.id = c.a_id , c.deleted_at null a.id = 5; this same query yours. here cannot use distinct anymore, because if had values 100, 200, 20...

c# - EF - How to make (composite) foreign key optional -

i have 3 models: order, organisation , orderorganisation. orderorganisation's existence not mandatory... don't know how tell ef. currently, if write queries using inner joins instead of outer joins join orderorganisation. i part of model (if possible) , not in context (as it's large database , think using context fragments logic). here models. public class order { public int id { get; set; } public virtual icollection<orderorganisation> orderorganisations { get; set; } } public class organisation { public int id { get; set; } public virtual icollection<orderorganisation> orderorganisations { get; set; } } public class orderorganisation { [key, column(order = 0)] public int orderid { get; set; } [key, column(order = 1)] public int organisationid { get; set; } [foreignkey("orderid")] public virtual order order { get; set; } [foreignkey("organisationid")] public virtual organis...

linux - How can I get GDB to tell me what address caused a segfault in a core dump file -

i know when gdb attach process, can use p $_siginfo._sifields._sigfault.si_addr show address caused segfault. but, how in core dump file? i try in core dump file: (gdb) p $_siginfo._sifields._sigfault.si_addr unable read siginfo

Python list sorting conundrum -

i have unusual list sorting problem i'm struggling find concise , efficient way of solving. problem follows: have list called indexes each of items in list corresponding index second list data. example first number in index 0 corresponds first item in list data 1 , 3 in index corresponds 6 in list data because 6 3rd item in list data [ including 0th item ].. now want organise list data that grouped between indexes below: indexes = [ 0, 3, 6, 8, 12, 13] data = [1, 2, 5, 6, 11, 13, 15, 23, 35, 36, 38, 41, 46] solution: organised_data = [ [1,2,5], [6,11,13], [15,23], [35,36,38,41], [46] ] i've been @ ages. you can use slicing between consecutive indexes in list comprehension >>> [data[indexes[i]:indexes[i+1]] in range(len(indexes)-1)] [[1, 2, 5], [6, 11, 13], [15, 23], [35, 36, 38, 41], [46]]

javascript - Hide the iOS keyboard maintaining focus on textfield -

i somehow hide keyboard shown in ios whenever focus in textfield. when "focus", still able type in stuff external keyboard, ios virtual keyboard should not displayed. stuff previous questions not applicable: [textfield resignfirstresponder] --> hides ios keyboard cannot take input events external keyboard anymore. [view endediting: yes] --> not work. ssame above. javascript onblur() outoffocus not applicable. does out there know way hide keyboard still listen key events? i'll answer own question here, if in case stumbles on similar dilemma. most of answers out there involve losing focus textfiled or resigning first responder. when not option in case want listen keyboard event in ios webview all have implement uikeyinput in view controller. this, keyboard show up. no make keyboard disappear, reimplement custom keyboard view 0 height. if want keyboard appear transition different screen, can resign firstreponder leave screen , return n...

statistics - logistic regression with sparse predictor variables -

i modeling data using binary logistic regression. dependent variable has number of positive cases , negative cases - not sparse. have large training set (> 100,000) , number of main effects i'm interested in 15 i'm not worried p>n issue. what i'm concerned many of predictor variables, if continuous, 0 of time, , if nominal, null of time. when these sparse predictor variables take value > 0 (or not null), know because of familiarity data should of importance in predicting positive cases. have been trying information on how sparseness of these predictors affecting model. in particular, not want effect of sparse important variable not included in model if there predictor variable not sparse , correlated doesn't job of predicting positive cases. illustrate example, if trying model whether or not ended being accepted @ particular ivy league university , 3 predictors sat score, gpa, , "donation > $1m" binary, have reason believe "donation ...