Posts

Showing posts from April, 2015

ruby - Puma configuration file precedence -

i'd take advantage of puma's automatic loading of environment-specific config (i.e. config/puma/<environment>.rb ) i'd have common (to environments) config well. @ moment i'm using undocumented _load_from puma dsl pull in config/puma.rb config/puma/<environment>.rb wonder if there's better way it. has else tackled problem , approach did take? future mike here year more of ruby experience. looking @ configuration#load method, there doesn't seem straightforward of accomplishing this. choose environment-based config file if 1 exists, falling on global config file. evanphx added public dsl#load dsl in february you're trying _load_from, might best route.

jquery - Image fails to load (sometimes!) -

i'm building site using boostrap , jquery the site works fine, there 1 image fails load, in rather weird fashion. html defines it: <img src="resources/publicidade/pub.png" width="100%"/> however, when site loads, loads this: <img src="resources/publicidade/pub.png" width="0" height="0" style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 100px 1px;"> the image loads when happen 1px x 1px, image 1346px x 501px. if put source path image on web address, loads fine. when return webpage, problem disappears! looking @ server log (i'm using python3 -m http.server) find when error occurs, line /resources/publicidade/pub.png http/1.1" 200 not there. there no error message either. when "load image , return" trick, message there, expected. i'm using github pages , problem occurs there well. unfortunately can't post link...

javascript - Can HTMLbars be used without Ember.js? -

i've been looking while now, , every time htmlbars mentioned ember involved. problem want migrate handlebars htmlbars, project has custom framework. if htmlbars make content returned html elements, rather string, why ember exclusive, , has found way work around exclusivity. yes, can used without ember.js, can analyze code in demos or can dig tests in htmlbars repository . the interesting fragment of code is: var template = compiler.template(templatespec); var env = { dom: new domhelper(), hooks: hooks, helpers: {} }; var scope = hooks.createfreshscope(); hooks.bindself(env, scope, data); var dom = render(template, env, scope, { contextualelement: output }).fragment; output.innerhtml += '<hr><pre><code>' + json.stringify(data) + '</code></pre><hr>'; output.appendchild(dom);

ios - Detect when a presented view controller is dismissed -

