Posts

Showing posts from March, 2013

xcode - How to send message to virtual port in iOS -

i'm starting project need control external device using ipad. my device connected via usb, , far know, ipad should detect virtual port, i'm having problems in finding how can make ipad app send messages device. the first part of project consist on sending messages, later i'll receiving external devices, knowing how communicate virtual port think can go on. so, questions are: 1) ipad communicate external devices connected via usb virtual ports? 2) how can send messages them? thanks to connect via usb (over lightning connector) you'll need join mfi program .

adobe - Can't open TOOL GALLERIES Illustrator CC on second monitor -

i have laptop , second display (via hdmi). in illustrator cc, trial version, can't open flyout menus(known 'tool galleries'). know how work, nothing seems trick (click , hold, right click, click on corner). when drag illustrator on laptop display, functionality reappears, flyout menus work, need use second monitor. is bug? how can fix it? i have same issue have 2 monitors , happens when illustrator open on 'second' monitor. a work-around make monitor wish use illustrator 'primary' monitor in settings (in windows 8 right click on desktop - screen resolution) - hdmi display.

sql - Comparing all data in two tables whilst ignoring certain differences -

i trying compare 2 sql server database tables. i've found various methods online, seem work, other don't. the 1 used worked was: select * table1 except select * table2 the issue (as far aware) is, table says there difference between 'null' value , '0'. correct, there difference. however question is, there way comparison difference check, whilst ignoring conditions such null , 0. you can use select isnull(column1, 0) column1 table1 except select isnull(column1, 0) column1 table2 to consider values 0 , null same. also, if wish consider more values same null = 0 = '' (empty string) you can use case: select case when (column1 null or column1 = '') 0 end column1 table1 except select case when (column1 null or column1 = '') 0 end column1 table2

javascript - Adding <ul></ul> after every 2nd <li> with angular ngRepeat -

i have ul , apply ngrepeart on li want after every 2nd li it's create new ul this. possible ? <ul> <li>simth</li> <li>aryan</li> </ul> <ul> <li>john</li> <li>mark</li> </ul> <ul> <li>cooper</li> <li>lee</li> </ul> and angular.js code function mycrtl($scope){ $scope.namelist= [{ name:'simth' },{ name:'aryan' },{ name:'john' },{ name:'mark' },{ name:'cooper' },{ name:'lee' }] } you can split array chunks. please see demo below var app = angular.module('app', []); app.controller('homectrl', function($scope) { $scope.namelist = [{ name: 'simth' }, { name: 'aryan' }, { name: 'john' }, { name: 'mark' }, { name: 'cooper' }, {

scala - Slick string sanitation -

i want perform query using sql operation string parameter. example: coffee <- coffees if coffee.name s"%$querystring%" is safe? from slick documentation : slick’s key feature type-safe, composable queries. slick comes scala-to-sql compiler, allows (purely functional) sub-set of scala language compiled sql queries [...] the fact such queries type-safe not catches many mistakes @ compile time, eliminates risk of sql injection vulnerabilities i did no try myself, think safe when using user params

performance - In R, how to modify a column in a big dataframe based on rows in a small dataframe in an efficient way -

i have big dataframe called big_set : hash is_in_small_set 1 6694662834f3d2942ec4c6af20ab0520 na 2 265e53ecdb68d360890f9aa2d99c1ebe na 3 0b7cd1f468c88de7c8bf822a77d4dc4d na # have printed first 3 rows and small dataframe called small_set : hash result 1 703a4f40f24afe5baadb03412514048f b 2 d0cabfc660bf334524e758ef5c9774a4 3 265e53ecdb68d360890f9aa2d99c1ebe c i need fill column big_set$is_in_small_set : hash is_in_small_set 1 6694662834f3d2942ec4c6af20ab0520 false 2 265e53ecdb68d360890f9aa2d99c1ebe true 3 0b7cd1f468c88de7c8bf822a77d4dc4d false i have working solution 2 nested for-loop unfortunately slow purposes nrow(big_set) 10k , nrow(small_set) 100. getrandstring<-function(len=32) return(paste(sample(c(0:9,c('a','b','c','d','e','f')),len,repl

php - Why does my mysql query takes way too long to produce results -

