Posts

Showing posts from January, 2010

python - find 2d elements in a 3d array which are similar to 2d elements in another 3d array -

i have 2 3d arrays , want identify 2d elements in 1 array, have 1 or more similar counterparts in other array. this works in python 3: import numpy np import random np.random.seed(123) = np.round(np.random.rand(25000,2,2),2) b = np.round(np.random.rand(25000,2,2),2) a_index = np.zeros(a.shape[0]) in range(a.shape[0]): b in range(b.shape[0]): if np.allclose(a[a,:,:].reshape(-1, a.shape[1]), b[b,:,:].reshape(-1, b.shape[1]), rtol=1e-04, atol=1e-06): a_index[a] = 1 break np.nonzero(a_index)[0] but of course approach awfully slow. please tell me, there more efficient way (and is). thx. you trying all-nearest-neighbor type query. has special o(n log n) algorithms, i'm not aware of python implementation. can use regular nearest-neighbor o(n log n) bit slower. example scipy.spatial.kdtree or ckdtree . import numpy np import random np.random.seed(123) = np.round(np.random.rand(25000,2,2),2) b = np.round

java - How get the some numbers from the string -

i have string "9x1x121: 1001, 1yxy2121: 2001, role: zzzzz" , need numbers input string. string input = "9x1x121: 1001, 1yxy2121: 2001, role: zzzzz"; string[] part = input.split("(?<=\\d)(?=\\d)"); system.out.println(part[0]); system.out.println(part[1]); i need output below numbers only 1001 2001 you split on ',' split splitted string on ': ' , check if part[1] number or not (to avoid cases role). string input = "9x1x121: 1001, 1yxy2121: 2001, role: zzzzz"; string[] allparts = input.split(", "); (string part : allparts) { string[] parts = part.split(": "); /* parts[1] need if it's number */ }

php - Regular expression: Get TeX commands -

i have string like: $str = "\textaolig 3 \texthtbardotlessjvar \textrthooklong b \textbenttailyogh ; \textinvomega q \textscaolig . \textbktailgamma p \textinvsca r \textscdelta d \textctinvglotstop ! \textinvscripta s \textscf 2 \textctjvar \textlfishhookrlig t \textsck"; and wanna tex commands (\textaolig etc.) regular expression. tried: \\([[a-z]\s]+) but no luck. can me out? kind regards, first of all, have enclose string single quotes because when using double quotes if use backslash try escape character, isn't case. secondly, have use \\\\ match backslash. i don't know tex commands, i've tried match [\w\s\.;]+ correct if needed: $str = '\textaolig 3 \texthtbardotlessjvar \textrthooklong b \textbenttailyogh ; \textinvomega q \textscaolig . \textbktailgamma p \textinvsca r \textscdelta d \textctinvglotstop ! \textinvscripta s \textscf 2 \textctjvar \textlfishhookrlig t \textsck'; preg_

if statement - Check if 2 string are differents java -

