Posts

Showing posts from March, 2012

scala - How can I implement concrete class which extends trait defining a method with type by the type parameter's type alias -

i ask advanced scala developers. problem access type alias belonging type parameters of class' parent. case class mymodel(foo: string = "bar") case class mydispatcher() trait module[m, d] { type dispatcher = d type model = m } trait myspecificmodule[a <: module[_, _]] { def dispatcher(): a#dispatcher } class moduleclass extends module[mymodel, mydispatcher] { //... } class myspecificmoduleclass extends myspecificmodule[moduleclass] { override def dispatcher(): mydispatcher = mydispatcher() } so myspecificmodule extends generic trait, , should know type of dispatcher method. in case of myspecificmoduleclass should mydispatcher . when try compile code getting compilation error because type of method, not same defined: a#dispatcher , in reality is. error:(21, 18) overriding method dispatcher in trait myspecificmodule of type ()_$2; method dispatcher has incompatible type override def dispatcher(): mydispatcher

Finding maximum element in an array - is it that you will call greedy algorithm or brute force algorithm or both? -

suppose array of integers given: {1,3,2,4,6,5,2} - max: 6 using brute force , finding maximum element in observe every element ( each element candidate solution ), searching entire search space. considering greedy approach , modify maximum element @ each element of array if necessary. local optimal choice lead global optimal choice. are brute force , greedy approach similar here? exacty difference between 2 algos in general? approach: brute force - starting first element - 1 taking max. considering each , every next element in array - entire search space. choosing maximum @ each step if necessary. brute force. greedy algorithm - starting nothing, taking first element - taking max 1. considering second element - 3, making local optimal choice between 1 , 3- taking 3 maximum. , on other elements. @ last, have 6 maximum element- global optimal choice. how tell difference between 2 algos in general? finding maximum element in unsorted array require brute-for

selenium webdriver in python -

so i'm trying make script in python uses selenium webdriver open , login website called marketsworlds , retrieve market value of stock. have script able open , login page. cant figure out how capture/get market value , have print out. used inspect element find class: <p class="market_value"> </p> in between open , close brackets inspect element displays market value, changes. tried setting driver.find_element_by_class("market_value") variable , printing variable. print out of " @ object 0x" , ever comes after x. way return displays? if have use selenium navigation, such on javascript-heavy sites, suggest acquiring page source , using html parser extract data want. beautifulsoup great choice of parser. example: html = driver.page_source soup = beautifulsoup(html) # *all* 'p' tags specified class attribute. p_tags = soup.findall('p',{'class':'market_value'}) p in p_tags: print p.te

sql - Database Update in VBA -

sub uoload_data() dim s(40) integer dim row integer dim integer = 0 row = 7 39 s(i) = sheets("data").cells(row, 5).value = + 1 next dim cn object dim rs object dim strsql string dim strconnection string dim apppath string set cn = createobject("adodb.connection") apppath = application.activeworkbook.path strconnection = "provider=microsoft.ace.oledb.12.0;" & _ "data source=c:\users\devi\desktop\ability.accdb;" cn.open strconnection strsql = "insert mytable values ('" & s(0) & " ', '" & s(1) & " ','" & s(2) & " ','" & s(3) & " ' )" set rs = cn.execute(strsql) set rs = nothing cn.close set cn = nothing end sub i have excel sheet of 40 field. update field access database. while insert record database using insert stat

security - How can I get rid of a Man in the Middle (MIMA) hacker from stealing web form data? -

i have web form created in adobe business catalyst crm , has placed man in middle (mima) hack on our site or wherever , intercepting web form contacting user submitted form , offering them products using same name website. so two-part question. how rid of , prevent happening again , there legal action can take against mima hackers? business catalyst (bc) secure not convinced there hack on site. should following: contact bc , let them know this. check site code did not create or insert site. recreate web form , insert site. change passwords on bc site. change workflows site. change email password. switch forms use bc secure domain. (ie: https://example.worldsecuresystems.com ) since cannot run server side code on bc doing above steps should solve issue. contact lawyer information on legal action against mima hackers.

javascript - Angular material design valid/invalid input -

couldn't seem find relative existing answer so.. i using angular material design , i'm creating sign in/up form. @ moment when no text entered field label , bottom border turns red; result of ng-required="true" . i turn green when information valid, not amazingly familiar angular not sure if there directive use? alternatively assume css trick; in 1 of css files there - .ng-invalid.ng-dirty { border-color: #fa787e; (red) } .ng-valid.ng-dirty { border-color: #78fa89; (green) } these perfect attached attaching class not seem work (or im doing wrong) here code 1 line of input <md-input-container> <label class="userlabel">username</label> <input ng-model="credentials.username" type="text" ng-required="true" aria-label="password" class="inputtext ng-valid"> </md-input-container> if assist great, in advance you on right track css missing

c++ - Convert MSB first to LSB first -

i want convert unsigned short value msb first lsb first. did below code not working. can point error did #include <iostream> using namespace std; int main() { unsigned short value = 0x000a; char *m_pcurrent = (char *)&value; short temp; temp = *(m_pcurrent+1); temp = (temp << 8) | *(unsigned char *)m_pcurrent; m_pcurrent += sizeof(short); cout << "temp " << temp << endl; return 0; } what wrong first assigned value 's msb temp 's lsb, shifted again msb , assigned value 's lsb lsb. basically, had interchanged *(m_pcurrent + 1) , *m_pcurrent whole thing had no effect. the simplified code: #include <iostream> using namespace std; int main() { unsigned short value = 0x00ff; short temp = ((char*) &value)[0]; // assign value's lsb temp = (temp << 8) | ((char*) &value)[1]; // shift lsb msb , add value's msb cout << "temp

javascript - How to change the span display style, while changing the innerHTML of that span -

<span id="spnref" style="display:none"></span> i want make span visible now. how can change span display style, while changing innerhtml of span? document.getelementbyid("spnref").style.display = "block";

matlab - Normalize energy of two audio signals -

i have different audio signals , want ensure of them have same energy. goal sound equal (same volume) when play them. tried following method (explained above) when play them sound different. also, if compute energy after normalization apply, different. doing wrong? what is: 1) calculate energy each audio signal using envelope hilbert transform, % calculate envelope envelope = abs(hilbert(wave)); % calculate energy in sound energyinsound=sum(envelope.^2) 2) ensure have same energy, for channel=1:2 regwave(:,channel) = 1000.* wave(:,channel)./energyinsound(channel); end

