Posts

Showing posts from May, 2015

centroid - How to find the distance between instances within a cluster in WEKA? -

i have done clustering set of text documents using weka.it grouped similar documents cluster.i want measure how text documents close each other within cluster.how calculate distance between documents within cluster. anyone please me.i new user data mining. this code simplekmeans clustering algorithm: euclideandistance dist = weka.core.euclideandistance(); double distance = dist.distance(clustercentroid.instance(clusternumber), data.instance(instaceindex)); nb: distance normalized

command line - How can I change my VLC playback speed fine grain in real time? -

i doing research participants run on treadmill , project video of trail in front of them. attempting change speed of video in relation participant changing speed on treadmill. i've seen gui has options fine grain control of video playing, can't seem replicate using command-line options. can either play video @ fixed fine grain speed (i.e. 1.23x) or can change real time in large increments via rc interface (faster 1.5x, 2.0x). solution can version of vlc compatible windows xp or cygwin. script process won't changing speeds manually. thank much! you can experiment mplayer slave mode. to try slave mode run: mplayer -slave -quiet <movie> and type slave commands console. you can use named pipe: mkfifo /tmp/fifofile mplayer -slave -input file=/tmp/fifofile movie.avi you can try these slave mode commands: speed_incr <value> add <value> current playback speed. speed_mult <value> multiply current speed <value>. speed

c++ - calculating time taken to create n threads -