hi wrote following code retrieve data database, slow on execution, can have on , give few optimizing tips better performance. what happens im creating new table binding existing current data few other tables. $table_count = mysql_query("select table_name information_schema.tables table_schema = 'datamatrix' , table_name 'tracking_%' "); while($row = mysql_fetch_array($table_count)){ $trackingtable = $row["table_name"]; $update = mysql_query("select id unp $trackingtable"); $col = mysql_fetch_assoc($update); $col_id = ($col["unp"]); $var1 = mysql_query("select useragent ua trackpanel id = $col_id"); $col_ua = ($var1["ua"]); $browser = get_browser($col_ua, true); $new_timestamp = mysql_query("select timestamp $trackingtable order timestamp desc limit 1"); $col_new = mysql_fetch_assoc($new_timestamp); $new_timestamp1 = mysql_query("select timestamp $trackingtable order

ios - UIAlertView and UIButton has white buttons on white background -

Image
after upgrading dev iphone 5 ios 8.1, of buttons , default labels on uinavigationbars , uialertviews started appear on screen white text. i tried resolve problem with: // uiview tints [[uiview appearance] settintcolor:[uicolor blackcolor]]; [[uialertview appearance] settintcolor:[uicolor blackcolor]]; [[uinavigationbar appearance] setbartintcolor:[uicolor blackcolor]]; [[uibarbuttonitem appearance] settintcolor:[uicolor whitecolor]]; this somehow solved white buttons in cases, not of them. i'm still having problems alert views appearing after receiving notification in-app, navigation bar buttons , labels. has experienced problem? , if possible has solution? one cannot customize appearance of uialretview : [[uialertview appearance] settintcolor:[uicolor blackcolor]]; check apple notes in class reference : subclassing notes the uialertview class intended used as-is , not support subclassing. view hierarchy class private , must not modified.

sql - How to retrieve column name and its value from cursor -

is there way each column name , column value of each row using cursor. below, have cursor c loop through each row of table t c in (select * t) loop --something dbms_output.put_line(c.columname : c.columnvalue); end loop p/s:sorry bad english. english not native language you need use dbms_sql package instead of simple loop cursor. it's quite complex, luckily tom kyte has done work here

How to get sum of all value in for loop JavaScript? -

i tried calculate distance of truck marker on google map. var total=0; var json = result.d; obj = json.parse(json); (var = 0; < obj.length; i++) { var latlng1 = new google.maps.latlng(obj[i].lat, obj[i].lng); var latlng2 = new google.maps.latlng(obj[i+1].lat, obj[i+1].lng); var distance=(google.maps.geometry.spherical.computedistancebetween(latlng1, latlng2) / 1000).tofixed(2); total+=distance; alert(total); //it working but.like : 0.01 0.22 0.03 0.045 // want 0.01+0.022+0.03+....=total } alert(total); //does not working !! i error @ console : typeerror: obj[(i + 1)] undefined. where wrong ? try code: var total=0; var json = result.d; obj = json.parse(json); (var = 0; < obj.length -1; i++) { var latlng1 = new google.maps.latlng(obj[i].lat, obj[i].lng); var latlng2 = new google.maps.latlng(obj[i+1].lat, obj[i+1].lng); var distance=(google.maps.geometry.spherical.computedistancebetween(latlng1, latlng2) / 1000); total+=distance; }

java - OutOfMemoryError even though enough free memory -

i getting java.lang.outofmemoryerror errors, when still have enough free ram. memory dumps took between 200mb , 1gb, while server has 24gb of ram. set -xmx12288m -xms12288m . also, when try log in server, get -bash: fork: retry: resource temporarily unavailable -bash: fork: retry: resource temporarily unavailable -bash: fork: retry: resource temporarily unavailable -bash: fork: retry: resource temporarily unavailable -bash: fork: resource temporarily unavailable i narrowed down code snippet below: import org.snmp4j.snmp; import org.snmp4j.transport.defaultudptransportmapping; long n = 0; while (true) { defaultudptransportmapping transport = null; try { transport = new defaultudptransportmapping(); transport.listen(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); // } { // (*) forgot // transport.close(); // (*) forgot }

asynchronous request with callback in Apigee -

how can implement asynchronous callback scenario in apigee. for example need call host , host may take time process response. once response ready needs delivered caller/client. thanks in advance regards can not claim standard way of doing this, here design: assumption: target host must support registering call url. when client calls apigee proxy, apigee proxy in middle can generate unique callback url , send target parameter when making api request. in meantime have block client ( , start polling internal storage). the callback url proxy in apigee receives response target side , updates entry in apigee persistence store, being polled first proxy. if callback happens within x seconds, apigee proxy can send response client. if not happen within time can send error. to implement can use key value map or caching policy in apigee transient persistence store. , blocking client , polling persistence store use java or javascript policies

C++ undeclared identifier when trying to create an instance of a struct -

i have struct declared in c++ header file line: struct aii_common_export message{ ... }; i trying create instance of struct in c++ source file, can set/ use of attributes stored in struct: message data; however, when compile code, "undeclared identifier" error on line... have included header file in source file, don't understand why getting error- can explain me? i tried creating instance of with: aii_common_export message data; but got compile error: "syntax error: missing ';' before identifier 'data'. any ideas how can fix this, can create instance of struct? edit i have found aii_common_export definition- defined with: # define aii_common_export ace_proper_import_flag and ace_proper_import_flag defined with: #define ace_proper_import_flag __declspec (dllimport) these 2 definitions in separate header files. just do. struct message{ ... }; message data; see http://www.cplusplus.com/d

c# - How to sum two column & save in database -

i have table in database 3 columns, there's grid associated database, want sum first 2 columns , display total in third column , save total sum in database. how can that? if please provide me example. you use following query show result select first_column,second_column,first_column+second_column yourtable

Display owner of a post in django admin list display -

my model : class activity(models.model): sub_choice = ((1, 'english'), (2, 'math'), (3, 'physics'), (4, 'chemistry')) subject = models.integerfield(choices=sub_choice, default=1, max_length=50) hours = models.integerfield(verbose_name='time spent in hours', default=0) my admin.py looks : class activityadmin(modeladmin): list_display = ('subject', 'hours') admin.site.register(activity, activityadmin) in list display,i want first name of user created activty.how do without explicitly asking creator of activity put name in form.is there way information using custom function user model ? try use user model. models.py from django.contrib.auth.models import user class activity(models.model): sub_choice = ((1, 'english'), (2, 'math'), (3, 'physics'), (4, 'chemistry')) subject = models.integerfield(choices

logging - How to log with format, arguments, and thrown? -

in logger , think can't find method reporting formatted message , throwable. i found error(string format, object... arguments) error(string msg, throwable t) try { dosomething(arg1, arg2); } catch (final someexception se) { logger.error("failed {} , {}", arg1, arg2); logger.error("failed something", se); } is there way this? logger.error("failed {} , {}", new object[]{arg1, arg2}, se); don't afraid, it! slf4j smart enough. if provide more arguments placeholders, logger attempt cast last argument throwable . if succeeds, nice stack trace in log. feature introduced in slf4j version 1.6.0 -- see http://www.slf4j.org/news.html , http://www.slf4j.org/faq.html#paramexception . usage following works fine: logger.error("one {} 2 {} error", new object[] { 1, 2, new runtimeexception("stack trace") }); starting version 1.7.0 there new varargs overloads, can use logger.error("one {} 2 {} er

c++ - pthread multithreading in Mac OS vs windows multithreaing -

i've developed multi platform program (using fltk toolkit) , implement multithreading background intensive tasks. i have followed fltk tutorials/examples on multithreading involve using pthread on mac, ie function pthread_create , windows threading on windows ie _beginthread what have noticed performance higher on windows ie 3 4 times faster in these background threads (in time execute them). why might be? threading libraries i'm using? surely there shouldn't such difference? or runtime libraries underneath all? here machine details mac: intel(r) core(tm) i7-3820qm cpu @ 2.70ghz 16 gb ddr3 1600 mhz model macbookpro9,1 os: mac osx 10.8.5 windows: intel(r) core(tm) i7-3520m cpu @ 2.90ghz 16 gb ddr3 1600 mhz model: dell latitude e5530 os: windows 7 service pack 1 edit to basic speed comparison compiled on both machines running command line int main(int agrc, char **argv) { time_t t = time(null); tm* tt=localtime(&t); std:

Subsetting array of dates according to recessions in Matlab -

Image
i subset array of serial numbers representing dates, according recession periods, can calculate mean() on these periods. following example illustrate this: datearray = transpose((1:20000)+678420); rnddata = normrnd(0.003,0.05,19999,1); cumdata = cumprod([1;rnddata+1]); data = [datearray cumdata]; load data_recessions.mat %native `econometrics toolbox` dataset % loads 2 column double array of start dates in first column , corresponding end dates in second column. plot(data(:,1),data(:,2)) set(gca(),'yscale','log'); recessionplot() i want calculate mean() on grey bars above. dates indicating these periods in recessions array. how do efficiently? assuming recession dates in 2 column matrix called d m = arrayfun(@(x)(mean(data(find(data(:,1)==d(x,1)):find(data(:,1)==d(x,2)),2))), 1:size(d,1)) or loop more efficient: m = nan(size(d,1),1); x = 1:size(d,1) first = find(data(:,1)==d(x,1)) last = find(data(:,1)==d(x,2)) m(x) = mean(data(

python - And and Or confusion -

i have file i'm parsing, on each line in same column 1 of values; 0, 1 or -1. want parse numeric values in line below. trying via if statement and/or operators. cannot head around and/or when test print statement, output either prints 1's or prints 0's. desired output: 0 1 -1 if number.startswith('1' , '0'): return number.append(' ') print number '1' , '0' resolves '0' : >>> '1' , '0' '0' boolean operators not same thing english grammatical constructs! the str.startswith() method takes tuple of values test for: number.startswith(('1', '0')) and it'll return true if string starts '1' or starts '0' . however, in case can use string formatting pad out number: return format(int(number), '-2d') this pads number out field 2 characters wide, leaving space negative sign:\ >>> format(-1, '-2d') &#

android - Send notification when app is background -

i'm sending notification while app in background. notification sending when app background when click notification , open app app crashing. need send notification when app on background , have been doing ibeacon development. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); notificationmanager = (notificationmanager) getsystemservice(context.notification_service); ; new foregroundchecktask().execute(); } class foregroundchecktask extends asynctask<context, void, boolean> { @override protected boolean doinbackground(context... params) { postnotificationubcity("entered region"); final context context = params[0].getapplicationcontext(); return isapponforeground(context); } private boolean isapponforeground(context context) { acti

c# - Confirm that file has been downloaded -

is there way confirm user has downloaded file? (as opposed having refused download, or cancelling in middle?) preferably in c# codebehind. when using: response.write(...); . you can use response.isclientconnected check if still client connected. from msdn this property enables greater control on circumstances client may have reset connection server. example, if long period of time has elapsed between when client request made , when server responded, may beneficial make sure client still connected before continuing process script. after write response using response.write , execute check if client connected, if true means file written response/ downloaded. http://msdn.microsoft.com/en-us/library/ms525453(v=vs.90).aspx

delphi - MSHTML PasteHTML() produces &nbsp; -

we use in delphi standard twebbrowser component, uses mshtml.dll internally. additionaly use registry ensure pages renders new rendering engine ( web-browser-control-specifying-the-ie-version , msdn: feature_browser_emulation ). use rendering of ie 10 have same results ie 8 ie 11. using standard rendering machine of mshtml (ie7) works right, due new rendering options need new rendering of mshtml. we use design mode of control enabled user make changes in documents: var mdocument: ihtmldocument2; begin mdocument := ((asender twebbrowser).document ihtmldocument2); mdocument.designmode := 'on'; now have following problem: when use ihtmltxtrange.pastehtml(...) insert html code, of spaces replaced &nbsp; procedure tform1.bt_pastehtmlclick(sender: tobject); var mdoc2: ihtmldocument2; movsel:ihtmlselectionobject; mrange: ihtmltxtrange; mhtml: string; begin /// reproduzierbarer fehler bei pastehtml /// leere zellen und falsche umbrüche. mdoc2 := w

qt - TCP-Program gets no connection from remote pc -

i have written 2 programs talk each other via (qt-)tcp. if both of them running on pc (e.g. using 127.0.0.1 address), going fine. deploy 1 of both programs on pc, no connection back, e.g. connecting program (on port 40000 , 40002) running tcp-servers on other pc works, not other pc on ports 40001 , 40003. because ports closed? tried open them, nmap can not tell me more them. how can find solution? update: according netstat servers on neccessary ports on local , remote pc listening (for example: tcp 0 0 0.0.0.0:40002 0.0.0.0:* listen off (0.00/0/0) ), can connect computer remote one, not other way round. another possibility of error: running dev system in vm nat-connection outside. problem not incoming signal? it's bind issue, and/or firewall issue. if listener bound on 127.0.0.1 connections between 2 machines won't work traffic isn't heard on interface. need set bind address 0.0.0.0 (which means any) achieve

javascript - prevent page from reloading after form submit -

is there way detect , stop if page reloading. i have page getting reloaded after successful submission of form present in it. want have event listener sees if page reloading , should stop being reloaded. i cannot return false; sucessful submit of registration form you have submit form using ajax avoid refreshing entire page. this can accomplished regular javascript made easier jquery http://api.jquery.com/jquery.ajax/

apache - Transparet/silent redirect to port -

i have homepage http://homepage.com/ use port 80 using apache2. host sparql endpoint @ http://homepage.com:8080/sparql/ rewrite www.homepage.com/sparql including queries such as: www.homepage.com:8080/sparql/?default-graph-uri=&query=select+distinct+%3fconcept+where+%7b%5b%5d+a+%3fconcept%7d+limit+100 i have played around redirect , rewrite not able achieve desired effect. in .htaccess have following: redirect 301 http://homepage.com/sparql/* http://homepage.com:8080/sparql/* what correct way setup such redirect? *edit: when write transparent mean url should stay same i.e. port number hidden.

How to add an extension element in Eclipse Luna (4.4.1) -

i know how can add extension element extension. in previous versions, possible right-clicking on extension , selecting "new" , later 1 of predefined elements context menu. when right-click, don't anything. i have same problem plug-in. i have resolved upgrading luna service release 2 (4.4.2).

msbi - Incremental Upload data from sql server to Amazon Redshift -

our raw data in sql server,data keep on growing,growth rate high,we need load data incrementally redshift analytics.can please point out me practice load data.how feasible ssis load directly redshift (with out s3). it's going impractical load sql server redshift without landing data on s3. can try loading via ssh but, of course, ssh on windows not supported. http://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-remote-hosts.html i did presentation while on discovered when migrating sql server redshift. 1 of things discovered ssis not useful interacting aws services. http://blog.joeharris76.com/2013/09/migrating-from-sql-server-to-redshift.html finally, of commercial "replication" tools automate process of incrementally updating redshift on-premise database. hear things attunity. http://www.attunity.com/products/attunity-cloudbeam/amazon-redshift

windows phone 8 - Couldn't send push notification using Azure Notification Hubs -

i trying create notification bus send push notifications windows phone app. i referred link , followed steps. my application registering httpchannel var channel = httpnotificationchannel.find("mypushchannel"); if (channel == null) { channel = new httpnotificationchannel("mypushchannel"); channel.open(); channel.bindtoshelltoast(); } channel.channeluriupdated += async (o, args) => { var hub = new notificationhub("xyz", "endpoint=sb://xyz-ns.servicebus.windows.net/;sharedaccesskeyname=defaultlistensharedaccesssignature;sharedaccesskey=dwnotqgqiksdstpxx4kuyebplsdslfep2yzimw1dmeu="); await hub.registernativeasync(args.channeluri.tostring()); }; and console application private static async void sendnotificationasync() { var hub = notificationhubclient .createclientfromconnectionstring("endpoint=sb:

java - testing regular expression using junit? -

i have written regular expression ignore space: regular expression string ignore_regx = "[^\\s]"; testcase: public void testclass { @test public void testignoreregx() { string input = " hai"; asserttrue(input.matches(ignore_regx)); } } but above test failing. could body please how test above expression using junit? consider using theories test multiple values. @runwith(theories.class) public void testclass { @datapoints public static final string[] truevalues = new string[]{"", "blah", ...}; @datapoints public static final string[] falsevalues = new string[]{" ", " blah", "glah "}; @theory public void testignoreregx_true(string input) { assume.assumethat(input, isin.isin(truevalues)); asserttrue(input.matches(ignore_regx)); } @theory public void testignoreregx_false(string input) { assume.assumethat(input, isin.isin(falsevalues )); assertfalse(input.matches(

Amending form of Array in Ruby -

im hoping can help. i have array being returned call google spreadsheet returns this: {"2014 week"=>"01", "weekly reach"=>"2.93"} {"2014 week"=>"02", "weekly reach"=>"3.37"} {"2014 week"=>"03", "weekly reach"=>"3.24"} {"2014 week"=>"04", "weekly reach"=>"2.39"} {"2014 week"=>"05", "weekly reach"=>"2.96"} {"2014 week"=>"06", "weekly reach"=>"6.31"} {"2014 week"=>"07", "weekly reach"=>"9.11"} {"2014 week"=>"08", "weekly reach"=>"8.59"} {"2014 week"=>"09", "weekly reach"=>"2.11"} {"2014 week"=>"10", "weekly reach"=>"2.24"} {"

scala assigning string and array of values -

i'm trying assign string followed array of scores. i defined categories case class categoryscore( //define category score class val food: int, val tech: int, val service: int, val fashion: int) and mapped them keys string such name of product followed case class of scores. var keywordscores:map[string, categoryscore] = map() //keyword scores keywordscores += ("amazon",categoryscore(1,9,1,4)) //tried add score string, not work am missing here? scala> keywordscores += ("amazon" -> categoryscore(1,9,1,4)) or (note parenthesis) scala> keywordscores += (("amazon", categoryscore(1,9,1,4))) the reason + defined +(kvs: (a, b)*): map[a, b] , meaning can take number of (key,value) pairs, leading += (k,v) being ambiguous. the a -> b notation removes ambiguity (and it's nicer read).

css - JQuery mobile, How to add two or more anchors to a li element? -

does can create jsfiddle code demonstrate how integrate 2 or more anchor tags in same li item? have searched no clear answer of how instance divide li element lets 3 square anchors 1/3 each. example need add div tags each anchor? eg. <ul> <li> <a href= "#anchor1"></a> <a href= "#anchor2"></a> <a href= "#anchor3"></a> </li> <li> <a href= "#anchor1"></a> <a href= "#anchor2"></a> <a href= "#anchor3"></a> </li> you can use jquery mobile grid: http://demos.jquerymobile.com/1.4.5/grids/ e.g.: <li> <div class="ui-grid-b"> <div class="ui-block-a"> <a href= "#anchor1"><img src="http://lorempixel.com/80/80/food/1/" /></a> </div> <div class="ui-block-b"

ios - Is there any way to encapsulate UIAlertController within another UIViewController? -

Image
i'm new ios, please keep answers clear. i've been toying encapsulating uialertcontroller in uiviewcontroller use replacement uiactionsheet it's deprecated in ios 8. the idea replacement uiactionsheet backward , forward compatible, , call immortalactionsheet instance. if component used in ios 8 or greater, can use uialertcontroller, otherwise fall uiactionsheet. make backward , forward compatible action sheet replace many action sheets around application i'm working with. , yes need maintain backward compatibility. i've prototyped whatever reason, when present immortalactionsheet, uialertcontroller view show @ top left (0, 0). no matter if change center, never moves. -(void) loadview { uiview * child = nil; if ( [uialertcontroller class] ) { uialertcontroller * alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"make choice!!" message:@"choose one!" preferredstyle:uialertcontrollerstyleactions

Adding items to a Google Forms list from a spreadsheet range -

i struggling past last line in code appreciated: the error getting "array empty: values (line 16, file "code")". have double checked item id, spreadsheet id , there data pick within correct range. pointers or insights...? function getfleet() { var ssdefects = spreadsheetapp.getactivespreadsheet().getsheets()[0]; var rngfleet = ssdefects.getdatarange(); var values = rngfleet.getvalues(); var fleetlist = []; //use column 0 , ignore row 1 (headers) (var = 1; <= values.length; i++) { var v = values[i] && values[i][0]; v && values.push(v) } // form id & list id var defectsform = formapp.openbyid('<form key id>'); defectsform.getitembyid(794194842).aslistitem().setchoicevalues(fleetlist); }; nothing pushed array fleetlist. coding in loop faulty. assuming want push first column (not including header), try , see if works function getfleet() { var values = spreadsheetapp.getactivespreadshe

html - Float left and clear both are not working properly -

Image
i'm trying put 1 div below one, code not working properly. can see in code below, there wrapper ("#main"), top ("#top"), floating left, , content ("#content"), floating left , clearing left also. here code: <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <title></title> </head> <body> <div id="main"> <div id="top"> </div> <div id="content"> </div> <div id="footer"> </div> </div> </body>

Can you easily subtract two 2-dimensional arrays in Java? -

an implementation complex formula requires me explode series of strings , values 2 dimensional array. 2 dimensional array of same size (containing same value types) generated dynamically. i'm wondering if easy feat in java subtract 2 matrices without having iterate through them value value? see commons math library. example: http://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/linear/array2drowrealmatrix.html#subtract(org.apache.commons.math3.linear.array2drowrealmatrix)

javascript - How to load each line from a .TXT file into HTML list using jQuery and Ajax -

i have basic log file below: admin login @ 3:00 user login @ 3:10 user b login @ 3:12 user m login @ 3:17 user d login @ 3:30 user e login @ 3:42 admin login @ 4:00 user login @ 4:03 user f login @ 4:15 ..... and using jquery ajax call list logins: <div > <ul id="result"> </ul> </div> <script> $.ajax({ url: "data.txt", type: 'post', datatype: 'text', success: function (data) { $('#result').append('<li>'+data+'</li>'); }, async: false }); </script> but (as expected!) loading of text file 1 <li> , result like: . admin login @ 3:00 user login @ 3:10 user b login @ 3:12 user m login @ 3:17 user d login @ 3:30 user e login @ 3:42 admin login @ > 4:00 user login @ 4:03 user f login @ 4:15 can please let me know how load each row of text file 1 separate <li> ? split data line separators: $.each(dat

Does Spark Streaming provide a guarantee on the order of the date when reducing -

i wondering if when calling reducebykey in apache spark streaming order of records in stream guarantied. part of computation has last value. here's example: javapairdstream< string, double > pairs; // ... pairs.reducebykey( new function2<double, double, double>() { @override public double call(double first, double second) throws exception { return second; } }); no, isn't. intention of map reduce parallize tasks , when parallized cannot guarantee order. previous results might shuffled on way reduce processor. note reduce processor won't wait results arrive, justs grabs 2 values , starts reducing. once created, distributed dataset (distdata) can operated on in parallel. example, might call distdata.reduce((a, b) => + b) to add elements of array.

combobox - C# Compare two comboxBox values and remove duplicate values -

i have 2 comboboxes have duplicate values, problem need compare tow comboboxes , need remove duplicate values in combobox 1 only, here code express how remove duplicates in comparing 1 combobox value. please support me. combobox1.items.addrange(dt.asenumerable().select(i => i.itemarray[0]).distinct().toarray()); datatable table = new datatable(); { using (sqldataadapter da = new sqldataadapter(@"select lorryno table1", cs)) da.fill(table); } cs.open(); combobox1.datasource = new bindingsource(table, null); combobox1.displaymember = "lorryno"; cs.close(); datatable table2 = new datatable(); { using (sqldataadapter da2 = new sqldataadapter(@"select lorryno table2", cs)) da2.fill(table2); } cs.open(); combobox2.datasource = new bindingsource(table, null); combobox2.displaymember = "lorryno"; cs.close();

linux - How to open file with unsupported file extension using Java Code via the Desktop? -

Image
i have program reads in file path or uri , launches ever file or uri via desktop. problem i'm running in unsupported file extensions. odd thing error when fails open file isnt expect. error reads java.io.ioexception: failed open file:/c:/users/angel/desktop/test.test. error message: access denied. @ sun.awt.windows.wdesktoppeer.shellexecute(wdesktoppeer.java:77) @ sun.awt.windows.wdesktoppeer.open(wdesktoppeer.java:54) @ java.awt.desktop.open(desktop.java:272) @ desktopopenfile.desktopopenfile.openfile(desktopopenfile.java:24) @ desktopopenfile.desktopopenfile.main(desktopopenfile.java:15) i think error more along lines of file extension unsupported. can verify file extension in other program feeds database supports wondering if there way allow user pick application open unsupported file with. my ideal solution work similar when attempt open unsupported file in windows ask program you'd use open or search web. have been if had gotten option using code below. i

How to find a button with "value" in html page (Webbrowser - Delphi) -

i have html page have 3 forms 3 submit buttons . buttons have no name have value : <input type="submit" value="login"> how can find button value , click on it ? thanks procedure tform1.button1click(sender: tobject); var ovelements: olevariant; i: integer; begin ovelements := webbrowser1.oleobject.document.forms.item(0).elements; := 0 (ovelements.length - 1) if (ovelements.item(i).tagname = 'input') , (ovelements.item(i).type = 'submit') , (ovelements.item(i).value = 'login') ovelements.item(i).click; end;

gzip - How to delimit a compressed fixed length file with uncompressing it -

i'm dealing compressed (gzip) fixed length flat files need turn delimited flat files can feed gpload. told possible delimit file without needing decompress it, , feed directly gpload since can handle compressed files. does know of way delimit file while in .gz format? there no way delimit gzip-compressed data without decompressing it. don't need delimit it, can load fixed-width data type, decompressed on fly gpfdist. refer "importing , exporting fixed width data" chapter in admin guide here: http://gpdb.docs.pivotal.io/4330/admin_guide/load.html here's example: [gpadmin@localhost ~]$ gunzip -c testfile.txt.gz bob jones 27 steve balmer 50 [gpadmin@localhost ~]$ gpfdist -d ~ -p 8080 & [1] 41525 serving http on port 8080, directory /home/gpadmin [gpadmin@localhost ~]$ psql -c " > create readable external table students ( > name varchar(

http status code 403 - Google Calendar error 403 -

my app google calendar show error: the server had problem handling request. com.google.gdata.util.serviceforbiddenexception: forbidden forbidden< error 403 the problem in code: calendarfeed resultfeed = service.getfeed(feedurl, calendarfeed.class); why happen? this should answer question: https://developers.google.com/google-apps/calendar/v2/developers_guide_protocol this api subject deprecation policy , shutdown on november 17, 2014. please use apiv3 instead.

c# - Dependency Injection and Entities -

i have 2 classes , have 1 many relationship shown below public class user { public string name{get;set;} public ilist<address> addresses{get;set} } public class address { public string streetaddress{get;set;} public user user{get;set;} } to add address user need initiate addresses property in user constructor as public user() { this.addresses=new list<address>(); } is scenario candidate use di initiate list or should initiate address list in constructor shown. if the address data required construct instance of user, may candidate di. if's matter of making sure list instantiated, code correct as-is.

database - Should I use one table if derived tables would all use the same record layout? -

i'm developing game sdk, centers on establishment , persistence of storyline, characters, leveling, etc. i started mindmap of different classes, , in process of bringing simple representations uml. since persisting of game's objects done using sqlite, representing classes database record types. 1 of record types, rangedproperty, used in multiple tables: factions, traits, statuses, etc. create table [rangedproperty] ( [uid] integer not null on conflict fail, [oid] integer not null, [name] text, [description] text, [tag] text, [min] integer default 1, [max] integer default 100, [current] integer default 50); since tables using same record type, make sense leave tag field in place, , - rather using separate tables factions, traits, , on - use same table them all? seems contribute reliability, since changes record type need made 1 table, reducing likelihood of error. thanks! note: have thought of using integer field type, since

ios - background request cases a CATransaction error -

i trying download image in background. when trying download it, receive next error: +[catransaction synchronize] called within transaction i trying download in cellforrowatindexpath of uitableview. have first encountered such problem. in advance. here code that, located in separate file: - (id) initwithimageid: (nsstring*) imageid { self = [super init]; if (self) { self.receiveddata = [nsmutabledata data]; self.imageid = imageid; notedpreferences* np = [notedpreferences sharedpreferences]; nsstring* url = [[np apiurl] stringbyappendingformat: @"/thumbs/%@.jpg", imageid]; nsurl* imageurl = [nsurl urlwithstring: url]; nsmutableurlrequest *therequest = (nsmutableurlrequest*)[nsmutableurlrequest requestwithurl:imageurl cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:timeout60]; [self basicauthforrequest:therequest withusername:@"app" andpassword:@"123"]; sel

sublimetext3 - Change Local History Default Path In Sublime Text 3 Package Local Histroy -

how change default path in sublime text 3 local history package settings file please? localhistory.sublime-settings file: { "file_size_limit": 262144, // 256 kb "history_retention": 30, // in days "history_on_close": false, // store history on close "history_path": "<path>" // path store history, defaults <home>/.sublime/history } i change path "d:\sublime text 3\sublime text build 3065 x64\history" for example. possible somehow? i since use portable install , keep history in install directory well. thank help. "history_path": "d:\\sublime text 3\\sublime text build 3065 x64\\history" // path store history, defaults <home>/.sublime/history did trick , local history package sublime text 3 saves file copies in: d:\software\sublime text 3\sublime text build 3065 x64\history\

android - Eclipse: Do I need to uninstall my current version of the ADT plugin to use an older one? -

i wish use older version of adt plugin eclipse , found download link here . how can install within eclipse, , need uninstall adt plugin have? also, need use specific sdk work older adt version? 1 - create download url: http://dl.google.com/android/adt-##.#.#.zip . google uses version number downloads, if need 10.0.1, download http://dl.google.com/android/adt-10.0.1.zip . 2 - uninstall current adt version in eclipse. 3 - install new version archive!

cql - Cassandra UPDATE primary key value -

i understand not possible using update. what instead, migrate rows pk=0 new rows pk=1. there simple ways of achieving this? for relatively simple way, quick copy to/from in cqlsh. let's have column family (table) called "emp" employees. create table stackoverflow.emp ( id int primary key, fname text, lname text, role text ) and purposes of example, have 1 row in it. aploetz@cqlsh:stackoverflow> select * emp; id | fname | lname | role ----+-------+-------+------------- 1 | angel | pay | engineer if want re-create angel new id, can copy table's contents to .csv file: aploetz@cqlsh:stackoverflow> copy stackoverflow.emp '/home/aploetz/emp.csv'; 1 rows exported in 0.036 seconds. now, i'll use favorite editor change id of angel 2 in emp.csv. note, if have multiple rows in file (that don't need updated) opportunity remove them: 2,angel,pay,it engineer i'll save file, , copy updated row cas

jquery - Find not working with children().eq(n).nextAll().find('.class') -

i want next ('.slide') div specified particular indexed div. below example want ('.slide') div after "c" html <div id='parent'> <div class='slide'>a</div> <div class='slide'>b</div> <div class='slide'>c</div> <div class='slide'>d</div> <div class='slide'>e</div> <div class='otherdiv'>f</div> <div class='otherdiv'>g</div> </div> jquery: $("#parent").children().eq(2).nextall().find('.slide') fiddle example the code doing following: //retrieves dom element <div class='slide'>c</div> $("#parent").children().eq(2) //retrieves dom elements spans d-g .nextall(); //looks *inside* spans d-g inner elements have class 'slide' .find('.slide') .nextall supports selector filter: $("#parent&q

asp.net - Manage Configuration file access setting from one place -

we have single lower environment server publish our applications developer testing, pre-business testing etc. problem facing here developers changing settings in config file convenience. for example, development application should point development sql db, changing qa. , in cases instead of publishing application staging changing qa connection strings staging because publishing staging requires effort (merging code main branch etc). no matter how many times send email development group keep doing same thing. is there way control web.config/app.config edit permissions , limit 1 person based on application? if sql server connection string problem, can use cliconfg.exe set specific alias, in case must configure alias on each server in environment (development, test , production), this, connection string "data source = srvdbapp" on web. config / app.config. internally each client sql server redirect corresponding database.

asp.net mvc - Binding with multiple PartialViews in Knockout -

Image
i've got jquery accordion , each panel contains form. of forms same, , inputs share same ids, names, , data-bind attributes. assuming each form has different binding context (using ko with: ), this how set knockout.js viewmodel if there two forms. however, don't know in advance how many forms there be. i'm rendering partialview (which contains form) every form object in mvc viewmodel's collection of forms. @model viewmodel <div class="container-fluid"> <div id="jqueryaccordion"> @foreach (var form in model.allforms.tolist()) { <!-- ko with: items[@form.key] --> html.renderpartial("_form", form); <!-- /ko --> } // etc. how set knockout.js viewmodel if don't know how many forms there going be? as anh bui suggested, create them dynamically in browser. using applybindings markup created asp.net on server-side bit of

How can I check whether someone is friend of another one in Graph API? -

i know endpoint me/friends lists user friends authorized app. sub-endpoint exists: me/friends/<user> , checks whether 2 users friends: modifiers you can append person's id edge in order determine whether person friends root node user: [...] if user-a friends user-b in above request, response contain user object user-b. if not friends, return empty dataset. does modifier imply both users have authorized application? or return data specified friend? currently i'm developer of application, in test mode. in graph api call every picture (from 'me' user) , tags. each tag (which has id , name of tagged user), want know whether such user (by id in tag) friend of current ('me') user. but result {data:[], summary:xxx} summary friend count (as if asked me/friends endpoint, without specifying user). notes : user of app. administrator of app. granted user_friends permission. question : behavior expected me/friends/<user>

python - Create term query on field contained in another field with elasticsearch-dsl-py -

i using elasticsearch-dsl-py , filter on term contained inside 1 this: "slug": { "foo": "foo-slug", "bar": "bar-slug " } what : search.query(‘filtered’, filter={"term": {"slug.foo": "foo-slug"}}) i prefer search.filter(term, slug.foo="foo-slug") but can’t keyword can’t include dots. if helps else, had same problem creating kind of query against child property not using nested objects. found solution use query method instead of filter method: search.query('match', **{"slug.foo": "foo-slug"}) this worked me in elasticsearch 1.5.2.

Creating a Derived Class in C++ -

this question has answer here: why have header files , .cpp files? [closed] 9 answers so im trying make die class , loadeddie class die class base , loadeddie class derived. difference between 2 classes roll function in loadeddie has 25% chance of getting highest number, whereas die, has 1/6 chance. 1st time working derived class , seem have quite problem trying complete task. can explain me how works , show me how classes (as im visual learner , need examples). know base class (die) works tested out before moving loadeddie. die.cpp #include<iostream> #include <cstdlib> using namespace std; class die{ public: die(); die(int numside); virtual int roll() const; int rolltwodice(die d1, die d2); int side; }; die::die():side(6){} die::die(int numside):side(numside){} int die::roll() const{ return rand()

mysql - count consecutive days where temp is below 0 -

i trying count of consecutive days in db temperature below 0. can total count of total days below 0 using select count not consecutive number of days. want able show first , last day count. table updated every minute. assume have minimal table such as: datetime temp 11/14/2014 7:21:31 -2.4 11/14/2014 7:22:31 -2.4 11/15/2014 5:03:31 2.4 11/15/2014 5:04:31 2.4 11/16/2014 5:10:31 -0.2 11/16/2014 5:11:31 -0.2 11/17/2014 5:13:31 -0.2 11/17/2014 5:14:31 -0.2 11/18/2014 5:15:31 2 11/18/2014 5:16:31 2 in example, consecutive days 2, first date 11/16/2014 , last date 11/17/2014 , total days (i can this) 3. thanks looking. edit: want longest consecutive streak. how got data, simple select statement: select datetime, temp mytable; consider following... the data set... drop table if exists my_table; create table my_table ( dt datetime not null primary key , temp decimal(5,2) not null); insert

How to get Product Version of Microsoft Sql Server from .mdf file Header using C# code -

how product version of microsoft sql server .mdf file header using c# code.i have open .mdf file , have read product version .mdf file header. product version means 11.0.2100.60 , 10.50.1600.0 this.not 8,9,10,11 , 661 ,705,611.. using (filestream fs = file.openread(mdffile)) { using (binaryreader br = new binaryreader(fs)) { br.readbytes(9 * 8192 + 96 + 4); byte[] buffer = br.readbytes(2); dbiversion = buffer[0] + 256 * buffer[1]; } fs.close(); } i use code: string mdffilename = args[0]; if (!file.exists(mdffilename)) { console.writeline("error: specified file not exist!"); return; } namevaluecollection mdffileversions = configurationmanager.getsection("mdffileversions") namevaluecollection; try { filestream fs = new filestream(mdffilename, filemode.open, fileacc