how does this work? - Java code -

so i've got piece of code, package test1; class student13 { public static void main(string [] args) { student13 p = new student13(); p.start(); } void start() { long [] a1 = {3,4,5}; long [] a2 = fix(a1); system.out.print(a1[0] + a1[1] + a1[2] + " "); system.out.println(a2[0] + a2[1] + a2[2]); } long [] fix(long [] a3) { a3[1] = 7; return a3; } } can tell me why returns 15 15 , not 12 15 ? function fix applied long[] a2 , how come final result 15 15 ? you pass a1 array fix() , called a3 in fix() method, regardless still referencing a1 . when update a3 : a3[1]=7 , update paramater value of fix() a1 . updated a1 !

SQL Server Bulk Insert Update from CSV? -

i'm importing csv file sql server. problem need update if rows found, haven't found insert update equivalent or similar it. this current code: bulk insert actuals_financials_temp '\\strmv3302\temp\actuals_financials_temp.csv' (fieldterminator = ',', rowterminator = '\n', firstrow = 2) is there way update rows matching keys? or @ least ignore them rest uploaded , bulk update? not directly, no. need bulk insert staging table , update existing records , insert missing records. try local temp table (i.e. #tablename ) first. technically speaking, either of following (both of use openrowset ): skip staging table , use openrowset(bulk...) update , insert queries. have tested, though, see if cost of reading file twice worth savings of not having read temp table (which writes disk). possible using staging table might still better since first query, update, might auto-create statistics benefit second query, insert, since query need eith

php - Installing magento - Database server does not support InnoDB storage engine -

Image
i'm trying install magento on local server (wampserver 2.4), using magento downloader , following error while cheking database connection in first step of installatoin. database server not support innodb storage engine it maybe because of mysql version 5.6.12, couldn't downgrade it. when change my.ini file enable innodb engine follow mysql service didn't start. # uncomment following if using innodb tables innodb_data_home_dir = c:\mysql\data/ innodb_data_file_path = ibdata1:10m:autoextend innodb_log_group_home_dir = c:\mysql\data/ innodb_log_arch_dir = c:\mysql\data/ # can set .._buffer_pool_size 50 - 80 % # of ram beware of setting memory usage high innodb_buffer_pool_size = 16m innodb_additional_mem_pool_size = 2m # set .._log_file_size 25 % of buffer pool size innodb_log_file_size = 5m innodb_log_buffer_size = 8m innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 also here result of running show engines command: i try install using full

c# - Running a .Net application in a sandbox -

over months, i've developed personal tool i'm using compile c# 3.5 xaml projects online. basically, i'm compiling codedom compiler. i'm thinking making public, problem is -very-very- easy on server tool. the reason want protect server because there's 'run' button test , debug app (in screenshot mode). is possible run app in sandbox - in other words, limiting memory access, hard drive access , bios access - without having run in vm? or should analyze every code, or 'disable' run mode? spin appdomain, load assemblies in it, interface control, activate implementing type, call method. don't let instances cross appdomain barrier (including exceptions!) don't 100% control. controlling security policies external-code appdomain bit single answer, can check link on msdn or search "code access security msdn" details how secure domain. edit : there exceptions cannot stop, important watch them , record in manner assembl

SAPUI5/Openui5 XML viewer component -

i have xml content show user. there way can use browsers xml viewer. cannot find control or component can add view can handle this. daniel. i'm not aware of that's provided out box, should possible use jquery.xmleditor , looks it'll meet needs. wrapping in custom control shouldn't work.

java - Android: Null object reference -

i trying have list of contacts, each quickcontactbadge . when tried add quickcontactbadge , application crasher , logcat says null object reference on mcursor when call getcolumnindex(); . doing wrong, , code work correctly implement quickcontactbadge ? private cursoradapter madapter; private cursor mcursor; private string currentquery; private int midcolumn; private int mlookupkeycolumn; private uri mcontacturi; private quickcontactbadge mbadge; private static final string[] projection = { contacts._id, contacts.display_name_primary, contacts.lookup_key, contacts.photo_thumbnail_uri, contacts.has_phone_number }; private static final string[] = { contacts.display_name_primary }; private static final int[] = { r.id.contact_text }; private static final string selection = "(" + contacts.in_visible_group + " = 1) , (" + contacts.has_phone_number + " != 0 )"; @override public void oncreate(bundle savedins

c# - Linq Group By, Skip 1 where the skipped 1 was the most recent -

i have data set of objects have stored in events list (the variables have been declared earlier @ class level): [setup] public void setup() { eventlogobj = new eventlogobj(); event1 = new eventlogobj() { recordid = 1, tablekey = "person_code=1", status = "s", eventtime = convert.todatetime("2013-07-15 14:00:00") }; event2 = new eventlogobj() { recordid = 2, tablekey = "person_code=2", status = "s", eventtime = convert.todatetime("2013-07-15 13:00:00") }; event3 = new eventlogobj() { recordid = 3, tablekey = "person_code=3", status = "s", eventtime = convert.todatetime("2013-07-15 13:00:00") }; event4 = new eventlogobj() { recordid = 4, tablekey = "person_code=2", status = "s", eventtime = convert.todatetime("2013-07-15 14:00:00") }; event5 = new eventlogobj() { recordid = 5, tablekey = "person_cod

java - Closing stage on key release -

i have created vbox in javafx comes pop on application based on hot key combination alt + j. want close vbox when release key combination alt + j. piece of code final stage dialog = new stage(); eventhandler handler = new eventhandler<keyevent>() { public void handle( keyevent event ) { if ( event.isaltdown() && event.getcode() == keycode.j ) { dialog.initstyle( stagestyle.undecorated ); // dialog.initmodality(modality.application_modal); vbox dialogvbox = new vbox( 25 ); dialogvbox.getchildren().add( new text( "abc" ) ); scene dialogscene = new scene( dialogvbox, 300, 200 ); dialog.setscene( dialogscene ); dialog.show(); } else if ( keyevent.key_released.equals( eventrel.isaltdown() && eventrel.getcode() == keycode.j ) ) { dialog.hide(); } } }; scene.addeventhandler( keyevent.key_pressed, hand

Gap between lines and axis with C3 -

Image
how can delete space between axis , lines c3 library ? i achieve this: tnx just set axis padding axis: { x: { padding: 0 }, y: { padding: { bottom: 0 } } } fiddle - http://jsfiddle.net/50o0ve7k/

How to display progress bar when userform is loading in VBA excel -

i have created macro using userform , has many controls static in nature , displays upon userform intialization. has (userform initialize code) code written add checkboxes in 1 of frame dynamically using data in sheet1. taking bit of time(say 30 sec-1 min) depending on data present in sheet. during period want user shown progress bar of % completion. i tried application.statusbar functionality didnt workout. thought go progressbar. can please in regard? this progress bar i've used last 5 or 6 years (originally posted in http://www.mrexcel.com/forum/excel-questions/527468-progress-bar.html ). i'd follow rorys advice though , use listbox if you're creating potentially hundreds of controls. create form called ' progress bar ' give these dimensions: name: progressbar height: 49.5 width: 483.75 showmodal: false <---- important bit or won't update properly. add label form these dimensions: name: boxprogress caption: boxprogress hei

ios - When we swipe to quit an application if applicationDidEnterBackground is not called 100% of the time how do we reliably save data? -

i asked earlier. think phrased question wrong. want save data app parse backend when application terminated. i.e. app swiped , killed list of apps. ios documents applicationdidenterbackground called , not applicationwillterminate work can done in method. applicationwillterminate: apps not support background execution or linked against ios 3.x or earlier, method called when user quits app. apps support background execution, method not called when user quits app because app moves background in case. however, method may called in situations app running in background (not suspended) , system needs terminate reason. however isn't 100% , testing applicationdidenterbackground isn't called every time quit app. how 1 save data when app terminated 100% guarantee saved? this code saving when applicationdidenterbackground: - (void)applicationdidenterbackground:(uiapplication *)application { bgtask = [application beginbackgroundtaskwithname:@"mytask" expirationhan

maven - How to link a web resource file from /main/resources in JSP? -

i have following structure in java webapp -- main -- java -- resources -- lib -- css -- style.css -- webapp -- web-inf -- web.xml --index.jsp how can link style.css index jsp? <link rel="stylesheet" href="???"> what should here? thanks in advance the maven /main/resources folder classpath resources not represent java classes, such i18n properties files , kinds of configuration files (text, xml, json, etc). resources you'd obtain via classloader#getresourceasstream() . that folder not intented public web resources (i.e. files accessible public http://xxx url). you're supposed put web resource files in maven /main/webapp folder (outside /web-inf , /meta-inf ), correctly did jsp file (which public web resource). so, move /lib folder down (i'd rename folder e.g. "resources", "assets", or "static", more conform de facto standards; "

How to access array elements in a Django template? -

i getting array arr passed django template. want access individual elements of array in array e.g. arr[0] , arr[1] etc instead of looping through whole array. is there way in django template? thank you. remember dot notation in django template used 4 different notations in python. in template, foo.bar can mean of: foo[bar] # dictionary lookup foo.bar # attribute lookup foo.bar() # method call foo[bar] # list-index lookup it tries them in order until finds match. foo.3 list index because object isn't dict 3 key, doesn't have attribute named 3, , doesn't have method named 3.

ruby on rails - heroku[router] gets old and wrong url -

i have rails app deployed on heroku, , there annoying issue: router heroku gets url doesn't exist anymore (i have deleted on webapp regarding notifications). have idea come from? here logs : 2015-06-25t12:22:30.357205+00:00 heroku[router]: at=info method=get path="/notifications" host=www.krawd.com request_id=6b03fbec-88ee-48bd-8afd-aa6d59a9bf53 fwd="82.237.217.103" dyno=web.1 connect=1ms service=12ms status=500 bytes=377 2015-06-25t12:22:30.334224+00:00 app[web.3]: source=rack-timeout id=8b3b9046-8613-44fb-8274-c0dc976d3472 wait=16ms timeout=25000ms state=ready 2015-06-25t12:22:30.362821+00:00 app[web.3]: source=rack-timeout id=8b3b9046-8613-44fb-8274-c0dc976d3472 wait=16ms timeout=25000ms service=29ms state=active 2015-06-25t12:22:30.406680+00:00 app[web.3]: completed 500 internal server error in 25ms 2015-06-25t12:22:30.341720+00:00 app[web.1]: source=rack-timeout id=6b03fbec-88ee-48bd-8afd-aa6d59a9bf53 wait=0ms timeout=25000ms service=0ms state=acti

ios - Convert NSString to NSDictionary bug -

i have string server, , when try convert nsdictionary - " nil ". when try write same nsstring myself - it's ok! i server encoded string, use "aes256decryptwithkey" nsstring+aescrypt.h decrypt, , nsstring, string convert nsdata , try nsdictionary nsstring *str = @"{\"error\":{\"password\":[\"error wrong!\"]}}"; //string written myself nsdata *jsondata = [str datausingencoding:nsutf8stringencoding]; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:jsondata options:kniloptions error:&error]; this code work, string server - not( nsdata log (message server) - <7b226572 726f7222 3a7b2270 61737377 6f726422 3a5b22d0 9dd0b5d0 bfd180d0 b0d0b2d0 b8d0bbd1 8cd0bdd1 8bd0b920 656d6169 6c20d0b8 d0bbd0b8 20d0bfd0 b0d180d0 bed0bbd1 8c225d7d 7d000000> nsdata log (my string) - <7b226

python - Creating pandas DataFrame column from selected values from another column -

say, have dataframe this: df = pd.dataframe({'a' : list('abcdefghij'), 'b' : (5*[2] + 5*[3])}) and want create column contains values column 'a' indexed in column 'b' (5 times 'c' , 5 times 'd'). then, seem natural me this: df['c'] = df['a'].iloc[df['b']] but produces error: cannot reindex duplicate axis my question is a) how can that? b) can learn actual mechanics of pandas indices, opposed intuition? if understand correctly want this: in [219]: df['c'] = df.loc[df['b'],'a'].values df out[219]: b c 0 2 c 1 b 2 c 2 c 2 c 3 d 2 c 4 e 2 c 5 f 3 d 6 g 3 d 7 h 3 d 8 3 d 9 j 3 d as why 'cannot reindex duplicate axis' if observe it's returning: in [220]: df.loc[df['b'],'a'] out[220]: 2 c 2 c 2 c 2 c 2 c 3 d 3 d 3 d 3 d 3 d name: a, dtype: object then should

hadoop - Period DataType Support in HIVE to TERDATA Export -

whenver trying export period datatype column in terdata hive column(e.g 2014/02/01,2015/01/01) using sqoop, fails job. know if period datatype supported in sqoop exports. hortonwork's connector teradata support period data types. however, cloudera connector teradata not support perdio data types currently.

CS:GO item value - Which API do they use? -

i looking api, can check current value of item. love use http://csgo.steamanalyst.com/ unfortunately don't have api. sent them email, no response them yet. i have following stuff item in inventory: "1074182396_188530139": { "appid": "730", "classid": "1074182396", "instanceid": "188530139", "market_hash_name": "desert eagle | bronze deco (field-tested)", for instance, if wanted check current market value of desert eagle | bronze deco (field-tested) , can use steam's own api check market value: http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=desert%20eagle%20|%20bronze%20deco%20(field-tested) simply giving variable market_hash_name name of item, can check "starting from" price on market. works great, there's issue... when item has value of on $400 (or close that), cannot sell on market. means lot of it

java - Extern "C" giving error "Linkage specification is not allowed" even after adding def. in header file? -

this code in main.cpp file: extern "c" jniexport jint jnicall java_somefnhandling_jni_1someinit (jnienv * env, jobject , jstring var1, jstring var2) { //rest part of code in here } this definition in main.h file: #ifdef __cplusplus extern "c" { #endif jniexport jint jnicall java_someufnhandling_jni_1someinit (jnienv *, jobject, jstring, jstring); #ifdef __cplusplus } #endif this program taking 2 parameters java file , passing dll using jni interface in file i'm getting error: linkage specification not allowed i'm using vc++ generate dll file , have tried find same solution mentioning add def. in header file. after doing error still remains same. idea? i removed method calling in main function , put outside of main , started working charm

nest - Elasticsearch date range filter does not give proper results with gte, lte -

its been observed lte , gte both take lower bound values. how make take upper bound lte , lower bound gte?? this how query looks { "from": 0, "size": 40, "query": { "filtered": { "filter": { "bool": { "should": [ { "range": { "createdon": { "lte": "201505", "gte": "201404", "format": "yyyymm" } } } ] } } } } } the above query not return me valid documents such "2015-05-06t12:55:34.44", "2015-05-26t14:42:24.963" etc. returns "2015-05-01t11:42:24.963" lte 201505 201404 means april 1st 2014 201505 means may 1st 2015 this reason why result. elasticsearch "translates" in background query range 1 1396310400000 1430524799999 , meanin

apache - SSL certificate shows different domain -

i have 2 sites setup on apache webserver, both on https. certificates installed , work on browsers, on ie versions certificate error message when open site, , certificate info shows domain name of b site. checked both urls different ssl checkers , seem fine. other browsers show correct certificate. have idea? thanks.

excel vba - Type mismatch Error in VBA when creating ActiveX control drop down list -

i got 3 activex combo boxes in sheet1. used code in this workbook populate first combo box list. have created function next set of combo box cascading values. below function: function cascadechild(targetchild oleobject) dim myconnection connection dim cmd adodb.command dim myrecordset recordset dim myworkbook string dim strsql string set myconnection = new adodb.connection set cmd = new adodb.command set myrecordset = new adodb.recordset 'identify workbook referencing myworkbook = application.thisworkbook.fullname 'open connection workbook myconnection.open "--" select case targetchild.name case = "directorate" strsql = "select distinct directorate [tgtfield] dbtable division = '" & sheet1.division.value & "' or 'all' = '" & sheet1.division.value & "'" case = "area" strsql = "select dis

objective c - Write contents of NSMutableArray to a text file in iOS 8.3 -

i referred following links not working in ios 8.3 ipod write contents of array text file is possible save nsmutablearray or nsdictionary data file in ios? nsstring *file_path = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject] stringbyappendingpathcomponent:@"/app_name/untitled.txt"]; [myarr writetofile:file_path atomically:yes]; i trying write nsmutablearray in text file. code not working ios 8.3, nsmutablearray has nsmutabledictionary contents.

javascript - <textarea onclick="this.value; this.select();"> ? What kind of trick is this? -

working somebody's code, saw this: <textarea onclick="this.value; this.select();">(some predefined stuff)</textarea> what kind of trick / hack , supposed do? the statement this.value; will have no effect. following statement: this.select(); will cause contents of <textarea> selected.

convert Microsoft SQL Server specific query to ORACLE specific query -

hi have following query written microsoft sql server. need convert query oracle syntax. not have knowledge in oracle syntax. need make query work on oracle database. tried many ways no data returned. select sisprev_student.stu_id, sisprev_student.cwid, sisprev_student.sex, sisprev_student.nok_name, sisprev_student.nok2_name, sisprev_student.birth_dt, sisprev_student.currently_enrolled, sisprev_student.stu_athlete, sisprev_student.livingoncampus, sisprev_student.immigrationstatus, sisprev_student.scholarstatus, sisprev_student.stu_firstname, sisprev_student.stu_middlename, sisprev_student.stu_lastname, sisprev_student.ethnicity sisprev_address right outer join sisprev_student on sisprev_address.studentid = sisprev_student.stu_id left outer join sisprev_email on sisprev_student.stu_id = sisprev_email.studentid left outer join sisprev_phone on sisprev_stude

java - Out of order messages with jboss -

we have faced issue in message driven bean level. when multiple messages arrived mdb @ same time, process out of order. eg: original order of messages : message 1, message 2, message 3 but in application level onmessage() method received messages in incorrect order. eg: message 2, message 1, message 3 we using ejb3 message driven annotations in our mdb while jboss version jboss eap 6.4 , use hornetq @messagedriven(activationconfig = { @activationconfigproperty(propertyname = "destinationtype", propertyvalue = "javax.jms.queue"), @activationconfigproperty(propertyname = "destination", propertyvalue = "queue/queue1"), @activationconfigproperty(propertyname = "subscriptiondurability", propertyvalue = "durable"), @activationconfigproperty(propertyname = "reconnectattempts", propertyvalue = "-1"), @activationconfigproperty(propertyname = &quo

.net - Listing of detailed COM port names using VisualStudio 2013 C# -

i want list active com ports detailed names (like in windows device manager). i'm using code , works, slow. can take 45 seconds list of 5 com ports! doing wrong here or there faster way this? know there several postings this, haven't found right answer yet. private void updateserialports(richtextbox _txtbox) { foreach (string portname in system.io.ports.serialport.getportnames()) { string query = string.format("select * win32_pnpentity caption '%{0}%'", portname); managementobjectsearcher searcher = new managementobjectsearcher("root\\cimv2", query); managementobjectcollection coll = searcher.get(); if (coll.count > 0) { foreach (managementbaseobject collobj in coll) { managementbaseobject obj = collobj; _txtbox.appendtext(portname + " " + obj.getpropertyvalue("caption&qu

java - Disable SpellCheck on all TextView's in an activity or project wide -

how can disable spell check on textview's/edittext's. i want when call settext() on text view call spell checker service creates async task. in application causes bug volume of edittexts call settext can create many tasks thread pool end getting rejectedexecutionexception. 06-25 09:26:14.442: e/forms(10981): java.util.concurrent.rejectedexecutionexception: task android.widget.textview$3@3a7e75dd rejected java.util.concurrent.threadpoolexecutor@257f6244[running, pool size = 5, active threads = 5, queued tasks = 128, completed tasks = 6382] 06-25 09:26:14.442: e/forms(10981): @ java.util.concurrent.threadpoolexecutor$abortpolicy.rejectedexecution(threadpoolexecutor.java:2011) 06-25 09:26:14.442: e/forms(10981): @ java.util.concurrent.threadpoolexecutor.reject(threadpoolexecutor.java:793) 06-25 09:26:14.442: e/forms(10981): @ java.util.concurrent.threadpoolexecutor.execute(threadpoolexecutor.java:1339) 06-25 09:26:14.442: e/forms(10981): @ android.os.asynct

c - How exactly pointer to an array works? -

can explain how these values printed , why p , *p returning same values. #include <stdio.h> int main(){ int arr[] = {1,2,3,4}; int (*p)[4]; p = &arr; printf("%u %u %u %u %u", arr, &p, p, *p, **p); p++; printf("\n%u %u %u %u %u", arr, &p, p, *p, **p); return 0; } outputs on machine follows: 2686768 2686764 2686768 2686768 1 2686768 2686764 2686784 2686784 2686792 your example messy, pointer arithmetic messy in general, disrespectful types. example not make sense type theory point of view. arr points first element of array. note arr[i] equivalent *(arr+i) . arr 4-elements array of type int . p pointer 4-element array of type int . you assign p address of &arr , has same address arr (but type different, see below). then print out , means: arr address of first element of array &p address of p p address of &arr (whole array), address of arr , address of first eleme

c++ - Java XML RPC Client and server -

i trying communicate client , server in 1 project client , server both started in main() of project having 2 different threads when client try call answer_is function of server side show below exception. when run client , server combined in 1 project got error xception in thread "thread-2" java.lang.instantiationerror: org.apache.xmlrpc.xmlrpcrequest @ org.apache.xmlrpc.xmlrpcrequestprocessor.decoderequest(xmlrpcrequestprocessor.java:82) @ org.apache.xmlrpc.xmlrpcworker.execute(xmlrpcworker.java:143) @ org.apache.xmlrpc.xmlrpcserver.execute(xmlrpcserver.java:139) @ org.apache.xmlrpc.xmlrpcserver.execute(xmlrpcserver.java:125) @ org.apache.xmlrpc.webserver$connection.run(webserver.java:761) @ org.apache.xmlrpc.webserver$runner.run(webserver.java:642) @ java.lang.thread.run(thread.java:745) exception in thread "thread-3" java.lang.instantiationerror: org.apache.xmlrpc.xmlrpcrequest @ org

apache - using server configuration instead of .htaccess in Phalcon, something can't be load -

my .htaccess files below: ##/.htaccess <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ public/ [l] rewriterule (.*) public/$1 [l] </ifmodule> #/public/.htaccess <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php?_url=/$1 [qsa,l] </ifmodule> when try using server configuration instead of .htaccess, can't load. server configuration file below: .... rewriteengine on rewritecond %{document_root}/public/%{request_filename} !-d rewritecond %{document_root}/public/%{request_filename} !-f rewriterule ^/?public/(.*)$ /public/index.php?_url=/$1 [qsa,l] rewriterule ^$ /public/ [l] rewriterule (.*) /public/$1 [l] .... when image, call error: imgcontroller handler class cannot loaded what's worng ? thx.

linux - Pin app terminated abnormally due to signal 6 -

i trying use pin tool , loopprof instruments cluster using mpi, pin terminated abnormally due signal 6 error: a: source/pin/pin/image.cpp: img_type: 374: img passed img_type() stale #################################################### ## stack trace #################################################### addr2line -c -f -e "loopprof" 0x2b5b678a02c9 0x2b5b678a10b6 ?? ??:0 ?? ??:0 ?? ??:0 ?? ??:0 ?? ??:0 ?? ??:0 ?? ??:0 pin 2.14 copyright (c) 2003-2015, intel corporation. rights reserved. @charm-version: $rev: 71293 $ @charm-builder: builder @charm-compiler: gcc 4.4.7 @charm-target: ia32e @charm-cflags: __optimize__=1 __no_inline__=__no_inline__ pin app terminated abnormally due signal 6. can me fix error??

osx yosemite - Geoserver homebrew automatic launch OS X 10.10 -

i have installed geoserver homebrew on os x 10.10. can not find launchagent file. tried make own , put in ~/users/myuser/library/launchagents. i called homebrew.mxcl.geoserver.plist here content. not work. ideas? have start geoserver with geoserver /path/to/geoserver_data_dir/data <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>keepalive</key> <true/> <key>label</key> <string>homebrew.mxcl.geoserver</string> <key>programarguments</key> <array> <string>geoserver</string> <string>/library/webserver/geoserver_data_dir/data</string> </array> <key>runatload</key> <true/> <key>workingdirectory</key> <string>/usr/local/var</st

java - Read from stdin but unable to know when to stop -

i running commnads on commmand prompt. waiting last command's output complete. have read output , perform operation. command's output dynamic , can not predict when can stop reading. i having issues dont know when stop reading. if suppose keep while read(), last command output not ending new line. there mechenism can tell me if there has been no activity on stdin last 5mins, alert?? the approach took create class implementing runnable monitors value of shared atomicinteger flag. inputrunnable class sleeps 5 minutes (300000 ms) , wakes check whether value has been set main method. if user has entered @ least 1 input in last 5 minutes, flag set 1, , inputrunnable continue execution. if user has not entered input in last 5 minutes, thread call system.exit() terminate entire application. public class inputrunnable implements runnable { private atomicinteger count; public inputrunnable(atomicinteger count) { this.count = count; } p

javascript - How do I access a component's prop value from within an event handler? -

i have simple component event handler function. how access props value? doesn't epecting. class example extends react.component { handleclick( event, id ) { console.log( id ); console.log( this.props ); } ..... return ( <tr onclick={this.handleclick}> <th scope="row"> ..... return ( <tr onclick={this.handleclick.bind(this)}> <th scope="row">

facebook - jwplayer error loading could not load player configration -

when share video on facebook using server video url. use og tags required sharing video on facebook. video play on server when share video url on facebook , click on video gives me error loading not load player configration. <!doctype html> <html> <head> <title>iphone server live bradcasting</title> <meta property="og:url" content="https://belive.mobi/multitvfinal/videofb/player.html" /> <meta property="og:type" content="movie" /> <meta property="og:video:height" content="260" /> <meta property="og:video:width" content="420" /> <meta property="og:video:type" content="application/x-shockwave-flash" /> <meta property="og:title" content="live stream testing navjot singh" /> <meta property="og:description" content="live stream description" /> <meta property="og:image&

PHP curl to get and send static variable to URL -

i want send static values curl function. please correct me right syntax. values are <input type=hidden name="cke" value="1"> <input type=hidden name="ownerid" value="2"> curl function: $fields_string = [ 'cke'=> urlencode($post["1"]) 'ownerid'=> urlencode($post["6"]) ] foreach ($post $key => $value) { $fields_string .= $key . '=' . $value . '&'; } curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $fields_string); curl_setopt($curl, curlopt_returntransfer, true); $response = curl_exec($ch); curl_close($ch); also, in next step want values html , post through curl function. thanks

python - Django: Twitter login being redirected to Example Domain -

Image
i'm using django-socialregistration enabling users login using twitter account on application. settings.py installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rango', 'django.contrib.sites', 'socialregistration', 'socialregistration.contrib.twitter' ) ... ... template_context_processors = ('django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request',) authentication_backends = ( 'django.contrib.auth.backends.modelbackend&

jsf - Need to pass the current tab name to the backing managed bean from dynamically generated tab -

i using primefaces. , requirement have number of tabs generated based on list specified in backing bean. second criteria if tab changes content under tab should changes. kept onchange event , tried value through event.gettab().gettitle(), returning null backing bean. <p:tabview id="tabview" binding="#{dndproductsview.tabview}"> <p:ajax event="tabchange" listener="#{dndproductsview.ontabchange}"/> </p:tabview> managed bean required codes :- @postconstruct public void init() { user = sessionbean.getusername(); categorylist = categorylogics.findallorderedbycategoryname(); productlist = productlogics.findallorderedbyproductname(); droppedproducts = new arraylist<product>(); } private tabview tabview; @inject private facescontext facescontext; public void settabview(tabview tabview) { this.tabview = tabview; } public tabview gettabview() { tabview = new tabview(); (category c :

html - chrome layout only correct after window resize -

Image
i'm having strange issue chrome initial rendering of page incorrect, done forces redraw (eg. resizing window) layout rendered correctly. maximizing seems cause problems. codepen example here initial (bad) layout: redrawn (good) layout html, body { margin: 0; padding: 0; } .photo-frame { display: inline-block; padding: 1.75%; background-color: #111; box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 1); } .photo-matte { display: inline-block; padding: 5% 6%; background-color: #fff; box-shadow: inset 2px 2px 12px 3px rgba(0, 0, 0, 0.6), inset 0px 0px 1px 1px rgba(0, 0, 0, 1); } .photo-inset { display: inline-block; border: solid 5px #000; border-top-color: rgba(170, 170, 170, 1.0); border-right-color: rgba(216, 216, 216, 1.0); border-bottom-color: rgba(240, 240, 240, 1.0); border-left-color: rgba(204, 204, 204, 1.0); } img { height: 70vh; display: block; } <html> <body> <div class="photo-f

html - Font is coming totally different in Chrome and Firefox -

Image
hi using font , have generated webfont kit. on firefox , chrome font coming out totally differently not resmble @ all. have attached images how font looks like. suggestions on how it? solution appreciated in advance. using "petescriptregular" font. this how using fonts in css file: @font-face { font-family: 'myriadpro-regular'; src: url('/www/magenta/wp-content/themes/ecorecycle/fonts/myriadpro-regular.eot?#iefix') format('embedded-opentype'), url('/www/magenta/wp-content/themes/ecorecycle/fonts/myriadpro-regular.woff') format('woff'), url('/www/magenta/wp-content/themes/ecorecycle/fonts/myriadpro-regular.ttf') format('truetype'), url('/www/magenta/wp-content/themes/ecorecycle/fonts/myriadpro-regular.svg#myriadpro-regular') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'petescriptregular'; src: url('/www/magenta/wp-content/themes/

c# - Send template-notification to tile and toast once -

i register 2 different templates windowsphone clients (one tile-update , 1 toasts). is there possibility send 1 notification , windowsphone clients getting toast notification , tile update? i found forum thread on msdn following message (in answer): if call method sendtemplatenotificationasync({“properties of template”}, “en-us”)) this, target toast , tile both notifications device a. but won't work me. client gets tile-update , not toast notification. i tried template both in xml (tile , toast). found here . won't work (only toast visible on client). i know, can work additional tags (like "toast" , "tile") , send notifications following code snippet. think ugly solution: await hubclient.sendtemplatenotificationasync(content, tags + " && toast"); await hubclient.sendtemplatenotificationasync(content, tags + " && tile"); any appreciated. thanks edit: templates , notification-properties: pr

mysql - CASE WHEN column1 IS NULL THEN NULL ELSE column2 END -

i fetching total number of upvote in comment table, want last row print null in content column. following simple query trying run: select id , content -- compare, don't need , (case when id null null else content end) editedcontent -- need this(with null value in end) , sum(upvote) `test`.`comment` group id rollup output: +------+-------------+---------------+-------------+ | id | content | editedcontent | sum(upvote) | +------+-------------+---------------+-------------+ | 26 | content13-2 | content14-1 | 2 | | 27 | content14-1 | content14-2 | 2 | | 28 | content14-2 | content15-1 | 2 | | 29 | content15-1 | content15-2 | 3 | | 30 | content15-2 | content15-2 | 2 | | null | content15-2 | content15-2 | 55 | +------+-------------+---------------+-------------+ 6 rows in set (0.00 sec) expected output: +------+-------------+---------------+-------------+ | id | co

mongodb - Laravel 5.1 relationship with multiple database -

i using laravel5.1 mongodb in application. i have 1 default database , separate databases each user. i want use relationship between user seperate db , default db. try using protected $table = 'default_db_name.table_name'; , try solution laravel forum. http://laravel.io/forum/02-12-2014-many-to-many-relationship-not-working-across-databases . the laravel documentation , google dont seem worked me. any appreciated try https://github.com/jenssegers/laravel-mongodb there can connect multiple servers 'mongodb' => array( 'driver' => 'mongodb', 'host' => array('server1', 'server2'), 'port' => 27017, 'username' => 'username', 'password' => 'password', 'database' => 'database', 'options' => array('replicaset' => 'replicasetname') ),

xcode - Schedule a local notification for a specific time in Swift 2 -

i've been on these forums , other sites , keep getting pieces of answer don't add up. essentially, create notification fires, example, every weekday @ 6:28 am, 12:28 pm, , 5:28 pm. have pieces i'm unsure go. setting right @ all? appreciated. let notification:uilocalnotification = uilocalnotification() notification.category = "news , sports" notification.alertaction = "get caught world" notification.alertbody = "live news , sports on vic in minute!" uiapplication.sharedapplication().schedulelocalnotification(notification) preparing show local notifications requires 2 main steps: step 1 on ios 8+ app must ask and, subsequently, granted permission user display local notifications. asking permission can done follows in appdelegate. func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { ... if #available(ios 8, *) { application.registeruserno