i trying create 1000 threads can know how time taking create them. im using pthreads. im getting segmentation fault: 11. googling tells me might case of using memory doubt possible reason. any pointers might reason ? code: int main(int argc , char *argv[]) { int *i; // matti's answer below: ... = (int*)malloc(sizeof(int)); *i = 0; while( *i < 100) { pthread_t thread_id; puts("connection accepted"); if( pthread_create( &thread_id , null , connection_handler , (void*) &i) < 0) { error("could not create thread"); return 1; } //pthread_detach(thread_id); *i = *i + 1; } return 0; } void *connection_handler(void *i) { sleep(1); return 0; } your problem fact you're dereferencing pointer never initialized: int *i; *i = 0; what's wrong int i; ?

mongodb - Ember-data 'get' relationship promise returns null (identifier, not subdocument) -

i developing app uses express/mongodb ember frontend. failing access relationship data in ember. there 3 collections: org, user, , location. the organization schema exists on it's own in mongodb: const organizationschema = new schema({ creationdate: { type: date, default: date.now } }); the user , location schemas both have identifiers pointing organization defining relationship, eg. const userschema = new schema({ organization: { type: schema.objectid, ref: 'organization', index: true, required: true }, ... on frontend, in ember 'location' route, trying information async relationship between user , organization. want organization id model hook: tl;dr returns null return this.store.findrecord("user", this.get("session.currentuser.id")) .then(user => user.get('organization')).then(data => console.log("show me org:", data)); if can

cryptography - what method or technique is used to generate a random key and public key required in randomized hybrid encryption technique? -

i want use hybrid encryption technique involves combination of aes technique rsa technique encrypting block of data.since technique involves generation of random key encrypting data using aes algorithm , random key encrpyted public key using rsa algorithm. confused algorithm used here generate random key public key. single key generation algorithm used generate both random key public key?? or 2 different methods should use generating these keys??? please clear confusion giving suitable solution. public / private key pairs related mathematically, , require different algorithm generate them. have specific properties, why need such large key (1024 bits or more) have secure key. symmetric ciphers such aes use shorter keys because cipher not rely on specific mathematical properties of key itself. that's why can security 128-bit key aes. typically, architecture you're describing uses aes one-time random session key encrypt bulk data, , private key encrypts aes sess

angularjs - jQuery Plugins not working with Angular Router (Animsition) -

i'm trying animsition plugin working in angular project. the loader stuck , view doesn't load. the jquery plugin in directive, , works separate html files without angular routing. want work angular router. // in directive, defaults were: loadingparentelement : 'body', overlayparentelement : 'body', (and worked fine without router + separate full html files head/body/script tags sources. separate views, changed each view have parent main elements, assuming acted parent body elements. still didn't work. app.js var app = angular.module('myapp', ['ngroute']); app.config(function($routeprovider, $locationprovider) { $routeprovider .when('/', { templateurl: 'partials/home.html', controller: 'appctrl', }) .when('/work', { templateurl: 'partials/work.html', controller: 'appctrl', }) .otherwise({ redirectto: '/' }); }); // directive app.dire

matlab - How do I calculate a truncated-sum approximation? -

Image
. i'm take image, convert set of 3 matrices using imread() , calculate truncated-sum approximation each matrix using n=1,2,3,4,8,16,32,64,128 terms. have matrices, i'm not sure last part , reading bit vague. mean truncated-sum approximation? update based on given answer: i tried following: a = double(imread("image.jpg"))/255; [u1, s1, v1] = svd(a(:,:,1)); [u2, s2, v2] = svd(a(:,:,2)); [u3, s3, v3] = svd(a(:,:,3)); n = 128; trunc_image = (u1(1:763,1:n)*s1(1:n,1:n)*v1(1:n,1:691))*255; imwrite(trunc_image, "truncimg.jpg", "jpg"); ...but resulting image looks this: when perform svd on image i : [u,s,v] = svd(i,'econ'); %//you matrices u, s, v s diagonal matrix, decreasing singular values along diagonals. approximation truncating... means can reconstruct i' zeroing out singular values in s : i_recon = u(1:256,1:n)*s(1:n,1:n)*v(1:256,1:n).'; %//reconstruct keeping first n singular val

android - WeatherApp, setting an image inside and AsyncTask while parsing XML using setImageResource() -

so i'm working on basic weather application pulls xml yahoo weather api, parses it, , displays information. have async task in doinbackground method pulls xml , uses stringbuilder save xml, , in onpostexecute parses xml in format need. trying set image in mcondimg imageview in post execute, put can't seem working. want have condimg change per codes in xml public api call: https://query.yahooapis.com/v1/public/yql?q=select%20 *%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3d%22warrensburg%2c%20mo%22)&format=xml&env=store%3a%2f%2fdatatables.org%2falltableswithkeys weatherfragment.java (the fragment contains of actual parsed axml , asynctask classes.) import android.app.progressdialog; import android.content.context; import android.net.uri; import android.os.asynctask; import android.os.bundle; import android.os.handler; import android.support.v4.app.fragment; import android.view.layoutinflater; import and

vb.net - why 0, not Nothing in VB System.Data.DataTable -

Image
the codes: private m_log_datatable system.data.datatable = nothing private m_freq string = nothing private m_r single = nothing private m_l single = nothing private m_c single = nothing private m_rp single = nothing private m_rs single = nothing private m_z single = nothing private m_esr single = nothing private m_dcr single = nothing private m_q single = nothing private m_d single = nothing ... private sub log() try m_freq = nothing m_r = nothing m_l = nothing m_c = nothing m_rp = nothing m_rs = nothing m_z = nothing m_esr = nothing m_dcr = nothing m_q = nothing m_d = nothing m_value = nothing m_unit = nothing m_log_datatable.rows.add(datetime.now, getdut(), getmode(), m_freq, m_r, m_l, m_c, m_r, m_rs, m

sysml - Create instance specification code in Rhapsody -

i working on rhapsody sysml project work , need able model different configurations of our system. give concrete example, if our system vehicle, want able simulate vehicle different configurations of engines, wheels, etc. this first time using sysml in book a practical guide sysml discusses, in chapter 7, concept of instance specifications. these sound need, , rhapsody appears have support them. created instance specification in rhapsody, giving specific values engine , wheels. once create instance specification cannot find way create instance specification. noticed rhapsody doesn't generate code instance specification. so questions following, can instance specifications used create different configurations of system , if how? if not, best method modeling different configurations of system? thanks can provide.

mocking - C# set value of private variable -

this private value want set private phaselist stages; this test mockrepository mocks = new mockrepository(); mocks.stub<useraction>(); game g = new game(players, cardlist); type stage = typeof(phaselist); fieldinfo stinfo = stage.getfield("stages", bindingflags.nonpublic | bindingflags.instance); phaselist p = new phaselist(); p.add(new discardphase(players[0])); p.add(new discardphase(players[0])); stinfo.setvalue(g, p); g.processuserinput(0, mocks.stub<useraction>()); i error: system.nullreferenceexception: object reference not set instance of object. it points line: stinfo.setvalue(g, p); i dont understand why stinfo=null; can me? you're attempting type of phaselist class, , private field inside named stages . doesn't have field named "stages", i'm assuming, null . what do have field named "stages" in other cl

pyspark - Spark Job Wrapping a Transformation With Local Operations (Very Slow and OOM Problems) -

i'm trying write spark job analyzes time series in variety of ways. through series of transformations, take dataframe , drop rdds, have rows structured as: row[((tuple, key) t1, t2, t3, t4, t5, ...)] let's call rdd: rdd . i call rdd.flatmap(foo(r[1:])) , , expected foo take it's input list of times, , deliver list of analytics it's output. let's say def foo(times): return [average(times), percentile(times, 25)] when run job, takes forever , oom errors cause fail. times should have no more 600k items, , that's super outlier case. have between 10k - 100k . i can't use reducebykey() because operations need perform require looking @ entire time series , going , forth multiple times. does have recommendations on way solve oom slowness problem? assuming i've read question correctly, have rdd each row list of tuples , rows can have 600k tuples. without knowing cluster configurations or looking @ actual code, can specula

nlp - natural language processing word association -

my project needs natural language processing. i'm new field. what trying when user enter character, want list of english characters can follow specific character in order make legitimate word. what specific term in nlp doing this? tried googling while, had no luck since don't know term. tutorials start with? there libraries in doing specific task? thank you. welcome nlp community. the term you're looking query prediction or sentence prediction . example when type characters in google, starts prediction word/phrases might want search for. , behind technology, used both (a) language based heuristics , (b) user-based search history train model. call google instant , see http://www.google.com/insidesearch/ if you're looking sentence/word prediction , it's more when use phone there function helps type faster, technically, it's call autocomplete ( https://en.wikipedia.org/wiki/autocomplete ), see https://en.wikipedia.org/wiki/autocomplete . mo

ruby on rails - How to copy Digital Ocean app folder to local machine? -

i'd copy contents of app folder digital ocean droplet local machine, because i've accidentally removed app local machine , need back. i've tried following, example, scp -r root@104.232.321.32:/path-to-app which gave me following, usage: scp [-12346bcpqrv] [-c cipher] [-f ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-p port] [-s program] [[user@]host1:]file1 ... [[user@]host2:]file2 how copy app local machine? need set destination scp work, destination can set copys local machine, /user/sites directory? try: scp -r root@104.232.321.32:/path-to-app . this should copy current directory. do: scp -r root@104.232.321.32:/path-to-app ~/project to copy specific folder. two tangential observations, way: stop using digitalocean droplet root. should make own user account on droplet , set ssh authentication. you should using git keep remote copy of project , local copy in sync, not scp (granted, may strange case, making sure you'

android - PlaceAutoComplete not working in signed apk -

i have strange issue. placeautocomplete working fine in debug apk. in signed apk, autocomplete fragement shows, if type returns previous screen without doing anything. here snippet mainactivity: try { intent intent = new placeautocomplete.intentbuilder(placeautocomplete.mode_fullscreen) .build(mainactivity.this); startactivityforresult(intent, place_autocomplete_request_start); }catch(googleplayservicesrepairableexception e){ // todo: handle error. toast.maketext(mainactivity.this, "error in googleplayservicesrepairable", toast.length_long).show(); }catch(googleplayservicesnotavailableexception e){ toast.maketext(mainactivity.this, "error in playserviesnotavbl", toast.length_long).show();

c++ - 'va_start' used in function with fixed args error -

my nullpointcheck function: template<typename t, typename... args> bool __nullpointcheck(t first, args... args) { bool ret = true; va_list vl; auto n = sizeof...(args); va_start(vl, n); (auto = 0; <= n; ++i) { auto p = va_arg(vl, t); if (!p) { ret = false; } } va_end(vl); return ret; } but i'm getting ndk build error follows: 'va_start' used in function fixed args va_start(vl, n); when change second param in va_start first follows: va_start(vl, first); ndk-build export error follows: 'va_start' used in function fixed args va_start(vl, first); ^ e:/android_home/android-ndk-r10c/toolchains/llvm-3.5/prebuilt/windows-x86_64/bin \..\lib\clang\3.5\include\stdarg.h:33:29: note: expanded macro 'va_start' #define va_start(ap, param) __builtin_va_start(ap, param) there no errors in vs2013, code can's pass ndk-build stage va_start etc.

How to open PDF online using laravel 5.2? -

if clicked link url : website.com/open/pdf/document_one_drag_3.pdf, open pdf in browser instead of download. code in route.php route::get('/open/pdf/{filename}', function($filename) { // check if file exists in app/storage/file folder $file_path = public_path('uploads/docs/'.$filename); if (file_exists($file_path)) { return response::make(file_get_contents($file_path), 200, [ 'content-type' => 'application/pdf', 'content-disposition' => 'inline; '.$filename, ]); } else { // error exit('requested file not exist on our server!'); } }); the pdf file still downloading , not opened in browser. wrong ? considering laravel 5.2, download method may used generate response forces user's browser download file @ given path. $pathtofile = public_path(). "/download/filename.pdf"; return response()->download($patht

Java Programming for sorting an array -

i have attended interview yesterday, don't find solution of given problem below. how sort int array starting 3 digits numbers , remaining 2,1,4,5 etc digits. ex:-input i={1,34,323,456,5432,34566,33,45,654} output is, i={323,456,654,1,34,33,45,5432} i assumed 1 might wish alter order of number of digits, , allow them specified in order. have "sort" array corresponds number of digits should processed. assumed 1 should sort values in increasing order within final array. thought sorting part of experiment, did not use arrays.sort. here take on approach: public static void main(string[] args) { int[] arr = {1,34,323,456,5432,34566,33,45,654}; int[] sort = {3, 2, 1, 4, 5 }; int lastpos = 0; int looppos = 0; int[] output = new int[arr.length]; // process whole array (int s = 0; s < sort.length; ++s) { string fmt = string.format("^[0-9]{%d}$", sort[s]); pattern pat = pattern.compile(fmt);

c++ - How QTableView or QListView is scrolling with hand drag? -

in qgraphicview, if set : ui->graphicsview->setdragmode(qgraphicsview::scrollhanddrag); this code make graphicsview can scroll items mouse pressed , drag. how can make qlistview or qtableview qgraphicsview? you need subclass these widgets , reimplement qwidget::mousepressevent , qwidget::mousmoveevent , qwidget::mousereleaseevent . have careful because may interfering actions mapped these default implementations (e.g. selecting) need tweaked bit. example (assumed subclass of qlistview ): void mylistview::mousepressevent(qmouseevent *event) { if(event->button() == qt::rightbutton) //lets map scrolling right button m_scrollstart = event.pos(); //qpoint member, indicates start of scroll else qlistview::mousepressevent(event); } and then void mylistview::mousemoveevent(qmouseevent *event) { if(!m_scrollstart.isnull()) //if scroll started { bool direction = (m_scrollstart.y() < event.pos().y()) //determine dir

android - Error in compile SDK version? -

can please tell me how fix error: apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion '21.1.2' defaultconfig { applicationid "com.example.abhishek.detector" minsdkversion 10 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } productflavors { } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile 'com.google.android.gms:play-services-location:8.1.0' } error: error:execution failed task ':app:processdebugresources'. com.androi

javascript - Next/previous anchor link, how to update the next/previous links when the user scrolls -

first time posting here! stack overflow told me include code codepen.io did, think actual link more useful reading code here. i applied http://codepen.io/haustraliaer/pen/lekny/ javascript code websites , works great. want scrolling past pages update links when scroll down , click next, doesn't go previous anchor link lies. i tried using scroll event , getboundingclientrect seems can't work that. any towards solution me greatly. here link homepages http://quki.kapsi.fi/wasd $('.js-scroll-to').click(function(e) { target = $($(this).attr('href')); if (target.offset()) { $('html, body').animate({ scrolltop: target.offset().top + 'px' }, 600); } e.preventdefault(); }); $('.js-next').click(function(e) { var selected = $(".js-list-item.js-current-panel"); var anchors = $(".js-list-item"); var pos = anchors.index(selected); var next = anchors.get

sql - H2 database: is it possible to rename a constraint? -

is there way rename constraint in h2 database? same question one: sql server rename constraint? , h2 database. no, can not, there no sql statement in the grammar of h2 can it. so need create new constraint , drop old one.

Linq to SQL distinct join and group -

i've been struggling linq query... have following 2 tables: 1) emailrunheaders - columns: id, emailrunid, emailid 2) emailtrackers - columns: id, emailid every day batch of emails sent. unique "emailrunid" assigned batch/group of emails , each email assigned "emailid". info stored in "emailheaders" table. so, each emailid in table unique, emailrunid appear more once..since there more 1 email in each "batch" or run. when email opened, using http handler, open logged in emailtracker table...where particular emailid stored. since email opened more once, possible emailid appear more once in table. i need total number of emails opened, without double counting emails opened more once, every email run. this have far. nested query works fine..returning total number of emails opened each run, if there @ least 1 opened each run. tried wrapping in join return distinct emailrunids header table..but stuck..i don't know how emailrunid "

c# - how to display orderby descending in LinQ -

i want display order descending in linq web service, , have linq query want order created time. here web service (getcontent.asmx.cs): [webmethod] public string[] getcontenttext(string namapage, string tanggalakses, string key) { string[] ret = new string[4] { null, null, null, null }; if (clsencrypt.decodefrom64(key) == tanggalakses) { frontendcontent dt = db.frontendcontent.firstordefault(m => m.namapage.tolower() == namapage.tolower().orderbydescending(m => m.createdtime.tolist()); //list<frontendcontent> dt = db.frontendcontent.orderbydescending(m => new { m.createdtime }).tolist(); if (dt != null) { ret[0] = dt.id.tostring(); ret[1] = dt.headertext; if (string.isnullorempty(ret[1])) { ret[1] = ""; } ret[2] = dt.subheadertext; if (string.isnullorempty(ret[1])) { ret[2] = "

Set a different version to my jars at project deployment stage - Maven -

i have maven deployment problem: when execute maven deploy, maven pushes jars remote repository under project version specified in pom files: <version>version.x.y.z</version> the problem don't want overwrite previous jars every time rebuild project, want increment version automatically every time build part of building process. (so, don't want use cli tool such "versions maven plugin" change pom files before building process.) have environment variable, $project.buildnumber, can use set project version. is possible configure maven-deploy-plugin automatically change version (for instance using environment variable)? many thanks!!

akka - How to test actors with components injected by Guice in Play! scala 2.5 -

i'm using guice inject components inside actor explained in play! scala 2.5 documentation . in application, inject unshortlinksfactory: unshortlinks.factory in classes , create new actor this: val unshortlinksactor = actorsystem.actorof(props(unshortlinksfactory(ws))) the problem cannot inject components in test class (can i?) otherwise test not started. (please note use scalatest.) how can create actor in tests? (it's fine if can create like val unshortlinksactor = system.actorof(props(unshortlinksfactory(ws))) best able create testactorref akka.testkit in order have access underlyingactor . what in order test is: i extends test class testkit(actorsystem("testsystem")) . then create props this: lazy val unshortlinkfactoryprops = props(unshortlinkfactory( dbconfigprovider = dbconfprovider) here dbconfprovider created mocked: lazy val appbuilder = new guiceapplicationbuilder() lazy val injector = appbuilder.injector() lazy

mysql - php script only display one row of data instead of many in android studio -

i ask how can display many row s of data instead of 1 row . following code display 1 row of record instead of multiple records available. i'm using mysqli_prepare statements here. or problem on android studio coding? application implemented login function , coding below. <?php $host="db_host"; $user="db_user"; $password="db_password"; $db="db_name"; $con = mysqli_connect($host,$user,$password,$db); $parentic=$_post["parentic"]; $password=$_post["password"]; $selectquery = mysqli_prepare($con, "select parents_data.name, student_list.studname, student_list.studic, student_list.form,student_list.class,discipline_record.date,discipline_record.rulescode, discipline_record.typesofmistakes,discipline_record.punishment discipline_record left join student_list on discipline_record.studic = student_list.studic left join parents_data on student_list.parentic = parents_data.parentic parents_data.parentic = ? , parent

How does IOS devices read javascript in browser? -

i had asked question test project. the dropdown using boostrap.min.js works in android currently. we've changed location of folders linked boostrap js this: <script type="text/javascript" src="../js/bootstrap.min.js"></script> . notice ../ part added. there no problems reading file on non-ios based devices. when check on iphone, dropdown doesn't work. thought maybe how safari reads css or javascript? here site btw: http://star-allianz.com/en/en/index.html i don't own iphone5 or iphone6+ hard me test things. note: missing files aren't problem because dropdowns still work in android phone. ps: i've tried using online ios device simulators , built-in google chrome simulator. dropdowns work when load site. however, when using real ios device, don't. keep in mind, works in android. also, i've never made changes bootstrap.min.js .

javascript - Trying to zoom a canvas image not working properly -

Image
i trying zoom canvas image. here function i'm using. <script language="javascript"> $('#zoomin').click(function(){ var canvaswidth=canvas.width; var canvasheight=canvas.height; canvas.width=canvaswidth*1.5; canvas.height=canvasheight*1.5; context.scale(1.5,1.5); }); </script> but problem image being zoomed, background image not being zoomed. please see image. update this paint.js colorpurple = { r: 203, g: 53, b: 148 }; var colorgreen = { r: 101, g: 155, b: 65 }; var coloryellow = { r: 255, g: 207, b: 51 }; var colorbrown = { r: 152, g: 105, b: 40 }; var context; canvaswidth = 500; canvasheight = 500; var mycolor=coloryellow; console.log(mycolor); var curcolor = mycolor; var outlineimage = new image(); var swatchimage = new image(); var backgroundimage = new image(); var swatchstartx = 18; var swatchstarty = 19; var swatchimagewidth = 93; var swatchimageheight = 46;

war - Importing Custom fonts -

i have use custom font have provide myself .war archive compiled maven. fonts available in following formats: eot, svg, woff, woff2 , ttf. firefox , google chrome both manage files in formats upon http request fail use them. web console gives following errors depending on font file format: "rejected sanitizer, file length wrong, failed download" i have tried using font sure wasn't caused file itself. are font files corrupted when archived? do have located in specific spot of archive? turns out maven filters default ressources. problem fonts filter aka compressed. controling webressources compiled solved problem. <webresource> <directory>src/main/resources/fonts</directory> <targetpath>interface/fonts</targetpath> <includes> <include>**/**</include> </includes> </webresource>

class - Error LNK 2005 & LNK1169 C++ Visual Studio DLL -

i'm trying create dll plugin obs, when try compile simple script gives me following errors - error 1 error lnk2005: _dllmain@12 defined in dllmain.obj c:\users\user\documents\visual studio 2013\projects\name\nameenhanced\nameenhanced.obj nameenhanced and error 2 error lnk1169: 1 or more multiply defined symbols found c:\users\user\documents\visual studio 2013\projects\name\debug\nameenhanced.dll 1 1 nameenhanced i've created simple script, has 2 files namely - handle.h nameenhanced.cpp these files - handle.h #include <windows.h> #include <string> using namespace std; namespace msgebox { class mymessage { public: static void createmessage(hwnd windowsowner, lpcwstr themessage, lpcwstr thetitle, uint theicon){ messagebox(windowsowner, themessage, thetitle, theicon); } }; } and nameenhanced.cpp // nameenhanced.cpp : defines exported functions dll application. // #include "

ios - Swift 2.2 syntax error: Cannot call value of non-function type 'UITableView!' -

i using tab gesture in uitableview cell following error occur. "cannot call value of non-function type 'uitableview!'" using following code inherited previous objective c project: var p: cgpoint = sender.locationinview(self.tableview) var indexpath: nsindexpath = self.tableview(forrowatpoint:p) var buttontag: int = indexpath.row var selectview = self.storyboard?.instantiateviewcontrollerwithidentifier("dropdownselectionviewcontroller") as? dropdownselectionviewcontroller var selectwithnavibar: uinavigationcontroller = uinavigationcontroller(rootviewcontroller: selectview!) if (buttontag == team_row) { getpeopleswithmenutype(team) }else{ if (buttontag == offices_row) { selectview?.menuname = offices_menu // selectview?.ismultipleselection = yes }else if(buttontag == categories_row){ }else if(buttontag == internal_groups_row){ } } i appreciate if help

database - MySQL queries waiting for other queries to finish -

we have 30-40 different projects in python , php update, insert , select more 1 million rows of data in mysql db every day. currently use innodb engine our tables. the problem: have peaks in mysql when projects working , lots of queries processing in db. there main queries important finish asap (high priority) , queries can wait finish of main queries (less priority). go mysql concurrent causes main queries wait finishing of less priority queries. questions: is there possibility release lock in tables before executing main queries (so can finish asap)? or create locks if help? can pause less priority queries execution when start execution main queries automatically? can use high_priority , low_priority in queries help? are there configurations in mysql can help? can changing tables myisam or other db engine help? let me know thoughts , ideas. no. might try upgrading mysql 5.7 allows parallel replication within tables if transactions not interfere each oth

c++ - Using variables from within parent class -

i have structure of classes: class { class b; class c; int updates = 0; // invalid use of non-static data member 'a::updates' c* example; class b { public: // ... void up_plus() { updates++; // problem here } // , other methods....... }; class c : public b { public: int size; // ... void sizeup() { example->size++; // invalid use of non-static data member 'a::header' } // , other methods.... }; }; my question is, how can fix structure? in java work, here there problem. the syntax; class { int updates = 0; // allowed in c++11 , above // ... is allowed compiling c++11 standard , above. assuming using clang or g++, add -std=c++11 or -std=c++14 command line. secondly, nested classes not have immediate access instance of outer class. still need constructed pointer or reference "parent". given inheritance relationship of b , c , following suitable you; class

Extracting text between 2 specific strings with multiple occurrences in bash -

i have big xhtml file lots of junk text don't need. need whatever text lies between 2 specific strings occur many times within file, e.g. <html> <xyz> unneeded text </xyz> <mytag> important text1 </mytag> <xyz> unneeded text </xyz> <xyz> unneeded text </xyz> <mytag> important text2 </mytag> <mytag> important text3 </mytag> <xyz> unneeded text </xyz> </html> my output should be: important text1 important text2 important text3 i need using bash script. thanks help using regex on xml format risky, particularly line based text processing tool grep . cannot make sure result correct. if input valid xml format, go xml way: xpath expression. with tool xmlstarlet , can do: xmlstarlet sel -t -v "//mytag/text()" file.xml it gives desired output. you can xmllint , however, need further filtering on output.

windows 8 - Can you have in-app purchase in a free app? -

i making game windows 8 , going have ads in it. want offer remove ads in-app purchase according microsoft guides app has have been sold able handle in-app purchases. there ways allow in-app purchases without selling app? want free, not sold or trialed. yes can this. dont know you've seen cant. in 2 of apps (peregrine , "map wallpaper")

jquery - How to add class in parent li using child link button from code behind in asp.net c#? -

here html code page : <ul class="list quicker"> <li><asp:linkbutton runat="server" id="education_news" onclick="education_news_click" >education</asp:linkbutton></li> <li><asp:linkbutton runat="server" id="immigration_news" onclick="immigration_news_click">immigration</asp:linkbutton></li> <li><asp:linkbutton runat="server" id="visa_news" onclick="visa_news_click" >visa</asp:linkbutton></li> </ul> here code behind page i've used: protected void education_news_click(object sender, eventargs e) { string edu = education_news.text; using (sqlconnection _con = new sqlconnection(_data.cs)) { sqlcommand _cmd = new sqlcommand("select * tbl_brochures type=@type", _con); _cmd.parameters.addwithvalue("@type", edu);

gerrit - Can't run any git commands in $GERRIT_SITE/git folder -

i have gerrit installed. when project created through gerrit web ui, project reflected in $gerrit_site/git folder. for instance if project trial created on gerrit, trial.git folder created in $gerrit_site/git folder. but when try run git commands in $gerrit_site/git/trial.git folder such follows, following error: $ git status fatal: operation must run in work tree i not know how go , need guidance. the reason find on disk bare repository, without working tree (i.e. files of particular branch). totally normal git server , find same inside .git/ directory once cloned repository. edit can work on server side these bare repos, when specify repo's path argument git_dir environment variable: git_dir=/var/gerrit/review/git/trial.git/ git log --quiet --pretty=medium this esp. helpful when using gerrit hooks something, when new change merged etc.

Encoder VHDL Code -

-- code design here library ieee; use ieee.std_logic_1164.all; entity encoder8_3 port( din : in std_logic_vector(7 downto 0); dout : out integer range 0 15 ); end encoder8_3; architecture encoder8_3_arc of encoder8_3 begin dout <= "0" when (din="10000000") else "1" when (din="01000000") else "2" when (din="00100000") else "3" when (din="00010000") else "4" when (din="00001000") else "5" when (din="00000100") else "6" when (din="00000010") else "7"; end encoder8_3_arc; will code run?i want return integers in place of binary equivalent. why won't code compile ? because integer literals in vhdl not have quotes: library ieee; use ieee.std_logic_1164.all; entity encoder8_3 port(

python - Django not reusing connections to MySQL with CONN_MAX_AGE=60 -

i using django 1.9.2 in development ( debug=true ) mysql 5.6.23. below database settings databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'dbname', 'user': "django", 'password': 'password', 'host': 'localhost', 'port': '3306', 'conn_max_age': 60, } } i querying mysql number of active connections command below: show status `variable_name` = 'threads_connected'; it yield result +-------------------+-------+ | variable_name | value | +-------------------+-------+ | threads_connected | 10 | +-------------------+-------+ 1 row in set (0,00 sec) every time make new request django, number of connected threads increase until (1040, 'too many connections') when number threads_connected=151 . furthermore, connections not closed after 60s. this behavior not

php - Upload image name issue when share the social sites Upload plugin in Cakephp 2.x -

i told image upload plugin version cakephp2.x not cakephp3.x i using upload plugin image upload in cakephp2.x . nice plugin. https://github.com/szajbus/uploadpack problem: if upload image name koala - animal.jpg plugin stored name <id>_koala - animal.jpg when share image social site . image not sharing social site due (image name)space issue. so want store image name <id>_koala_-_animal.jpg i found solutions after 1 , half days: add following code in following file upload\model\behavior\uploadbehavior.php public function beforesave(model $model,$options=array()) { //existing code /*fixes code before "return true;" start*/ if(isset($model->data[$model->alias][$field])){ $model->data[$model->alias][$field] = str_replace(' ','_',$model->data[$model->alias][$field]); } /*fixes code before "return true;" end*/ return true; }

c++ - How to guarantee that files downloaded via QNetworkAccessManager are not corrupted? -

i have been looking answer question, not able find it. i using qnetworkaccessmanager download file web server , want make sure file gets downloaded without corruption. i once implemented checksum each file, can tedious , might unnecessary. assumed corruption happen qnetworkaccessmanager . prerequisite qnetworkreply object returned call qnetworkaccessmanager 's method get() has issued finished signal. how can make sure files downloaded web server via qnetworkaccessmanager won't corrupted? tcp/ip doesn't guarantee error-free transmission of data, if got file of correct size qnetworkaccessmanager , file still can corrupted. need use hash detects errors better tcp/ip can. has nothing qnetworkaccessmanager itself, web browser suffers same problem: you'll corrupted download if otherwise seems peachy.

java - How to not show empty lists in JAXB XML marshalling? -

hi using jaxb (java) marshal xml. i have xmllist elements size zero. since constructs actual array list when getter called, the output displays empty elements like <aa></aa> is there anyway eliminate these "empty" elements? thanks. public void representingnullandemptycollections() throws exception { jaxbcontext jc = jaxbcontext.newinstance(root.class); root root = new root(); root.nullcollection = null; root.emptycollection = new arraylist<string>();// shows empty element root.populatedcollection = new arraylist<string>(); root.populatedcollection.add("foo"); root.populatedcollection.add("bar"); marshaller marshaller = jc.createmarshaller(); marshaller.setproperty(marshaller.jaxb_formatted_output, true); marshaller.marshal(root, system.out); }

c# - Add items to wpf DataGrid in design mode -

i have kind of complex type (with nested class) namespace restore { public class item { public string title { get; set; } public imagesource image { get; set; } } public class itemsummary { public imagesource status { get; set; } public item item { get; set; } public string description { get; set; } } } and xaml <window x:class="restore.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:restore" <window.resources> <bitmapimage x:key="error" urisource="../../images/error.png" /> </window.resources> <datagrid> <datagrid.columns> <datagridtemplatecolumn header="status" width="45" > <datagridtemplatecolumn.ce