let's say, have instance of view controller class called vc2. in vc2, there "cancel" button dismiss itself. can't detect or receive callback when "cancel" button got trigger. vc2 black box. a view controller (called vc1) present vc2 using presentviewcontroller:animated:completion: method. what options vc1 have detect when vc2 dismissed? edit: comment of @rory mckinnel , answer of @nicolasmiari, tried following: in vc2: -(void)cancelbutton:(id)sender { [self dismissviewcontrolleranimated:yes completion:^{ }]; // [super dismissviewcontrolleranimated:yes completion:^{ // // }]; } in vc1: //-(void)dismissviewcontrolleranimated:(bool)flag completion:(void (^)(void))completion - (void)dismissviewcontrolleranimated:(bool)flag completion:(void (^ _nullable)(void))completion { nslog(@"%s ", __pretty_function__); [super dismissviewcontrolleranimated:flag completion:completion]; ...

issues with nls in R -

Image
i'm trying solve two-component decay model in r using nls function, running errors. equation is: where t time, ctot c1+c2, , p1 , p2 known proportions of ctot. my data (dd) is: > head(dd,n=15) t ctot 1 0.00 6.62 2 0.33 6.45 3 0.50 6.38 4 0.67 6.44 5 0.83 6.38 6 1.00 6.39 7 1.17 6.35 8 1.33 6.33 9 1.50 6.33 10 1.67 6.28 11 1.83 6.17 12 2.00 6.11 13 2.17 6.07 14 2.33 5.89 15 2.50 5.86 using nls have tried: p1 <- 0.3 p2 <- 0.7 z <- nls(ctot~(p1*c1*(exp(-k1*t)))+(p2*c2*(exp(-k2*t))), data=dd, start=list(c1=6, c2=0.1, k1=0.01, k2=0.01)) however getting: z <- nls(ctot~(p1*c1*(exp(-k1*t)))+(p2*c2*(exp(-k2*t))), data=dd, start=list(c1=6, c2=0.1, k1=0.01, k2=0.01)) error in numericderiv(form[[3l]], names(ind), env) : missing value or infinity produced when evaluating model i grateful if has suggestions! the data seems limited , incomplete since head. if make data testing methods ... , leave out confusing p1 , p2: t=s...

nosql - Maximum parallel queries in Cassandra -

i'm new in cassandra db, , have trivial question: how parallel queries can o without compromising perfomance? queries going select data table id='asdasdasd'; its server in datacenter, should work 3000 read querys? sorry poor information have. it depends on server's capacity have installed cluster of cassandra, , how have configured nodes. there configuration parameter in cassandra.yaml concurrent_reads tune better read rate.

Android dev: Sync database -

this first time writing android app utilizes database. i have created test database in assets folder. have app copy database database folder: /data/data/myapplication1/databases/mydb.db i realize assets folders read only, how can sync database can verify, using sqlite browser, changes have made? should move test db assets different location? there better? or there way can view db in databases folder? (which believe protected not visible other programs) to view database databases folder: with adb on either rooted device or emulator, adb pull /data/data/myapplication/databases/mydb.db . with adb on non-rooted/non-emulator, can try adb shell "run-as [package.name.myapplication] cp /data/data/myapplication/databases/mydb.db /sdcard/mydb.db" , , adb pull /sdcard/mydb.db . if integrate stetho in app, can inspect sqlite databases chrome.

linux - how to use exec() without any parameter? -

i wanna run "ls" command exec(), , code exec("/bin/ls", null) got text shows "a null argv[0] passed through exec system call." if add "all" parameter woks. exec("/bin/ls","all",null) however, when use exec("/bin/ps", null), works properly. me figure out whats wrong program? btw: use execl() #include <iostream> #include <unistd.h> //required fork() #include <sys/types.h> //required wait() #include <sys/wait.h> //required wait() using namespace std; int main(){ string cmd=""; string cmdpath="/bin/"; cout<<endl<<getcwd(null,0)<<" >> "; cin>>cmd; cout<<endl; string cmdcmdpath = cmdpath+cmd; const char* charcmd = cmdcmdpath.c_str(); int x = fork(); if(x!=0){ cout<<"the command "<...

vb.net - Restrict file size using -

i have create sub routine using vb.net compress files "file.zip" file, problem "file.zip" must have maximum size of 2 mb. don't know how it, if it's possible. nice if has example show me. it not possible in general case. example if have 2gb movie file, no lossless compression algorithm ever 2mb. one solution "chunk" zip file. is, divide parts individually no more 2mb. 7-zip has support this. can use .net api vb.net. i'm not sure whether api provides direct support chunking. if not, can start 7-zip program using process.start() .

PHP recursive function not returning expected -

i have following code: use app\models\kategorije; function hasmoreparent($id,$i = 0){ $model = new kategorije(); $parent_id = $model::find()->where('id = :id',[':id' => $id])->one()->parent_id; if ($parent_id > 1) { $i++; hasmoreparent($parent_id,$i); } return $i; } and, if $i greater 0 returns 1 instead of 2 or 3.. how can make return other numbers? you missing return keyword in order achieve recursion, otherwise function hasmoreparent executed, flow continue , reach return $i; statement. use app\models\kategorije; function hasmoreparent($id, $i = 0) { $model = new kategorije(); $parent_id = $model::find()->where('id = :id', [':id' = > $id])->one()->parent_id; if ($parent_id > 1) { $i++; return hasmoreparent($parent_id, $i); } return $i; }

Instagram API fetch all images by tag -

playing instagram tags api have faced trouble. trouble instagram api doesn't send me photos has. example use application (with pagination , count parameter of course) or http://iconosquare.com/tag/ site, returns 25 photos tag. android instagram application returns 26 ones! , it's 26 photos tag there - instagram api doesn't send me information 26th photo. what's i'm doing wrong? photo has hash-tag , can see right own eyes. count parameter set 30. another question why api returns me wrong photo count when i'm taking info tag? ex. previous tag returnes number 45 photos count whether added or removed tag photo.

MS SQL Server - how to ignore/ discard very rare duplicate rows during table insert -

i discovered error in client api. sends pages of unique records based on timestamps. every often, send same exact record on end of previous page, , start of next page. i operating under assumption there no duplicates (this event log after all). therefore doing pure inserts, instead of going through trouble of update or sort of 'on duplicate' step. my question --- what's best way rid of these duplicates, , have ms sql quietly discard these duplicate records upon insert? inserted after original has been written in transaction. these duplicates happen once every 10,000 rows -- memory light great. the distinct part of records "etl batch id" - else identical. otherwise each record supposed have unique "event id". if make event id unique index/ key, can somehow force ms sql dump duplicate keys? or application throw error message , stop during query? there infamous ignore_dup_key index option answers question. if try avoid using because chan...

python - TfidfVectorizer and sublinear_tf scaling for feature extraction in Azure ML -

i working on ml document classification problem. know how n-gram tfidf feature extraction , sublinear_tf scaling in azure ml. in past did insci-kit learn using tfidfvectorizer (see example below) problem in azureml cannot explicitly define own methods or classes using python module , rather not upload zipped code. i python person open using r if there equivalent. there r sample in marketplace dependent on unigrams. tfidfvectorizer(max_df=.67,min_df=.015,lowercase=false ,sublinear_tf=true,norm='l2',tokenizer=abstracttokenizer()) best, -ari welcome using azureml. for problem of defining own methods, azureml visual flow-based programming tools ml modeling. it's different programming @ localhost. can define modules different dataset process, , link them draging , droping line linked between 2 modules. there list of existing modules on ml stduio, refer https://msdn.microsoft.com/en-us/library/azure/dn906033.aspx . need combine them make own ml model. fo...

asp.net - Getting value from selected row in gridview -

i'm novice vb programmer trying retrieve value of selected row in gridview. haven't been able of yet. i've searched forums, none of answers have worked me. here html portion of code: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" cellpadding="4" forecolor="#333333" gridlines="none" width="1032px" enablemodelvalidation="true"> <alternatingrowstyle backcolor="white" forecolor="#284775" /> <columns> <asp:templatefield headertext="date" > <itemtemplate> <asp:linkbutton id="linkbutton1" runat="server" causesvalidation="false" onclick ="linkbutton1_click" commandname="drilltp" text='<%#eval("transit_date")%>'> </asp:linkbutton>...

scala - How is the performance impact of select statements on Spark DataFrames? -

using many select statements or expressions on spark dataframes, wonder performance impact on subsequent transformations once triggered action. given dataframe df 10 columns j. how influence if use as column renaming on each column? df.select( df("a").as("1"), ..., df("j").as("10")) what if select subset (e.g. 5 columns) val df2 = df.select( df("a"), ..., df("e") ) b. how handles spark projection? df still kept (as df2 projection) df serve kind of reference? or instead df2 created freshly , df discarded? (neglecting persist here) how influence of general column expressions used in select ? are performance tests above cases available? , performance measurements in general somewhere available? if not, how measure performance best?

javascript - Make knob load after AJAX success -

i knob animated right after ajax call done. number, knob should progress without refresh. want is: ajax request succesfull -> sends number knob function -> knob fill up. code: .. success: function(data) { knobload(data); } .. function knobload(data) { $('.knob').each(function () { var $this = $(this); $this.knob({ }); $({ value: 0 }).animate({ value: data }, { duration: 2000, easing: 'swing', step: function () { $this.val(math.ceil(this.value)).trigger('change'); } }) }); } </script> <input class="knob animated" value="0" readonly data-width="80%"> ended adding knob inside file ajax requests, , display afterwards. $.ajax({ url: 'ajax.php', data: { id: id }, ...

android - Using FragmentManager to show dialog -

in big nerd ranch's android programming, says: when using alertdialog, idea wrap in instance of dialogfragment, subclass of fragment. possible display alertdialog without dialogfragment, not recommended. having dialog managed fragmentmanager gives more options presenting dialog. what sort of options using fragmentmanager give you?

mysql - Yum updating Percona from 5.6.25-rel73.1 to 5.6.26-rel74.0 results in an unstartable server -

running under centos 6.7 yum updating percona server leaves in unstartable state. this log /var/log/mysqld.log 150929 14:54:17 mysqld_safe starting mysqld daemon databases /srv/mysql 2015-09-29 14:54:18 0 [warning] timestamp implicit default value deprecated. please use --explicit_defaults_for_timestamp server option (see documentation more details). 2015-09-29 14:54:18 0 [note] /usr/sbin/mysqld (mysqld 5.6.26-74.0) starting process 17130 ... 2015-09-29 14:54:18 17130 [note] plugin 'federated' disabled. 2015-09-29 14:54:18 17130 [note] innodb: using atomics ref count buffer pool pages 2015-09-29 14:54:18 17130 [note] innodb: innodb memory heap disabled 2015-09-29 14:54:18 17130 [note] innodb: mutexes , rw_locks use gcc atomic builtins 2015-09-29 14:54:18 17130 [note] innodb: memory barrier not used 2015-09-29 14:54:18 17130 [note] innodb: compressed tables use zlib 1.2.3 2015-09-29 14:54:18 17130 [note] innodb: using linux native aio 2015-09-29 14:54:18 17130 [note] inn...

How to encode and send float data to GLSL from Javascript/THREE.js and decode results -

i encode object positions (x,y,z) , send glsl shader, decode data, perform calculations , send results cpu. have researched issue , have found partial answers decode rgb value single float without bit-shift in glsl , have not been successful in encoding , decoding results. here part of code.`... function init() { ... buffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, buffer); gl.bufferdata( gl.array_buffer, new float32array([ -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0 ]), gl.static_draw ); texture = gl.createtexture(); gl.bindtexture(gl.texture_2d, texture); vec1 = new three.vector3(2.6, 3.3, 100.80); //example position vector data = new uint8array([float2color(vec1.x).r, float2color(vec1.x).g, float2color(vec1.x).b, 255, //x float2color(vec1.y).r, float2color(vec1.y).g, float2color(vec1.y).b, 255, //y float2color(vec1.z).r, float2color(vec1.z).g, float2color(vec1.z).b, 255 /...

javascript - Using select all script for filtered table -

i using this ( file here ) script , using check script in first row checkboxes. first when filtered column, script selected checkboxes @ hidden rows, too. $(document).ready(function(){ $('#select_all').on('click',function(){ if(this.checked){ $('.checkbox').each(function(){ this.checked = true; }); }else{ $('.checkbox').each(function(){ this.checked = false; }); } }); $('.checkbox').on('click',function(){ if($('.checkbox:checked').length == $('.checkbox').length){ $('#select_all').prop('checked',true); }else{ $('#select_all').prop('checked',false); } }); }); thanks helps. use jquery :visible selector leave out checkboxes have been filtered. https://api.jquery.com/visible-selector/ $('#select_all').on('click',function(){ var docheck = this.checked; $...

responsive design - How to specify Bootstrap grid -

i have customized bootstrap setup use 960 grid instead of default width. have html using bootstrap grid: <div class="container"> <div class="row"> <div class="col-md-3"></div> <div class="col-md-6"></div> <div class="col-md-3"></div> </div> </div> however on specific page need exact in width, instance need first row 280 pixels, second 500 pixels , third 160 pixels. how can using bootstrap grid still responsive mobile devices?

How to compare elements of array in mips assembly? -

i know how iterate through array in mips. can't seem figure out how compare 2 elements in same array? can point me in right direction here? if(array[i] > array[i - 3]) i believe branch if greater comparing 2 registers how data 2 registers? thanks! you cant iterate array... have add multiple of 4 (=> index * 4) memory address of array. can load value @ modified memory addres , compair diffrent moddified addres... .data array: .word 1,2,3 #index's want compair i1: .word 0 i2: .word 1 .text main: lw $a0 i1 lw $a1 i2 li $t5 4 #load multiplier mul $a0 $a0 $t5 mul $a1 $a1 $t5 la $t0 array la $t1 array add $t0 $t0 $a0 add $t1 $t1 $a1 lw $t0 ($t0) lw $t1 ($t1) beq $t0 $t1 true

visual studio 2013 - How to remove Web Essentials from Chrome after disabling browser link -

Image
i have set "enable browser link menu" false web essentials options in visual studio, however, still see error message in chrome console. [09:21:58 gmt+1000 (aus eastern standard time)] browser link: exception thrown when trying invoke browser link extension callback "madskristensen.editorextensions.browserlink.unusedcss.unusedcssextensionfactory.getignorelist": system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.nullreferenceexception: object reference not set instance of object. @ madskristensen.editorextensions.browserlink.unusedcss.unusedcssextension.getignorelist() --- end of inner exception stack trace --- @ system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolean constructor) @ system.reflection.runtimemethodinfo.unsafeinvokeinternal(object obj, object[] parameters, object[] arguments) @ system.reflection.runtimemethodinfo.invoke(object obj, bi...

uitableview - Reload table view but don't move the viewport iOS -

i have table view updated based on results api. table view has large custom cell takes half of screen. cells can ordered user custom button. in average have between 10-15 cells inside table , big issue when user clicks move bottom cell 1 point reloaddata refresh entire table , move view port top meaning user have scroll end again terrible user experience. there way refresh table view keeping position before reload or useful consider using custom scroll called after table populated. i'm writing application in swift, apis handled using alamofire, custom cell has separate xib file , table view inside view controller. save contentoffset restore after reloaddata let contentoffset = tableview.contentoffset tableview.reloaddata() tableview.contentoffset = contentoffset

c# - Null reference exception on PriorityQueue.RemoveItem -

a single instance of error occurred, , haven't been able reproduce it, , unfortunately logs don't offer helpful information. last operation on thread seemed finish fine, , unhandled exception pops up: system.nullreferenceexception: object reference not set instance of object. @ system.windows.threading.priorityqueue`1.removeitem(priorityitem`1 item) @ system.windows.threading.dispatcher.processqueue() @ system.windows.threading.dispatcher.wndprochook(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled) @ ms.win32.hwndwrapper.wndproc(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled) @ ms.win32.hwndsubclass.dispatchercallbackoperation(object o) @ system.windows.threading.exceptionwrapper.internalrealcall(delegate callback, object args, int32 numargs) @ ms.internal.threading.exceptionfilterhelper.trycatchwhen(object source, delegate method, object args, int32 numargs, delegate catchhandler) i tried internet searching priorit...

cordova - Sending url to ionic android app via webintents from another app -

looking updated solution, running latest ionic 1.1.0 release uses cordova 5.x. trying able browse website in chrome , send url ionic android app using web intent. app compiles , runs, when attempt use share feature chrome(or other app) , choose app share to, app crashes. i first attempted use plugin: ionic plugin add https://github.com/initsogar/cordova-webintent and removed plugin , tried more updated fork: ionic plugin add https://github.com/fluentstream/cordova-webintent in app.js file putting following code: .run(function($ionicplatform, $rootscope, $ionichistory, $state) { $ionicplatform.ready(function() { window.plugins.webintent.getextra(window.plugins.webintent.extra_text, function(url) { incomingurl = url; //alert(incomingurl); console.log(incomingurl); }, function() { incomingurl = false; //alert("no url"); console.log("no url"); }); }); }) i tried: .run(function($ionicplatform, $...

c++ - Receive recv data until end of stream (using HTTP)? -

i'm trying out c++ sockets first time, , i've hit first obstacle. i've send data google using send function ( get / http/1.1\r\n\r\n ), , i'm trying receive response. current code: char buffer[256]; std::string result = ""; int resultsize = 0; bool receive = true; while (receive) { resultsize = recv(datasocket, buffer, sizeof(buffer) - 1, 0); buffer[resultsize] = '\0'; // add null terminating character complete string result += buffer; (int = 0; < resultsize; i++) { if (buffer[i] == '\0') { receive = false; } } } return result; using buffer size of 256 demonstrate problem, if page contains more bytes i'm receiving in buffer, doesn't receive on first try. i've tried looping until data contains null terminator ( '\0' ), doesn't seem work. i've tried checking empty lines ( '\r\n' ), doesn't work since there empty line between headers , html conte...

python - Matching multiple words with FreqDist in nltk -

import nltk nltk.tokenize import word_tokenize txt = "finding common place isn't commonly available among commoners place" fd = nltk.freqdist() w in word_tokenize(a.lower()): fd[w] += 1 i have above script works fine. if fd['place'] 2, if type fd['common'] 1. is possible type similar fd['common*'] (which doesn't work) obtain 3 , possibly list of matches? 3 matches (common, commonly, commoners) i'm assuming has regex not sure how implement freqdist() if not, there other packages might that? freqdist kind of dictionary, , dictionary keys work exact match. to use regexps this, need hard way: iterate on entries , add counts words match. of course, needs scan whole list slow if list large, , need lot. if you're after matching prefixes, use data structure called "prefix tree" or "trie" . can guess does. simple work-around record counts in freqdist each prefix of each word see (so not c...

javascript - angularJS emptying input field on filter -

today faced situation angularjs. hi have recipe website, , list ingredients , theyr respective dosage i'm using angular's ng-repeat (here goes snippet). <div ng-repeat="food in foodlist | filter:query"> <label> {{food.name}} </label> <input type="text" class="form-control food-list-input" data-id="{{food.ingredientid}}" placeholder="weight in grams."> </div> the thing when apply filter, inputs inserted value, if hidden because of filter, return empty. is there anyway around this? i think want bind input using ng-model , example: <input type="text" ng-model="food.dosage" class="form-control food-list-input" data-id="{{food.ingredientid}}" placeholder="weight in grams."> that implement two-way binding model input tag, when ng-repeat re-runs, entered values re-bound model.

Android Listview Hides Titlebar -

i'm trying make app - has 3 activities. first 2 listviews in linear layouts, , each of them prevents title bar showing up. title bar mean section @ top of activity displays activity's name option setting. third activity not listview, , displays title bar normally, leads me think may problem listviews. the xml first page is: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".selectclass"> <listview android:id="@android:id/list" android:layout...

Appveyor clone a private repo -

how use appveyor clone private repo? for example, in repo a, need clone repo b. don't want send personal access token, instead wanted send secure token. tried using appveyor encrypt data tool, , clone repo. no luck. can me here? appveyor documentation can key. understand key tied account. if use account encrypt key , run appveyor (using account), not work. have use same account encryption , decryption.

VB.NET How to pass a data table from one form to another -

i using visual studio express 2013 , vb.net how pass data table 1 form another. regards you can pass data table 1 form variable. example, can declare public in form1 , refer form2 the form instance qualifier: form1.dtable . there several other ways handle this, such using class data table or declaring public in module.

javascript - UglifyJS Don't Mangle Specific Associative Array -

all our webservices passed our xhr via associative array. ie: new xhr({"year": 2015, "week": 6}, ...); all our scripts added single file, , uglified via (essentially mangle , compress except our entry point): uglifyjs --mangle toplevel --screw-ie8 --compress --mangle-regex="/(?s)^((?!$$).)*$/" --reserve-domprops --reserved-file reserved -- input the problem is, year , week field keep getting obfuscated. tried putting $$ infront, have $$year , $$week . work, added regex argument uglifyjs command above. trying negate lookup, mangle properties except $$ @ start (can set of characters, using $$ starting point). my questions: is best way it? there way in uglifyjs ignore associative arrays? is regex right? i've tried escaping 2 dollar signs, i've tried __ instead of $$ several other attempts (note: regex not good) if regex wrong, there somewhere detail method creating valid regex? edit: resolved. needed use this: uglifyjs...

android - Inflating Layout trouble -

i trying add view dynamically relative layout. view not multyling code using enclosing... for (int i=0;i<mthumbids.length-1;i++) { try { relativelayout containerlinearlayout = (relativelayout)findviewbyid(r.id.maincontainer); view child = getlayoutinflater().inflate(r.layout.single_row, null); containerlinearlayout.addview(child); }catch (exception e){ toast.maketext(getapplicationcontext(),"dkljf"+e.getmessage(),toast.length_short).show(); } } activitymain.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".mainactivity" android:orientation="vertical"> <button android:layout_width="wrap_content" android:layout_height="wrap_content" /> <button andr...

python - How to hide herokuapp.com site built in Django when the site is live -

let's have app in django (python environment) example.herokuapp.com and put site live example.com how achieve site not accessible via example.herokuapp.com i not want access way in case trying to. is there way? in order hide example.herokuapp.com from django live site example.com set allowed_hosts=['example.com'] for polishing website top detail, create beautiful custom 500.html template.

java - Unable to call Hibernate/QueryDSL from another maven subproject -

i have 2 maven sub-projects - jetty_runner1 , jetty_runner2 my directory structure looks following: ./jetty_runner1/pom.xml ./jetty_runner1/src/main/java/com/jetty_runner1/checkpersistence.java ./jetty_runner1/src/main/java/com/jetty_runner1/helloworldservlet.java ./jetty_runner1/src/main/java/com/jetty_runner1/misckeyvalue.java ./jetty_runner1/src/main/java/com/jetty_runner1/misckeyvaluemanager.java ./jetty_runner1/src/main/resources/meta-inf/persistence.xml ./jetty_runner1/src/main/webapp/web-inf/web.xml ./jetty_runner2/pom.xml ./jetty_runner2/src/main/java/com/jetty_runner2/checkpersistence.java ./jetty_runner2/src/main/java/com/jetty_runner2/helloworldservlet.java ./jetty_runner2/src/main/resources/meta-inf/persistence.xml ./jetty_runner2/src/main/webapp/web-inf/web.xml ./pom.xml checkpersistence.java, helloworldservlet.java, persistence.xml , web.xml same in 2 projects, except package names (i have created simplified example posting here. in actual application, 2 sub...

c# - How to create a dynamic SSRS Report -

i doing lab test web application project.in ,customer apply order list of lab test.once lab test completed , need create report test conducted. test different each other.i can create query desired result.but table columns dynamic , number of tables(different test have different table) dynamic. as far know , can create 1 static report format , bind data table it.or can create row group , colum group in matrix(i got links)and dynamically hide , visible column. my requirement bit different , can't make static. there way dynamic in ssrs or other tool ?. or have go old school need create report format(excel,pdf)in code(c#). please advice tips, links or article can solve issue. appreciated. as far understood requirement, need have different tables(in regards columns , style) different tests. for need add seperate tablix each test (assuming have limited number of tests) , need set filters , visibilty expression on each tables based on specific 'test name'. jus...

Marklogic Content Pump generate multiple documents through XSLT transform -

this second question related marklogic content pump utility. i ingesting single aggregated xml document multiple records marklogic content pump. expect the aggregate xml document transformed different format , content pump utility generate multiple xml document single input large xml document.? example: aggregated input xml document: <root> <data>bob</data> <data>vishal></data> </root> expected output content pump : 2 documents different format: document 1 : <data1>bob</data1> document 2 <data1>vishal</data1> i using following xslt split above document 2 nodes: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema" exclude-result-prefixes="xs" version="2.0"> <xsl:template match="root"> <xsl:apply-te...

html - Image not taking up container's height -

i have 3 elements: .main > .img-container >> img .main has definite height, .img-container has max height equal container, img should take containing div's height. the problem image not constrained container's height, shown in fiddle . please note image has limited container's height, not making vertically middle. thanks help. here current scss: .main { height: 200px; background-color: #eee; .img-container { background-color: #ddd; max-height: 100%; width: 80%; /* show main container */ img { height: 100%; } } } use height in .main .img-container class demo .main .img-container { background-color: #ddd; /*max-height: 100%;*/ height: 100%; width: 80%; }

python - How to use native Cpython extensions in Jython -

i have python script in which, used python packages, numpy,scipy etc. when trying run script using jython, gives exception("import error"). my python code is: import numpy np #import pandas pd #import statsmodels.api sm #import matplotlib.pyplot plt #from patsy import dmatrices #from sklearn.linear_model import logisticregression sklearn.ensemble import randomforestclassifier import pandas import pickle #from numpy import genfromtxt, savetxt import csv trainingdata="/home/gauge/documents/trainingdata1/training4.csv" testfile = "/home/gauge/documents/trainingdata1/testcase1.csv" predictionoutput="/home/gauge/documents/trainingdata1/result4.csv" def make_x_and_y(filepath): x_y = [] open(filepath, 'rt') f: reader = csv.reader(f) idx,row in enumerate(reader): if idx<0: continue x_y.append([row[2],row[3],row[4],row[5],row[6],row[7],row[8]]) #x_y.append([row[2],row[3],r...

regex - IGNORECASE errors in Python's re.Scanner? -

there hidden known functionality in re module import re def s_ident(scanner, token): return token def s_operator(scanner, token): return "op%s" % token def s_float(scanner, token): return float(token) def s_int(scanner, token): return int(token) scanner = re.scanner([ (r"[a-za-z]\w*", s_ident), (r"\d+\.\d*", s_float), (r"\d+", s_int), (r"=|\+|-|\*|/", s_operator), (r"\s+", none), ]) print scanner.scan("sum = 3*foo + 312.50 + bar") # (['sum', 'op=', 3, 'op*', 'foo', 'op+', 312.5, 'op+', 'bar'], '') i want use ignorecase flag here seems not work: import re def s_ident(scanner, token): return token def s_operator(scanner, token): return "op%s" % token def s_float(scanner, token): return float(token) def s_int(scanner, token): return int(token) scanner = re.scanner([ (r"(?i)[a-z]\w*", s_ident), ...

javascript - Selection across pages in EXT JS 3.x -

we using ext-js 3.x. select records pages, used method selectrecords(). now, can select records when navigate pages. problem is, on clicking submit button selected records across pages should visible. below line of code grid.getselectionmodel().getselections() returns selected records in current page. whether there options available selected records? don't know if can great you, can suggest use new column in store indicate if row selected or not. column boolean. can set value listeners rowselect , rowdeselect. on submit able query store records correct indicator value. for example: var mystore = new ext.data.jsonstore({ fields: [{name:"col1", type:"string"}, {name:"indicator", type:"'boolean'"}] }); var mygrid = new ext.grid.gridpanel({ store: store, columns: [...//don't put indicator here sm: new ext.grid.rowselectionmodel({singleselect: false}), .... listeners: { ...

c++ - Where can I find API Documentation containing headers classes and methods in MFC VC++? -

i want find java api documentation mfc c++ classes. can clear information on headers associated,data members , methods mfc library. msdn doesn't helpful since doesn't contain information on header need in linked. can me on this. it says header under requirements if scroll down bit, example: https://msdn.microsoft.com/en-us/library/za93adby.aspx posting answer can accept , people can spend time on other questions.

java - Localhost Development with Server has a weak ephemeral Diffie-Hellman public key error -

since 2 days error when connecting via https local application running on localhost : server has weak ephemeral diffie-hellman public key i use latest mac osx , latest google chrome. application runs on tomcat. how can create new self-signed certificate accepted google? want continue develop! hack welcome.

java - How to create an array of objects of a specific class type -

i have function returns object. object can contain array of primatives or array of objects. in c# can create empty array of objects or primatives using code like: array values = array.createinstance(/*type*/type, /*int*/length); is there equivalent in java? how create array of objects of specific class type test[] tests = new test[length] ; and if want have mix of primitives , objects, though not suggestable, if want mix primitives objects object[] objs = new object[length]; that allows both primitives( in form of wrappers ) , normal objects together. if have class called test of own, can create array of test's note until initialise elements in array, have null value.

jquery - How to submit a same form with different url? -

in click of button form submit , success data contains next_url. goal submit same form next_url. possible.? sorry if question asked give me url. my script code: $(document).ready(function(){ $('form').submit(function(event){ event.preventdefault(); $.ajax({ type: 'post', url: '/', async: false, data: $("#form_to_submit").serialize(), success: function(data){ console.log(data); $('form').attr('action', data.next_url); $('form').unbind('submit').submit(); } }) return false; }) }) and sample django view here. def home(request): data_dict = {} if request.method == 'post': form_data = request.post['data'] data_dict['form_data'] = form_data data_dict['next_url'] = reverse('frontend:first_term') return jsonresponse(data_dict) return render(request, 'i...

java - Unable to connect MySQL using R -

Image
i'm learning r language. want establish connection mysql using r . i've studied how here , here , tutorial , many other websites. i've followed steps connect mysql, still i'm unable connect mysql, , getting error: error in .local(drv, ...) : failed connect database: error: can't connect mysql server on 'localhost' (0) here screenshot of did: i'm using r version-3.2.2 , mysql version-5.6 , mysql database running on localhost:1527 . please me remove error , tell me i'm doing wrong. info: i'm able connect above mysql database java . you mysql running on localhost:1527 - don't specify port in dbconnect , uses default port, 3306 , should not able connect... add port argument dbconnect dbconnect(mysql(), user="user", password="password", dbname="dbname", host="localhost", port="1527")

reserve some ids for the particular rows in php mysql -

is possible reserve ids upto rows. let have add stores using 3 api,om,vcomm,icube when add 3 stores randomly using php,it go second database as ---------------------------- id | apiname | ----------------------------- 1-500 | icube | 501-1000 | om 1001 - 2000 | vcomm ----------------------------------------- as in above database when clicked on store of icube api placed within id of 1 500,when click on store of om placed within id of 500-1000 , when click on vcommm placed 1001-2000,not 1 one. can please me? this should work insert tablename (id,apiname) values ((select max(id)+1 tablename t t.apiname='icube'),'icube'); or insert tablename (id,apiname) values ((select max(id)+1 tablename t t.apiname='om'),'om');

c# - How to get notice when ListView Items present? -

i have listview , listbox . listview shows data, binding list. , listbox used menu. when click item in menu, change binded source list, listview shows updated content. want visible items in listview through way: var scrollviewer = getvisualchild<scrollviewer>(mylistviewcontrol); if (scrollviewer != null) { console.writeline("visible item start index:{0}", scrollviewer.verticaloffset); console.writeline("visible item count:{0}", scrollviewer.viewportheight); } so subscribe events. example, valuechanged , sizechanged event of scrollbar , selectionchanged event of listbox , binded list property inotifypropertychanged interface. but previous view's scrollviewer.verticaloffset after listbox selectionchanged event raise every time.i think when recieve event notification, listview has not present view. so, question is, how updated view's scrollviewer.verticaloffset , scrollviewer.viewportheight instead of previous view...

c# - I am getting error code 10061 when I try to check the availability of Port -

i trying find port availability of below c# code, , getting exception "error code 10061: connection refused " need in solving issue. ports open shown closed facing porblem class program { private string _hosturi; private static bool m_blniswinauth = false; static void main(string[] args) { hostname tcp; bool udp = false; program pr = new program(); tcp = pr.getportavability("127.0.0.1", 80, true); console.writeline(tcp); console.readline(); } public hostname getportavability(string _hosturi, int _portnumber, bool istcp) { hostname returnvalue = new hostname(); returnvalue.hostname = _hosturi; returnvalue.result = false; ipaddress ipa = (ipaddress)dns.gethostaddresses(_hosturi)[0]; try { socket sock; if (istcp) sock = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); ...

php - Deactivate users using JIRA SOAP API -

i trying deactivate users in jira using php script , jira soap api . i googled , got deleteuser() method deleting users unable find how make user inactive instead of deleting user. is there way deactivate user using soap api? please find code below deletes user: <?php set_time_limit(0); session_start(); $soapclient = new soapclient("http://jira.abc.com/jira/rpc/soap/jirasoapservice-v2?wsdl"); $token = $soapclient->login('abc', 'abc') or die('username/password not correct!'); $result = $soapclient->deleteuser($token, 'testuser'); thanks in advance...

Readig XML file from Perl -

i have xml file contains "squishreport". want special value of nodes under condition. so, have written code in perl main function follows: sub filecount { chdir( $dir ) or die "couldn't go inside $dir directory, $!"; opendir(my $dh, $dir) or die "$0: $dir: $!\n"; while (my $file = readdir($dh)) { # want files next unless (-f "$dir/$file"); # use regular expression find files ending in .xml next unless ($file =~ m/$suff$/); $xml = xml::libxml->load_xml(location => $file); # iterate entries $test ($xml->findnodes('/squishreport/test/test')) { $name_test = $test->findvalue('@name'); # trim value s/\a\s*//, s/\s*\z// $value_test = $test->textcontent; print "test name = $name_test \n"; $result ($test->findnodes('/verification/result')) { $type_result = $result->findvalue('@type'); ...