i have problem if condition, have code : if(!session.getattribute("login").equals(d3.getlogin_demandeur())){ //do }else{ //do else } so code if session.getattribute("login") equals d3.getlogin_demandeur() should go else statement, doesn't work, have printed out these 2 values , same , still go else statement, idea ? edit : here how print system.out.println(session.getattribute("login")+"="+(d3.getlogin_demandeur())); and have : smilleto=smilleto you can use trim() function remove unwanted spaces , use equalsignorecase() if don't have case sensitivity criteria. string login = (string)session.getattribute("login").trim(); string logindemandeur = d3.getlogin_demandeur().trim(); // assuming getlogin_demandeur has return type string. if(!login.equalsignorecase(logindemandeur)){ //do }else{ //do else }

ruby on rails - Why puma staging environment does not start? -

when try start web-server in staging environment not run. in production environment same configuration - ok. where can error? my config puma is: deploy_to = env['current_path'] workers integer(env['puma_workers'] || 3) threads integer(env['min_threads'] || 16), integer(env['max_threads'] || 16) daemonize true preload_app! backlog = integer(env['puma_backlog'] || 20) directory "#{deploy_to}/current" pidfile "#{deploy_to}/shared/tmp/pids/puma.pid" state_path "#{deploy_to}/shared/tmp/sockets/puma.state" stdout_redirect "#{deploy_to}/shared/log/puma.stdout.log", "#{deploy_to}/shared/log/puma.stderr.log" bind "unix://#{deploy_to}/shared/tmp/sockets/kiosk.sock" activate_control_app "unix://#{deploy_to}/shared/tmp/sockets/pumactl.sock" on_worker_boot # worker specific setup activesupport.on_load(:active_record) config = acti

html - Bootstrap Scrolling Nav: fix sections height and active menu highlight -

when click <a> link in navigation anchor point looks wrong, because can't see section headline. <h2> in case. is possible highlight <a> link? border or smething this... this html code: <!-- fixed navbar --> <nav id="navbar" class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div id="navbar" class="navbar-collapse collapse&

bayesian - How to test the convergence in bugs model? -

Image
i want explain convergence in bugs model command plot(). example of output in follow figure i don't sure can read output well, :) unfortunately, not if can confirm convergence figure showing ( edit : there @ least information, see below). left hand side of figure caterpillar plot, shows 95% intervals of distribution each parameter. assessing convergence more nuanced process, there multiple ways decide if model has converged. want determine model has appropriately explored parameter space each parameter (through trace plots, traceplot function in coda library), between , within chain variance (the gelman-rubin diagnostic, gelman.diag in coda library), , auto-correlation in chains ( autocorr.plot in coda ). there variety of other measures others have suggested assess if model has converged, , looking through rest of coda package illustrate this. i highly suggest go through winbugs tutorial in user manual (link pdf), has section addresses checking model co

Azure AD authentication in published WebAPI not working -

i trying add azure active directory authentication asp.net webapi. followed this tutorial , have configured tenant , applications in azure correctly. now if test locally sample desktop client , authentication works , can see authenticated user's claims. user.identity.isauthenticated = true however, if publish api azure (as web app), authentication not seem working anymore, exact same code used test api locally... have change endpoint api: <add key="apibaseaddress" value="http://localhost:20105/" /> vs <add key="apibaseaddress" value="https://***.azurewebsites.net/" /> note jwt token passed api same when testing api locally , published, authenticating same azure ad , same user accound. what source of problem? azure uses https , running on http locally? if so, try fix issue? this might due process follow publishing api. if publishing visual studio , using "organizational" settings, publish

android - How to know which SMS port? -

i getting sms in android application, have no idea how know port sent on. broadcastreceiver receiving sms messages, please tell me how know sms's port? <data android:port="????" /> what number should there? best regards, ekaterina ports relevant data sms, , port-addressed messages handled data sms in android. regular text message won't have port associated it. if want receive port-addressed messages, you'll need receiver configured data sms. receiver needs filter "android.intent.action.data_sms_received" action, rather "android.provider.telephony.sms_received" action regular text messages. data scheme "sms" , , data port can specific port number, or wildcard "*" listen on ports. example: <receiver android:name=".datasmsreceiver"> <intent-filter> <action android:name="android.intent.action.data_sms_received" /> <data android:scheme

vhdl - D flip flop with a feedback loop to clear -

Image
here code d flip flop active low asynchronous clear , reset. clear has input combination of q (output of d ff) , reset signal.i have uploaded image show circuit have written program. not expected output; clear , q low. have set reset logic 1 in simulation. please , let me know mistake :) thank you. library ieee ; use ieee.std_logic_1164.all ; use ieee.numeric_std.all; entity d_feedback_clr port ( clock, reset, d: in std_logic ; q : out std_logic ) ; end d_feedback_clr ; architecture behavior of d_feedback_clr signal state, clear: std_logic:='0'; -- state implies output of d register begin clear <= reset nand state; process (clock, clear, reset) begin if (clear='0') state <= '0'; elsif reset='0' state <= '1'; elsif (clock'event , clock='1') state <= d;

javascript - how to wait check ajax request has completed before other element? -

i have following code, each image makes ajax call. problem when make ajax call first image,at time without waiting respose invokes second.so hasn't effect of first call,means missed first call effect. similary without waiting second inovking third,... so how wait in above each function until response come? jquery('.xxx img[src*="mainimage"]').each(function () { vobj = $(this); var inmainurl = 'https://xxx.kki/api/oembed.json?url=' + $(this).attr('src'); $.ajax({ url: inmainurl, datatype: 'json', success: function (result) { $(vobj).attr('src',result.thumbnail_url); } }); }); you should use recursive function these purposes. basic example ( jsfiddle ): var mymethod = function(index){ var total_images = $('img').length; if( index == total_images ) return; // job finished var current_image = i

What does readahead in mongodb stands for? -

i getting warning on mongodb, warning: readahead /data set 1024kb suggest setting 256kb (512 sectors) or less http://dochub.mongodb.org/core/readahead when querying this, every link suggests setting readahead value less figure , how set it? i know setting lesser value let me rid of warning, more interested in readahead stands for? repercussions if set higher value? read-ahead kernel feature, works @ block device level , global (is not process-dependend). technique employed in attempt improve file reading performance. if kernel has reason believe particular file being read sequentially, attempt read blocks file memory before application requests them. when readahead works, speeds system's throughput, since reading application not have wait requests. when readahead fails, instead, generates useless i/o , occupies memory pages needed other purpose. ( https://lwn.net/articles/155510/ ) here's more in depth explanation -> http://man7.org/linux/man-pages/man

java - Hibernate seems to see private fields of entity -

we know that, private members not inherited in java, or more specifically, private member variables not visible in child class. so, if have super class follows : public class { private int a; public int b; } and there other class b, extends follows: public class b extends a{} now have following code snippet: class b = new b(); system.out.println(b.a); // not possible since 'a' declared privtate system.out.println(b.a); // possible now, have following code using in hibernate tutorial. (example involves table_per_class strategy.) here code, public class vehicle { @id private int vehicleid; private string vehiclename; public string getvehiclename() { return vehiclename; } public void setvehiclename(string vehiclename) { this.vehiclename = vehiclename; } public vehicle() { // todo auto-generated constructor stub } public int getvehicleid() { return vehicleid; } public void setvehicleid(int

c# - Dictionary<string, object> serialization -

my data class contains dictionary field highly diverse data. internal class program { public class dto { public string name { get; set; } public dictionary<string, object> data { get; set; } } static void main(string[] args) { var dictserializer = new dictionaryinterfaceimplementerserializer<dictionary<string, object>>(dictionaryrepresentation.document); bsonclassmap.registerclassmap<dto>(cm => cm.mapmember(dto => dto.data).setserializer(dictserializer)); var instance = new dto { name = "test", data = new dictionary<string, object> { {"str", "thestring"}, {"byte", (byte)42}, {"bytearray", new byte[]{ 0x1, 0x2, 0x3}} } }; var col = new mongoclient("mongodb://localhost:27017").getdata

delphi - TMainMenu build menu item dynamic -

on system , main menu dynamic, builded data in database. i have specific situation menu items need assembled before being displayed. let's assume menu has following main items: files - customer - reports - about when click in reports menu item must assemble items before displayed. i did analysis of code in tmainmenu, tmenu , tmenuitem class. unfortunately have not found simple solution problem. exist way create these items before being displayed? there trick can use. need add 1 dummy tmenuitem under reports , set visible property false . add onclick event reports item , populating logic there. before add new items have delete existing ones, should leave dummy item intact. something like: procedure tform1.reportitemclick(sender: tobject); var item: tmenuitem; i: integer; begin // delete items first - dummy - 1 := reportitem.count - 1 downto 1 reportitem.items[i].free; item := tmenuitem.create(reportitem); item.caption := 'abc&

php - Use odbc eloquent outside laravel PHP7 -

i using eloquent outside laravel. have own php application. using https://github.com/illuminate/database my config following $settings3 = array( 'driver' => 'odbc', 'dsn' => "driver={sql server};server={servername};trusted_connection=true;database=telesur_mis;", 'username' => 'user', 'password' => 'user',); $capsule->addconnection($settings3,'teleappframework'); after executing code getting following error fatal error: uncaught invalidargumentexception: unsupported driver [odbc] i have pdo odbc installed, have tested pdo odbc connection outside of eloquent. reason using odbc is, because using php7 , there no pdo extension sql server. can me on this? i download freetds , use regular sqlsrvr driver works charm (if on unix env) there lot of posts on how configure etc up.

Upgrade CakePHP from 2.1 to 2.8+ -

i'm sure should upgrade project 2.1 2.8+ how hard be? have experience this? there "dos , don'ts" should know (apart man)? but how hard be? have experience this? how hard depends on quality of code , how close stayed principles of framework. if used , followed conventions , didn't change core classes or made other big stupid thing should matter of following migration guides. are there "dos , don'ts" should know (apart man)? no, follow migration guides. every version has 1 describes changes. here 1 2.8, i'm sure you'll able find others. http://book.cakephp.org/2.0/en/appendices/2-8-migration-guide.html

android - Navigation drawer fragments overlap even with replace() -

i have navigation drawer in activity. activity's layout has relative layout fragment. id of relativelayout maincontent in load fragment(call fraga) in oncreate() of activity. have same fragment in navigation drawer along other navigation items. loaded oncreate of activity , can loaded navigation drawer. on selecting navigation items, replace fragment in maincontent relativelayout in activity replace() . in navigation drawer, 0th item "fragb"(the same fraga in nav drawer). second fragment(fragc). when select fragb "more once" , select fraga , press button, fragb , fragc overlap. and have keep pressing button go initial screen because every time select item nav drawer, new fragments fragbs , fragcs created. not replaced. replace them in maincontent (first relative layout) in activity's layout. i'm using framelayout fragments. this activity's layout in place fragments: <android.support.v4.widget.drawerlayout xmlns:android="http:/

php - Adding multiple products to Woocommerce basket script -

i have little html product selector passes woocommerce sku's via post data in url. want use these sku's add matching products woocommerce shopping cart. i have written php script sitting in wordpress theme directory think there little why getting "500 server error". if remove add_to_cart function , echo out sku's instead works see problem there. thought because using add_to_cart function outside of loop? not sure. below have far if out appreciated. <?php //get skus $design_sample_ids = $_get["samples"]; //put skus in array $design_sample_id = explode(";", $design_sample_ids); //loop through skus foreach ($design_sample_id $sample_id) { //add each sku cart wc()->cart->add_to_cart($sample_id); } ?> ok have cobbled solution works me. may not best i'm still interested see others can come with. posting here in case helps anyone. in functions.php file.. function add_multiple_sku($

Webview in android-flip not work -

i use lib use flip view webview: https://github.com/openaphid/android-flip here code in adapter: public view getview(int position, view convertview, viewgroup parent) { webview mweb = null; if (convertview == null) { mweb = new webview(parent.getcontext()); string mcustomhtml = "<h1>test 0</h1></br>"; (int = 1; < 20; i++) { mcustomhtml += "<h1>test " + string.valueof(i) + "</h1></br>"; } mweb.loaddata(mcustomhtml, "text/html; charset=utf-8", null); } else { mweb = (webview) convertview; mweb.scrollto(0, position * 200); } return mweb; } but it's not work correctly, first 3 flip, webview still scroll @ 0 position , view sometime blink! any idea? thank you!

tsql - Aggregation on Hierarchy Data types -

i've been reading hierarchy data type in ms sql2012. i'm trying store organisation data structure values @ each level. i'm wondering how aggregate data associated hierarchy data column. for instance want sum 3 levels top of hierarchy, use that. use group or roll-up or there new function use on hierarchy data type. to sum 3 levels looks use getlevel per link http://technet.microsoft.com/en-us/3b4f7dae-65b5-4d8d-8641-87aba9aa692d http://msdn.microsoft.com/en-au/library/bb677197(v=sql.100).aspx select sum(z) humanresources.employeeorg orgnode.getlevel() between 0 , 2

c# - WPF radio button with Image -

Image
i have create similar picture. if 1 of button clicked others should become darker. lot! that's need you can change opacity when radiobutton not checked via style trigger <radiobutton.style> <style targettype="radiobutton"> <style.triggers> <trigger property="ischecked" value="false"> <setter property="opacity" value="0.5"></setter> </trigger> </style.triggers> </style> </radiobutton.style> image inside can created modification of template <radiobutton.template> <controltemplate targettype="radiobutton"> <!-- new template --> </controltemplate> </radiobutton.template> default template can found here my primitive template looks (i have added 3 radiobuttons itemscontrol , 2nd checked)

inheritance - How to overwrite variables from a parent class in PHP? -

i struggling problem 1 has following setup: class model { public $tableconnection = null; .... } now there class inherits model. class newmodel extends model { public $tableconnection = array("belongsto" => "othermodel"); ... } what acchieve define tableconnection putting definition child class ( newmodel) in order overwrite original variable within class model . newmodel should simple possible without additional methods or functions, instead model can include useful. maybe recognized similarity cakephp framework. trying understand how things can acchieved. , maybe there php wizzard out there knows how deal :-) it working, please check here:- <?php class model { public $tableconnection = null; } class newmodel extends model { public $tableconnection = array("belongsto" => "othermodel"); } $obj = new newmodel(); print_r($obj->tableconnection); ?> output:- https://eval.in/5092

Why can "return" and "break" appear only as the last statement in a block of Lua code? -

as lua manual states: http://www.lua.org/pil/4.4.html i'm interested in technical limitations or constraints, not answers pertaining taste or coding standards. it seems odd constraint me, given hanging return can added statement do return end . to quote 1 of lua authors in e-mail on lua mailing list: for return statement, it's because otherwise may ambiguous: ... return f(1,2,3) ... is return no values or tail call f? the restriction on break statement leftover experimental break-with-labels. "break f(x)" coud "break f" followed "(x)". for lua 5.2 , restriction break has been lifted.

usb - android 2013 nexus 7 and windows 8.1 x-64 drivers -

i have made drivers work 2012 nexus 7, , few other android devces. i got 6 2013 nexus 7's , can not seem drivers installed. upgraded software 6.0.1. but unable screen shown here . adb not find devices. in ptp mode, windows finds of these , assigns usb driver 6.3.9600.17415 dated 2006. trying update driver add more specific driver fails because windows not know it's phone. using have disk fails when opening .inf file these: 1 , 2 , 3 . in charging mode, windows device manager thinks it's google nexus adb interface, not show , phone options. have disk fails also. so adb devices fails. this used work somehow, deleted of drivers. plugging in 2012 nexus 7 shows android composite adb interface , shows in adb list-devices. does know way out of trap? edit this may part of problem. tried this disable driver signature verification, no joy. trying shazar's idea required uninstall (repair failed) of clockwork driver, (5/6) of devices using clockwork drive

java - JavaCompiler gives error when dependent class is being created -

i writed code generates 2 class write them buffer , compile them javacompiler. classes in .java files; public class a{ public a() { } public string tostring(){ return "a";} } and public class b extends arraylist<a> { public b() { super(); } public void additem(a a) { this.add(a); } public void print() { this.print(); } } something this. however, name of classes randomly generated , when create file gives error this; symbol: class location: class b ./src/a.java:4: error: cannot find symbol (4th line "...extends arraylist..." , there ^ symbol under a) my code generator compiles this; first fill buffer template type classes compile this: javacompiler compiler = toolprovider.getsystemjavacompiler(); compiler.run(null, null, null, f.getpath()); after create buffer , fill template b type classes compile this; system.out.println(f.getparentfile().getpath()); compiler.run(null, null, null, f.getpath());

java - How can i enable Multi selection on a tree viewer after creating it? -

actually created table viewer application , requirement comes me in such way multi selection should enabled after creating viewer. please me this. multi selection can set @ time of tree construction or tree-viewer construction only. style member variable of widget class accessibility default cannot access same , there no method available set style object.so seems not possible change selection after treeviewer or tree creation.

matlab - Getting variable out in workspace from function -

when running function, not variables out in work-space. when set breakpoints able variables in workspace. therefore, how variables out in workspace without setting breakpoint? you can use assignin('base','variablename',value); to write variables function-workspace base-workspace. when use breakpoints see workspace of function or script execution stopped at. can choose in editor workspace(stack) want see in debug mode. if want write whole function-workspace base-workspace (which in sense of encapsulation not recommended) can use vars=whos; k=1:length(vars) assignin('base', vars(k).name, eval(vars(k).name)); end

ejabberd Clustering with master Slave and Master Master not avoid single point of failure -

whenever master gets down in ejabberd cluster slave not able process request. follow tutorial : http://chadillac.tumblr.com/post/35967173942/easy-ejabberd-clustering-guide-mnesia-mysql , try join_node() , join_as_master() also. not working. cluster working , i used mysql database separate database both node. tried join master slave , master master method. both not working avoid single point of fauilure. is necessary synchronize slave , master mnesia database? please 1 can me in this... there no single point of failure ejabberd if configure right way. there no such thing master-slave in ejabberd. ejabberd master-master , if configure join_cluster command described in official ejabberd documentation: http://docs.ejabberd.im/admin/guide/clustering/ you need configure other services redundant well: - load balancer - mysql once done, not see can see point of failure. if node has go down, service keeps on working fine users connected on other nodes , 1 have been disconnec

python - Number of elements in each dimension of image -

i want give input image python script, , find out number of elements in each dimension of input image. there function in python gives number of elements in each dimension. with scipy: >>> scipy.misc import imread >>> img = imread("test.jpg") >>> img.shape 0: (963, 712, 3) where 963 - width, 712 - height, 3 - number of channels.

Filter a sharepoint visual web part through created by column through code -

i created visual web part , loading list in grid. when user login has display items created user a. user b has display items belong user b. here code have written.it display items irrespective of logged in user. can 1 me on this public void displaylistdata() { // system.diagnostics.debugger.break(); datatable dt = new datatable(); var ospweb = spcontext.current.web; splist osplist = ospweb.lists["participation @ glance"]; string strcreatedby = spcontext.current.web.author.name; spquery oquery = new spquery(); oquery.query = "<query><where><eq><fieldref name='author' /><value type='user'>" + strcreatedby + "</value></eq></where></query>"; splistitemcollection colllistitems = osplist.getitems(oquery); datatable dts = colllistitems.getdatatable(); if (dts !

asp.net - add sweet alert to LinkButton event -

i wondering if way combine sweet alert asp.net linkbutton. example have button delete row gridview , want fire sweet alert style my code: <asp:linkbutton id="linkbutton3" cssclass="btn btn-danger btn-sm" causesvalidation="false" commandname="delete" onclientclick="return confirm('are sure want remove item?');" runat="server"><span class="glyphicon glyphicon-trash"></span></asp:linkbutton> and sweet alert example: swal({ title: "are sure?", text: "you not able recover imaginary file!", type: "warning", showcancelbutton: true, confirmbuttoncolor: "#dd6b55", confirmbuttontext: "yes, delete it!", closeonconfirm: false }, function(){ swal("deleted!", "your imaginary file has been deleted.", "success"); }); i have not figured way utilize gridview rowcommand function, instead p

java - hibernate subquery throwing Null Pointer Exception -

i trying fire subquery hibernate, showing npe:-(anyone know how resolve it? below code: detachedcriteria criteria = detachedcriteria.forclass(my.class,"a"); criteria.createalias("a.a", "a"); criteria.createalias("a.b", "b"); if(cvalue !=null && cvalue.size()>0){ criteria.add(restrictions.in("b.c", cvalue)); } if(stringutils.isnotempty(commoditylist)){ detachedcriteria commcriteria = detachedcriteria.forclass(my.class,"a1"); commcriteria.createalias("a1.a", "a1"); commcriteria.add(restrictions.in("a1.name", commoditylist.split(","))); criteria.add(subqueries.propertyin("b.c", commcriteria)); } criteria.addorder(order.asc("b.c")); return gethibernatetemplate().findbycriteria(criteria); stack trace: java.lang.nullpoi

c++ - Print original input value to screen -

so working on writing code takes integer input , reverses them here program far. trying print enter 1234 output should say: '1234' in reverse '4321' prints out '0' in reverse '4321' know how fix problem? #include<iostream> using namespace std; int main() { int number;int reverse = 0; cout << "input integer value\n "; cin >> number; (; number != 0; ) { reverse = reverse * 10; reverse = reverse + number % 10; number = number / 10; } cout << "'"<< number << "'" <<" in reverse " << "'"<< reverse<<"'"<< endl; return 0; } you changing number in cycle. so, can suggest save in different variable below. or implement different algorithm. cin >> number; int original = number; .... cout << "'" << original <<

PHP basic function call query -

suppose had defined function fetch data database , display it. i.e. show_name(); now need use function in php page 4 times. now question when call function 4 time fetches data database on every call , display ? if yes better store result in $variable , use $variable 4 time instead of calling function 4 time. please guide :d i'll cache results of function consistent during page processing. when it's intended work values can changed during page proccesing should data on , on again. take consideration - @ least mysql (if it's case) there query cache can you.

oracle - SQL hierarchical table need to be simplified -

i'm having little trouble on making table bit more simple, let me explain: table structure input: old_key | new key 4536 4566 4566 4977 4321 10290 5423 8920 i'm getting data source, changing retro pk(serial number) in few tables; , after that, need update table new serial number. my problem is, instead of simple update, data can come in example, , change twice or more same old key like(in example) 4536 first changes 4566 , changes again 4977. this forcing me use cursor, update each table row row ordered first key , etc... it used fine, lately, data amount multiplied self lot , making process heavy , taking lot of resources. my question is: need eliminate keys have updated twice or more, once, meaning - out put above example: old_key | new_key 4536 4977 4321 10290 5423 8920 thought using hierarchical functions prior , start with.. start with? thanks in advance. select connect_by_root( old_key ) old_key,

mobile - Foundation Top-Bar collapse alignment -

my top bar not aligning correctly. want dropdown list when click on menu icon. this how menu looks now this how want look thanks in advance!

java - JPA/Hibernate instance of not working -

imagine situation: @javax.persistence.inheritance(strategy=javax.persistence.inheritancetype.joined) @javax.persistence.discriminatorcolumn @javax.persistence.entity @javax.persistence.table(name="parent") public abstract class parent{ ... } @javax.persistence.entity @javax.persistence.table(name="a") public class extends parent{ ... } @javax.persistence.entity @javax.persistence.table(name="b") public class b extends parent{ ... } parent p = new a(); now call this: p instance of always returns false !! works ok on openjpa! should file bug? hibernate 4.3.10 this because hibernate returning proxy. why this? implement lazy loading framework needs intercept method calls return lazy loaded object or list of objects. can first load object db , allow method run. hibernate creating proxy class. if check type in debug should able see actual type generated class not extend base class. how around it? had problem once , used visitor p

docusignapi - Lock the recipient name in Docusign -

Image
i have lock full name of signer when or sign how lock full name of textbox in docusign login docusign web app/admin -> preferences -> features -> signature adoption configuration -> check "lock recipient name"

Encoding JPEG images in a video while keeping the video playable at all times -

i have application fetches jpeg images url , i'd encode each of these images in video, arrive. the constraints follows: the video format should simple possible can implement in c or there should exist relatively non-bloated library this if power fails @ point (or forcefully close application), video should remain "viewable" , playable in normal video player without requiring other special handling regardless of how many (1 or n) jpeg images added it. in mind goes this: starting first image onwards, i'd video "complete" , append following images in order make longer video. i read m-jpeg, i'm not able find examples , or documentation on how produce means of programming. again, language c. try writing simple header before each image, --random-boundary-string content-type: image/jpeg content-length: nnnnn data... --random-boundary-string content-type: image/jpeg content-length: nnnnn data... where nnnnn size of jpeg image, , data

osx - Integrating Fabric / Crashlytics when iOS and OS X apps are in the same project -

the ongoing application has ios , os x versions in same project because of lot of shared code. tried integrate fabric platform, in particularity crashlytics toolset, both of them far see not possible through standard installation wizard since binaries compiled different architectures (x86_64, arm) rewrite each other during installation because of same path. i think solved placing binaries different paths , specifying them @ run phase. i'm not sure whether maintainable in future considering fact of automatic updates. has encountered such task? mike crashlytics , fabric here. you want similar mention here tvos , ios projects. but here's need do. add fabric , crashlytics ios target. move ios crashlytics.framework , fabric.framework different location default provided. update framework search paths in ios project’s build settings. update /run path in ios run scipt build phase point updated location. build ios project ensure frameworks , /run script dete

c++ - GCC shared_ptr Template Error -

the following function #include <memory> template<typename t> std::shared_ptr<typename t> tail(const std::shared_ptr<typename t>& cont, size_t n) { const auto size(std::min<size_t>(n, cont->size())); return std::shared_ptr<typename t>(new t(cont->end() - size, cont->end())); } produces following error on gcc 4.7.2. g++ test.cpp -std=c++0x test.cpp:4:27: error: template argument 1 invalid test.cpp:4:66: error: template argument 1 invalid test.cpp: in function ‘int tail(const int&, size_t)’: test.cpp:6:42: error: base operand of ‘->’ not pointer test.cpp:7:35: error: template argument 1 invalid test.cpp:7:47: error: base operand of ‘->’ not pointer test.cpp:7:67: error: base operand of ‘->’ not pointer i understand cont not 'look' pointer, compiles fine on vs2012. how can write function gcc? just remove typename s template<typename t> std::shared_ptr<t> tail(const std::shared_p

javascript - Make a placeholder % sign pretend to stay -

this peculiar question but, have input field, this, <div class="<?php if(form_error('interest')!= null){echo ' has-error';} ?>"> <h4><?php echo lang("offer_of_intrest"); ?></h4> <input class="form-control" type="text" value="<?php echo set_value('interest'); ?>" placeholder="1%" name="interest"> </div> where placeholder says 1% , input accepts whole numbers ( 1 or 2 or 3 on.. ) , want somehow keep percentage sign inside place holder make user enter number keeping percentage sign , on submit of button number should go , not percentage sign. since in mysql accepts decimal places. giving user fake percentage sign in placeholder dont confused , enter 1( percent) in input field. , hope understand able. since seem using bootstrap, i'd remove % placeholder , use input-group , input-group-addon : <link href="htt

ios - How to count the number of glyphs in NSLayoutManager -

how total number of glyphs in nslayoutmanager ? i making cursor layer overlay on custom text view this: func movecursortoglyphindex(glyphindex: int) { // bounding rect glyph var rect = self.layoutmanager.boundingrectforglyphrange(nsrange(location: glyphindex, length: 1), intextcontainer: view.textcontainer) rect.origin.y = self.textcontainerinset.top rect.size.width = cursorwidth // set cursor layer frame right edge of rect cursorlayer.frame = rect } however, wanted make sure glyphindex not out of bounds. this: if glyphindex < self.layoutmanager.glyphcount { // doesn't work // ... } i couldn't find right property trial , error, though, , searching online didn't show answers. i did find in buried in documentation (and seems obvious), since took long time, decided add q&a here. use numberofglyphs property, in layoutmanager.numberofglyphs this demonstrated in text layout programming guide documentation here .

linux - How to understand and avoid non-interactive mode errors when running ispell from script? -

background ispell basic command line spelling program in linux, want call collected list of file names. these file names recursively collected latex root file example. usefull when requiring spell recursively included latex files, , no other files. however, calling ispell command line turns out non-trivial ispell gives errors of form "can't deal non-interactive use yet." in cases. (as side not, ideally call ispell programmatically java using processbuilder class, , without requiring bash. same error seems pester approach however.) question why ispell gives error "can't deal non-interactive use yet." in cases, when called in bash loop involving read method, not in other cases, shown in below code example? the below minimal code example creates 2 small files ( testfileone.txt , testfiletwo.txt ) , file containing paths of 2 created files ( testfileslisttemp.txt ). next, ispell called testfileslisttemp.txt in 3 different ways: 1. of "cat

how i can open docx file using php docx? -

i trying open docx file using phpdocx getting error. function open_docx(){ `require_once 'phpdocx/classes/createdocx.'; $docx = new transformdoc(); $docx->setstrfile('submitted/2794849631aresha.docx'); $docx->generatexhtml(); $html = $docx->getstrxhtml(); }` fatal error: class 'transformdoc' not found in c:\xampp\htdocs\uni\includes\functions.php on line 203 tvp7c9piev+ftzfhusfhbws7bq/27edis3hwvxbsstmr3bmvspyg0k1enxomzib72a97njjglyahq0qw0pt8uqe7px8jwi3j4kbfdsiewue8c5lplm7ppxiekrulsxiy8vhnyc01ucdro9vidb6yv0li3sjyqnsthkew/zs1p/cu8bqnoq+jv+bof5yq8+xwt7vkg8vsape7fjpl23bdgmbkzulx16eoa5ghwfuaadrlx3aenrjgaruahpuopbbdvyu4ek5ng1iwv2iireakm1zr3w4dtgnu8ax1awx4kmoqzi4rsdcucdhhil5qfonqihh8eps3wsh8+4fkffwmbarnbvrgiziwmpprkgtcdeb62dy7viz/jx+mzq+3k6vzcfe01bi9k45zxv+eduv3vgurqdayk4fzn8c3z+bvzdn7mrjll5vxhwkzek3yjw1yirupwogga99dcivdvzy3wtkmfgsasx+xfhx4+heduc/iskz44uax4fpgl+20yu328hle+97sihtavzawrodx+oe8s2ybglii5r6aq2wpxyxgys5alfkrif5kmtixhqn9tcgwy9zrmza4arr/f5

javascript - I am not able to change the position of my ck editor -

i not able position ck editor. below js client code template.a.onrendered(function(){ ckeditor.replace('b'); $('ckeditor').css({'position':'relative','left':'-40px', 'top': '5px'}); }); after ck editor has replaced editor id in case "b". how change position. above method not working. correct method doing that? new programming. so, please forgive me diversion programming conventions. hugely appreciated. what using pure css (use id or class select dom): #my_ckeditor{ position:'relative' !important; left:'-40px' !important; top: '5px' !important; } you can add id ckeditor, , use id selector css. important! means style has highest priority default ckeditor stylesheet.

c# - List<T> passed to controller sends empty items -

Image
a partialview contains model foo list<bar> . each bar item contains 2 properties, bara ( string ) , barb (decimal). trying render chart in partial view, work need call action on same controller , pass result <img /> element. render chart, need collections of bara , barb format data. i'm trying this: controller public void generatechart(list<bar> model) { var chart = new system.web.helpers.chart(400, 200) .addtitle("title") .addseries( name : "name", xvalue : model.select(m => m.bara).toarray(), yvalues : model.select(m => m.barb).toarray()) .write(); } partial view routevaluedictionary rvd = new routevaluedictionary(); (int = 0; < model.bars.count; ++i) { rvd.add("model[" + + "]", model.bars[i]); } <img src="@url.action("generatechart", rvd)" /> the problem though model object contains 3 items should contain, these null. trie

java - RequestDispatcher: Servlet mapping doesn't work properly -

its confusing. don't have kind of idea happend here: i want deploy simple war-project. 2 httpservlets, 1 forwards request one: ... string[] selectedoptionslabels = ... req.setattribute("checkedlabels", selectedoptionslabels); try { req.getrequestdispatcher("/confirmationservlet.do").forward(req, resp); } ... when try set values on form works great without dispatcher, when try example, browser can't handle servlet. tries download file confirmationservlet.do. confusing. there seems mapping problem, can't figure out, since deployment work fine. do have idea? this web.xml (without outer web-app-tag) <--- testing purposes, knowing there annotations. <servlet> <servlet-name>formhandlerservlet</servlet-name> <servlet-class> de.lancom.formhandling.formhandlerservlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>formhandlerservlet</servlet-name>

swing - What are width and height parameters for in java.awt.Component.getBaseline(int, int)? -

java api documentation doesn't have lot of information this. shed light on question? the return value of method offset of font baseline top of component. value depends on size of component - changing width may cause text in component wrapped, , changing height cause text shift if it's aligned bottom of component. since method used during component layout, can't use actual component size , position calculate baseline, because component being resized , repositioned during layout. therefore, size passed directly method. that's width , height parameters for.

command line interface - How to DRYly subclass (or otherwise share code with) rubys OptionParser to e.g. share options? -

i want share options multiple scripts , prefer use 'builtin' optparse on other cli-or-optionparsing-frameworks. i looked @ mris optparse.rb , not understand how best sublass optionparser (the initializer takes block). optimally arrive @ code this # exe/a_script require 'mygem' options = {whatever: 'default'} mygem::optionparser.new |opts| opts.on('--whatever') |w| options[:whatever] = w end end.parse! and second script consumer: # exe/other_script require 'mygem' options = {and_another: 'default'} mygem::optionparser.new |opts| opts.on('--and_another') |a| options[:and_another] = w end end.parse! and define "default option" (say "-v" verbose , "-h" help" in common custom optionparser. # lib/mygem/mygem_optionparser.rb require 'optparse' module mygem class optionparser < optionparser # magic # define opts.on("-v") -> set option

version control - GIT: pulling a branch results in a conflict. Why? -

i have local version of branch. pulled time ago. want update branch fresh updates. call git fetch; git pull; and number of conflicts in working directory! why happens? before pull working directory clean. no commits side. no divergence possible. , despite see conflicts. why happens? how can fix it? you have changes need committed before pull . make sure commit changes before pull also, don't need pull and fetch : pull calls fetch . please see documentation on git pull operation , answer . recommend search "git best practices". you'll find whole host of articles on interwebs, e.g. an effective git branching model .

Delphi XE2 - 10: Global hotkey -

j have main program works barcode reader , keyboard without keypad. when in program number keys or return key pressed (or simulated via barcode reader) j need check in application (that runs idden in try bar) if insert code stored in database. tried global hotkey. here sample project type tform1 = class(tform) procedure formcreate(sender: tobject); procedure formdestroy(sender: tobject); private { private declarations } id0, id1, id2, id3 : integer; id4, id5, id6, id7 : integer; id8,id9,identer : integer; code : string; procedure wmhotkey(var msg: twmhotkey); message wm_hotkey; public { public declarations } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.formcreate(sender: tobject); const k_0 = $30; k_1 = $31; k_2 = $32; k_3 = $33; k_4 = $34; k_5 = $35; k_6 = $36; k_7 = $37; k_8 = $38; k_9 = $39; begin // register 0 9 , enter id0 := globaladdatom('k0'); registerhotkey