Posts

Showing posts from January, 2013

c++ - What is vtable anchoring, and how does it work in a shared object? -

i performing research issues c++ library , ensuring type information consistent between application , shared object. i'm interested in ensuring equalobject comparison works, meaning indeed have same object, , not 2 objects happen equal under operator== . this answer state anchor vtable in header. i'm not familiar technique. or i've heard called name. what vtable anchoring, , how work? i'm aware of dynamic_cast, throw, typeid don't work shared libraries gcc faq. it's non-standard technology, problem clear: translation unit should contain vtable? if virtual destructor isn't inlined, defined in 1 translation unit, , it's easy choice put vtable there. for portable code, pretty irrelevant. wouldn't care duplicate vtables.

android - Image overlay fails using FFMPEG4Android -

i trying watermark video using ffmpeg4android. using app on android market here . the command used ffmpeg -i /sdcard/videokit/in.mp4 -i /sdcard/videokit/logos/1.png -i /sdcard/videokit/logos/2.png -i /logos/3.png -filter_complex "[0:v][1:v] overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,0,1)' [tmp]; [tmp][2:v] overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,2,3)' [tmp2]; [tmp2][3:v] overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,4,5)'" /sdcard/videokit/output.mp4 but everytime run command app fails opening output file: overlay=main_w-overlay_w-10:main_h-overlay_h-10:enable='between(t,0,1)'. no such filter: '' error configuring filters. exit_program: 1 can same? you need use complex command, check ffmpeg4android blog examples

grails - How to display list items correctly in my paginated views -

this controller list games database. def index() { def platform = gameservice.listplatform() def max = params.max ?: 10 def offset = params.offset ?: 0 def chosenplatfrm = params.platform def tasklist = gameservice.listgameplat(chosenplatfrm,max,offset) def taskl = gameservice.whatshot(chosenplatfrm,max,offset) [games:taskl, bb:tasklist, chosenplatform:chosenplatfrm, platforms:platform, gamecount:taskl.totalcount, gamecont:tasklist.totalcount] } this how index.gsp looks. <g:each in="${games}" status="i" var="game"> <g:if test="${game.averagerating != 0 }"> <g:link action="gameprofile" params="${[gametitle: "${game.gametitle}"]}"> </g:link> </g:if> </g:each> <div class="pagination" style="text-align: center;"> <g:paginate action="index" total

c# - NLog exception when writing to a database -

i have nlog 4.2.3 configured write database , text file using following config: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/nlog.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" autoreload="true" internalloglevel="error" internallogfile="c:/tmp/nlog.txt"> <targets> <target name="database" xsi:type="database" dbprovider="npgsql.npgsqlfactory,npgsql,version=2.0.12.00,culture=neutral,publickeytoken=5d8b90d52f46fda7" connectionstring="server=xxx.xxx.xxx.xxx;port=5432;user id=userid;password=password;database=testdb;"> <commandtext>insert invoice_log (message, level, logger) values (@msg, @level, @logger)</commandtext> <parameter name="@msg" layout="${message}" /> <parameter name="@level" layout="${level}" />

java - Android IndexOutOfBound Exception : Invalid location 0, size is 0 -

i stuck , error when running gameview class. compiles no error when running on android emulation crashes. post logcat after code. code public class gameview extends view { private context mycontext; private list<card> deck = new arraylist<card>(); private int scaledcardw; private int scaledcardh; private int screenw; private int screenh; private list<card> myhand = new arraylist<card>(); private list<card> opphand = new arraylist<card>(); private list<card> discardpile = new arraylist<card>(); private float scale; private paint whitepaint; private int oppscore; private int myscore; public gameview(context context) { super(context); mycontext = context; scale = mycontext.getresources().getdisplaymetrics().density; whitepaint = new paint(); whitepaint.setantialias(true); whitepaint.setcolor(color.white); whitepaint.setstyle(paint.style.stroke); whitepaint.settextalign(paint.align.left); w

java - How to make normal List as ImmutableList? -

i have below builder pattern thread safe , making sure parametermap , datatype cannot modified after being assigned inputkeys class using immutablemap , immutablelist guava class. public final class inputkeys { private final long userid; private final long clientid; private final list<string> holderentry; private static final immutablelist<string> default_type = immutablelist.of("hello"); private inputkeys(builder builder) { this.userid = builder.userid; this.clientid = builder.clientid; this.holderentry = builder.holderentry.build(); } public static class builder { protected final long clientid; protected long userid; protected immutablelist.builder<string> holderentry = immutablelist.<string>builder().addall(default_type); public builder(inputkeys key) { this.clientid = key.clientid; this.userid = key.userid; this.

machine learning - How can weka in Java classify one sample and print the result rather than read arff files? -

because read non-classify samples line line, , want append classify result end of each line, have load weka model file. can use weka in java classify 1 sample rather read arff files? yes. use evaluation.evaluationforsingleinstance estimate single case.

android - Add section to recycle View in run time with dynamic array -

i trying add section/header in recycle view have handle section stuff in @override public int getitemviewtype(int position) { // here custom logic choose view type return position == 0 ? section: item; } but having arraylist have n number of data . 1st section may have 10 row 2nd may have 2 row .so how define section in case .where come know end of 1st section ? , put 2nd one iterate on each model , remember previous section name of each model item. when ever find new section name, map index. in adapter return items count fewer data set. @override public int getitemcount(){ return mdata.size() + msections.size(); } always use position + 1 , because 1 position ahead. whenever reach position belongs mapped indexes, return section type , bind accordingly: @override public int getitemviewtype(int position) { // here custom logic choose view type return ispositionsectionindex(position) ? view_type_section: view_type_item; }

css - What are the default top, left, botton or right values when position:absolute is used? -

Image
in big project, few buttons misalligned in ie. found fix coincidence, setting position: absolute without parameters. made me wonder, default values of such position? understand how absolute positioning works , containing element means. don't know default values come from. not top:0; left:0 expected. <!doctype html> <html> <head> <style> h1 { position:absolute; } </style> </head> <body> <h1>absoulute pos</h1> <p>paragraph</p> </body> </html> here simple page, , how final positioning of h1 element looks like: as suspect, initial values these properties not 0 ; auto . can find property definitions in section 9.3.2 of spec. when absolutely positioned box keeps offsets auto (i.e. don't modify them), doesn't go anywhere. remains in static position, means usual spot in layout had not been positioned @ all. section 10 has all details (it has entire paragraphs explaining "

Android push notification using Sinch not working -

hi i've been following tutorial sinch: https://www.sinch.com/learn/sinch-managed-push-calling-android/ , , problem gcmbroadcastreceiver doesn't seem able receive anything. before able have instant-messages between users chat activity open. i'm trying notifications when chat activity not opened. far i'm understanding, sinch supposed take care of push , need receive push notification , whatever want it. when send message 1 device using another, nothing happens far push notification's concerned. help? thank much! my androidmanifest related parts: <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-permission android:name="com.google.android.c2dm.permission.receive"/> <uses-permission android:

javascript - how use phantomjs screenshot the whole page -

i use phantomjs screenshot page,but can't screenshot buttom of page. var height = page.evaluate(function() { window.document.body.scrolltop = document.body.scrollheight; } ); value of height 33943,but real value of scrollheight 44135. how can load whole page? the snapshot img the page you can snapshot page by: var webpage = require('webpage'); page = webpage.create(); page.open('http://www.example.com'); page.onloadfinished = function() { page.render('screenshot.png'); phantom.exit(); } not sure why need calculate height of page.

How to remove a space in XML using stylesheet using RegEx -

i have xml , looking finding particular tag (in case "firstname") , removing space in value if there - character before space. in other words, want keep spaces if there no - front of them. want using xsl stylesheet regex matching , replace function. expected result sam-louise, removing space between "sam-" , "louise" <?xml version="1.0" encoding="utf-8"?> <ncv version="1.14"> <invoice> <customer> <customerid>12785</customerid> <firstname>sam- louise</firstname> <lastname>jones</lastname> </customer> </invoice> </ncv> this 1 possible xslt : <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0"> <xsl:output method="html" encoding="utf-8" indent="yes" /> <xsl:strip-space element

facebook like social plugin not working -

i trying use facebook plugin has , send button.the source code of page follows- <html> <body> hello <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/all.js#xfbml=1&appid=138876406236026"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-send"></div> </body> why not working? it wont work on local system ,you should put in website , ex: www.sample.com ,

How to save data to mysql database using vb.net -

Image
hey me find error @ code :) i'm new vb.net friends try /*'con.open()*/ query = "insert mcs.custormer values(custormer_id,first_name,last_name,nic_no,c_address1,c_address2,c_address3,c_telephoneno,membership_date,business_name,g_name,g_nicno,g_address1,g_address2,g_address3,g_telephoneno)" & _ "values (@custormer_id,@first_name,@last_name,@nic_no,@c_address1,@c_address2,@c_address3,@c_telephoneno,@membership_date,@business_name,@g_name,@g_nicno,@g_address1,@g_address2,@g_address3,@g_telephoneno)" using cmd = new mysqlcommand(query, con) cmd.parameters.addwithvalue("@custormer_id", convert.toint32(txtcustormerid.text)) cmd.parameters.addwithvalue("@first_name", convert.tostring(txtfirstname.text)) cmd.parameters.addwithvalue("@last_name", convert.tostring(txtlastname.text)) cmd.parameters.addwithvalue("@nic_no", convert.tostrin

php - Is ROLE_ADMIN needed on this setup? -

i need setting role hierarchy configuration under symfony2 project. have 2 areas frontend users role_chat should able login , backend role_admin allowed. have 2 more roles: role_executive , role_loader1 can't access areas under backend table below shows: item role_admin role_chat role_executive role_loader1 user x category x command x x x alias x x report x x x i having problems because don't know how setup role_hierarchy under security.yml allow permissions shown above. have right now: security: encoders: fos\userbundle\model\userinterface: bcrypt role_hierarchy: role_chat: role_user role_loader1: [role_user, role_admin] rol

node.js - How to escape special characters from a markdown string? -

i have markdown file (utf8) turning html file. current setup pretty straight forward (pseudo code): var file = read(site.postlocation + '/in.md', 'utf8'); var escaped = marked( file ); write('out.html', escaped); this works great, i've run issue there special characters in markdown file (such é ) messed when viewed in browser ( é ). i've found couple of npm modules can convert html entities, convert convertable characters. including required markdown syntax (for example '#' becomes '&num;' , '.' becomes '&period;' , markdown parser fail. i've tried libs entities , node-iconv . i imagine being pretty standerd problem. how can replace strange letter characters without markdown required symbols? as pointed out hilarudeens forgot include meta charset html tag. <meta charset="utf-8" /> if come across similar issues, suggest check first.

python - 3D pcolor/pclormesh plot in matplotlib -

1. attempt 2-d numpy array represent value of area, showing this: http://i8.tietuku.com/90d045a6c2375474.png and want plot value in z-axis. for example, if want plot altitude of area, using 3d pcolor plot, can figure real terrain. 2. result for now, can plot 3-d plot of area using code import mpl_toolkits.mplot3d.axes3d axes3d fig,ax = plt.subplots(subplot_kw=dict(projection='3d'),figsize = (12,8)) ax.plot_surface(xx, yy,value,rstride = 1,cstride = 1,\ cmap=plt.cm.spectral_r,linewidth = 0) result http://i4.tietuku.com/b2e650d0d23d5756.png can 1 offer advice plot 3-d based on each grid value (like 3-d histogram)? update a little question added here, how change xticks , yticks in 3-d axes? is http://matplotlib.org/examples/mplot3d/bars3d_demo.html looking for?

python - SparkSQL sql syntax for nth item in array -

i have json object has unfortunate combination of nesting , arrays. not totally obvious how query spark sql. here sample object: { stuff: [ {a:1,b:2,c:3} ] } so, in javascript, value c , i'd write mydata.stuff[0].c and in spark sql query, if array wasn't there, i'd able use dot notation: select stuff.c blah but can't, because innermost object wrapped in array. i've tried: select stuff.0.c blah // fail select stuff.[0].c blah // fail so, magical way select data? or supported yet? it not clear mean json object lets consider 2 different cases: an array of structs import tempfile path = tempfile.mktemp() open(path, "w") fw: fw.write('''{"stuff": [{"a": 1, "b": 2, "c": 3}]}''') df = sqlcontext.read.json(path) df.registertemptable("df") df.printschema() ## root ## |-- stuff: array (nullable = true) ## | |-- element: struct (conta

angularjs - 403 forbidden on bower components -

i use apache virtual host server. use yeoman generate angular app template. reason, when launch site, can see index page console gave me 403 forbidden errors on bower components bootstrap, angular.js...etc. not sure did wrong. can help? thanks! my v-host file <virtualhost *:80> serveradmin myname@gmail.com documentroot "/users/john/testproject/app" servername testproject.localhost errorlog "/private/var/log/apache2/testproject-error_log" customlog "/private/var/log/apache2/testproject-access_log" common <directory "/users/john/testproject/app"> options indexes followsymlinks multiviews allowoverride order allow,deny allow require granted </directory> </virtualhost> my project structure. testproject app bower_components <-symlink bower_components angular <----403 error bootstrap <----403 error ..

Can I create company hub app for windows 10 mobile app distribution? -

i had created company hub app win phone 8 signed xap downladed url on mobile devices preinstalled aet token. but not able find similar mechanism distributing windows10 uwp/ windows-10 mobile app. how can achieved? how distribute wp10 apps without using store. amit, windows 10 (mobile) still have option distribute app via company portal (e.g. name microsoft intune mobile application management app users internal company apps). windows 10 mobile don't need symantec certificate anymore. in addition, can distribute app through windows store business web portal new windows 10 devices (please see http://businessstore.microsoft.com ). please let me know if helps.

bash - Order filenames by number of appereances of given character? -

i want output list of file names in directory, list should ordered descending number of appeareances of given character in each file name. how can bash? let want sort occurences of "a" in file names: for in *; do; echo "`grep -o "a" <<< "$i" | wc -l` $i"; done | sort -r result $ ls carla elaine guybrush herman largo leamon-head lechuck max meathook ozzie sam stan voodoo $ in *; do; echo "`grep -o "a" <<< "$i" | wc -l` $i"; done | sort -r 2 leamon-head 2 carla 1 stan 1 sam 1 meathook 1 max 1 largo 1 herman 1 elaine 0 voodoo 0 ozzie 0 lechuck 0 guybrush

java - How to put an object into an array -

how put object array? array. public static player [] playerarray; player[] playerarray = new player [2]; player public class player { private string wpm; private string mistakes; private string time; public player (string nwpm,string nmistakes, string ntime){ wpm = nwpm; mistakes = nmistakes; time = ntime; } public string getwpm(){ return wpm; } public string getmistakes(){ return mistakes; } public string gettime(){ return time; } } i kept getting error exception in thread "main" java.lang.nullpointerexception whenever tried use player. did wrong? there else need? edit : adding errors happened public void setplayer1(player p){ p1wpm.settext("8"); p1mis.settext(p.getmistakes()); p1time.settext(p.gettime()); } for example add player object in array can do: player[] playerarray = new player [2]; //create new player object usi

c++ - May I clear a priority_queue by clearing its underlying container? -

the following code inherits std::priority_queue , provides clear() calls internal std::vector 's clear() #include<iostream> #include<queue> using namespace std; template<class type> struct mypq :public priority_queue<type> { void clear(){ this->c.clear(); } }; mypq<int>pq; int main() { for(int i=0;i<10;++i) pq.push(i); pq.clear(); for(int j=-5;j<0;++j) pq.push(j); while (!pq.empty()){ cerr<<pq.top()<<endl; pq.pop(); } } when tested g++, msvc++ , clang, produces expected output: -1 -2 -3 -4 -5 but haven't seen guarantee this, i.e. clearing internal vector same calling pop() when priority_queue isn't empty. although know other ways clear such swap or assign using empty priority_queue, think if code can work well, more efficient since allocated memory in vector reusable. wonder if code portable or won't work? a question. while can&#

python post login form timeout -

i'm try wirte code login other webpage. after send command line login, script started, result notification timeout connected webpage don't know problem in code. i'm using python 2.7.11 suggestions? webpage code <form id="registration" action="/auth/login" method="post"> <strong style="color:red"><br></strong> <ul class="form register"> <li> <label>email *</label> <span class="txt"> <input class="main-login" name="loginform[email]" id="loginform_email" type="text"> </span> </li> <li> <label>password *</label> <span class="txt">

echo-ed HTML Element from PHP is not read in JAVASCRIPT -

so have html elements generated php since contents fetched database i.e. <?php ... while($row = $sqlqry->fetch_object()) { echo "<li class = 'lstoption' id = 'opt$row->name' data-value = '$row->total_count'> <h3>$row->given_reference<h3> </li>"; } ... ?> and sample structure based on javascript <script> $("ul li").click(function(){ alert($(this).data('value')); }); </script> but if inject onclick= attribute while inside echo. script executed properly. need script work echo-ed html elements php. try using variable interpolation syntax, i.e. wrap variables around curly braces "{$var}" take note have use double quotes( "" ) this "<li class = 'lstoption' id = 'opt{$row->name}' data-value = '{$row->total_count}'>

css - Save image on background image in canvas Html5 javascript -

Image
i using html5 , java script. set background image(t-shirt) in canvas. , uploading image user on t-shirt. first time show front side of t-shirt want add side of t-shirt background image. show screen shot, want. after click on front side small image. save. html: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.min.js"></script> <div class="container"> <div class='row'> <div class="col-sm-12"> <input type="file" id="file" class="btn btn-success"> <br/> <span> front <span style="margin-left:50px">back</span><br> <a href='' clas

java - build spring framework source code encounter an error -

i fetched spring framework source code github using git clone command. when build source code using gradle build in source code directory,it takes long time download dependencies , compile java code,but failed exception.the output below. :spring-webmvc-portlet:sourcesjar up-to-date :spring-webmvc-tiles2:javadoc skipped :spring-webmvc-tiles2:javadocjar skipped :spring-webmvc-tiles2:sourcesjar skipped :spring-websocket:javadoc up-to-date :spring-websocket:javadocjar up-to-date :spring-websocket:sourcesjar up-to-date :distzip failure: build failed exception. * went wrong: failed capture snapshot of input files task 'distzip' during up-to-date c heck. see stacktrace details. > java.io.filenotfoundexception: c:\users\yuqing\workspace\spring-framework\buil d\distributions\spring-framework-4.3.0.build-snapshot-schema.zip * try: run --info or --debug option more log output. * exception is: org.gradle.api.uncheckedioexception: failed capture snapshot of input files f or

python - Deep Learning: is there any open-source library that can be integrated with Hadoop streaming and MapReduce? -

google search popped out quite few open source deep learning frameworks. here collected list google tensorflow theano mxnet keras pylearn2 blocks lasagne chainer scikit-neuralnetwork theano-lights deepy idlf reinforce.js opendeep mxnet.js cgt torch caffe scikit-cuda cuda4py which 1 can implemented in straight-forward way hadoop streaming , mapreduce? python prefered, other languages can considered. edit: currently interested in deep reinforcement learning , lstm. deeplearning4j claims scalable on hadoop , spark: http://deeplearning4j.org/

backbone.js - why it use return parent.apply(this, arguments) in model -

i don't know why use return parent.apply(this, arguments) inherit ? // constructor function new subclass either defined // (the "constructor" property in `extend` definition), or defaulted // call parent constructor. if (protoprops && _.has(protoprops, 'constructor')) { child = protoprops.constructor; } else { child = function(){ return parent.apply(this, arguments); }; } // add static properties constructor function, if supplied. _.extend(child, parent, staticprops); // set prototype chain inherit `parent`, without calling // `parent` constructor function. var surrogate = function() { this.constructor = child; }; surrogate.prototype = parent.prototype; child.prototype = new surrogate; this strictly related how javascript object extension , inheritance working. in javascript extend object new properties have extend it's base prototype. here small snippet widespread , and elegant inheritance method. there other prot

linux - make git clone with sudo -

when make git clone ssh user prompt works properly. git clone ssh://url.com/soft.git soft_git the ssh key id_rsa , id_rsa.pub under /home/user/.ssh my purpose execute git sudo got following error cloning '/home/user/git/soft'... permission denied (publickey,keyboard-interactive). fatal: not read remote repository. please make sure have correct access rights , repository exists. i create folder /root/.ssh , copy ssh keys got same error how execute git sudo properly. when run git using sudo, git run root. because git running root, ssh running root. because ssh running root, trying log on remote server root. remote server not okay (as should be!) you need 2 things: put username in url: ssh://myusername@url.com/soft.git. make ssh key available root user, because under /root/.ssh instead of /home/user/.ssh . (you point ssh @ correct key, don't know how this, , ssh picky permissions.)

dns - Route53 Subdomain Creation with IP address and Port Number -

we using route53 aws service create sub domain our hosted zone. have instance running on amazon server elastic ip. once create route53 record of type can assign elastic ip of our instance. map apache default page port 80 used default port given ip address. in our scenario have multiple services running on same instance , want use service runing on port 8153. our requirments map port automatically our subdomain. when type "ci.yyyyy.com" automatically map service running on 8153 port. these steps should done using terraform scripts. is there way map ip address , port number sub domain? suggestion , comments appreciated. thanks this not belong route53 can achieve using reverse proxy in front of servers. e.g use squid in front of webserver , redirect based on domain name url. in squid can achieve using cache_peer_access see question see pretty nice diagram edit: propose squid here, can find other reverse proxy tool, nginx example if prefer

how to open a modal (bootstrap) using jQuery? -

this modal <div class="modal hide fade" id="loader"> <div class="modal-dialog"> <div class="modal-content" style="margin-top:240px;"> <div class="modal-body"> <input type="range" id="loaderd" min="-50" max="0"> </div> </div> </div> </div> and jquery $('#loader').modal('show'); the error coming uncaught typeerror: $(...).modal not function @ ssss.js:546onclick @ ssss.htm:1 what's problem? , working button this <img id="volumeclickedminiplayer" src="img/volume.png" width="25px" height="25px" data-toggle="modal" data-target="#loader"> checout out of points .. 1

R covert values in rows with string of multiple values to columns in a dataframe -

i have dataframe {each row in b string values joined $ symbol}: a b 1$2$3 b 2$4$5 c 3$2$5 now want this{i want create columns value present in row(of column b) or not.}: a b 1 2 3 4 5 1$2$3 1 1 1 0 0 b 2$4$5 0 1 0 1 1 c 3$5 0 0 1 0 1 i want without using loops in r . please me thanks in advance here's attempt. first, unique values across b column , combine table factor while specifying these levels splits of b column (edited after comments @akrun) temp <- strsplit(as.character(df$b), "\\$") # save split column lvls <- unique(unlist(temp)) # unique values df[lvls] <- do.call(rbind, lapply(temp, function(x) table(factor(x, levels = lvls)))) df # b 1 2 3 4 5 # 1 1$2$3 1 1 1 0 0 # 2 b 2$4$5 0 1 0 1 1 # 3 c 3$2$5 0 1 1 0 1

html - play framework Multiple forms with checkbox fields with the same name attribute -

i have form have multiple smaller forms inside it. smaller forms have same type of fields. have 2 checkbox fields in each of smaller forms name= "timeoftheday" . 1 checkbox has value "morning" . other 1 has value "evening" . forms name "timeoftheday" same, 1 value out of forms getting selected. 1 selection done @ time in overall form field. also cant change name of field as, in play model, using same model forms, mapping name. please suggest solution this. my main model: public class details { //default customers public string timeoftheday; public integer cost; public string day; //customized details each customers public customform customdetails[]; } customform is: public class customform { public string timeoftheday; public integer cost; } defaultform template: //these params sending while rendering file controllers @(id: long, detailsform : form[models.settings.details], isedit: boolean

algorithm - Variation on knapsack - minimum total cost with exact weight -

there types of items (n types), each have weight wi , cost ci. there infinite number of each. problem make knapsack exact (w) weight , minimum total cost of items. know should use dynamic in case, it's not usual knapsack problem , can't find relation. found similar questions, haven`t understood theese solutions. here links 1 , 2 . how use dp solve it? let f[i] means, weight i, minimum cost. g[i] means whether possible combine weight i; f[0]=0;g[0]=true; (int i=0;i<n;i++) (int j=0;j<w;j++) if (g[j]) { g[j+w[i]]=true; if (f[j+w[i]]==0||f[j+w[i]]>f[j]+c[i]) f[j+w[i]]=f[j]+c[i]; } if (g[w]) return f[w]; else return 0;//impossible

C++: Overloading the = operator to create an uint8_t compatible data type -

i think should rather trivial: i wrote class handle binary coded decimal (bcd) 8 bit values. class has methodes set(), get(), add(), sub() etc. works perfectly. example get(): class bcd8_t { public: uint8_t get() { return value_u8; } private: uint8_t value_u8; }; now want convert class new data type. want replace bcd8_t a; uint8_t b = a.get(); by bcd8_t a; uint8_t b = (uint8_t)a; so expected can write overloaded "=" operator returns uint8_t, like: class bcd8_t { public: uint8_t operator=() { return value_u8; } private: uint8_t value_u8; }; however, ever tried compiler tells me cannot convert 'bcd8_t' 'uint8_t' or invalid cast type 'bcd8_t' type 'uint8_t' how this? the assignment operator assign to class. for converting object of class need implement type-cast operator: class bcd8_t { public: ... operator uint8_t() const { return value_u8; } ...

asp.net web api - JayData.js how to pass variable to the request header -

i'm trying call api controller validates request's header (x-session-id). how configure odataprovider pass variable request header? var context = new jaydata.someentities({ name: 'odata', odataservicehost: 'https://mydomain/restservice', headers: { 'x-sessionid': 'f05d1c1e-b1b9-5a2d-2f44-da811bd50bd5' }//how put value here }); there 2 ways: 1. if initialize context $data.service, can add third parameter custom headers: $data.service('url2yourservice', function (factory) { }, { httpheaders: { 'x-sessionid': 'f05d1c1e-b1b9-5a2d-2f44-da811bd50bd5' } }); see: http://jaystack.com/blog/what-is-the-difference-between-data.service-and-data.initservice or use preparerequest context.preparerequest = function(cfg){ cfg[0].headers['x-sessionid'] = 'f05d1c1e-b1b9-5a2d-2f44-da811bd50bd5'; };

excel - Match relative values -

Image
i earlier posted here did not find answer. is possible compare column respect specific reference column , if match found re-arrange column respect reference column. for example have this. 10.0 10.1 10.2 12.4 10.4 13.5 10.6 14.4 10.8 11.0 11.2 11.4 11.6 11.8 12.0 12.2 12.4 12.6 12.8 13.0 13.2 13.4 13.6 13.8 14.0 14.2 14.4 and want convert this. 10.0 10.1 10.2 10.4 10.6 10.8 11.0 11.2 11.4 11.6 11.8 12.0 12.2 12.4 12.4 12.6 12.8 13.0 13.2 13.4 13.5 13.6 13.8 14.0 14.2 14.4 14.4 or this 10.0 10.1 10.1 10.2 12.4 10.4 13.5 10.6 14.4 10.8 11.0 11.2 11.4 11.6 11.8 12.0 12.2 12.4 12.4 12.6 12.8 13.0 13.2 13.4 13.5 13.6 13.8 14.0 14.2

Indexes in Teradata -

how enable/disable indexes in teradata database? i want disable indexes , update , enable indexes in teradata. if enable/disable option not available in teradata, in sense how can achieve ? if use drop indexes, how can recreate indexes tables? teradata gives way create table without choosing primary index (if sure of column). you can create table no primary index. here sample of how so: create table <table name> (<columnname> <datatype>, <columnname> <datatype>) no primary index ;

javascript - Is this a Google account hack? -

i received email colleague attached file appeared on google drive, once clicked led following url, recreates google account login page in order steal passwords: data:text/html, https://accounts.google.com/servicelogin?service=mail&passive=true&rm=false&continue%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3cscript%20src=data:text/html;base64

java - Where can I find org.eclipse.jface.nl_de? -

i'm having hard time rcp aplication compiling maven using tycho. my feature.xml file contains dependency: <plugin id="org.eclipse.jface.nl_de" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/> when mvn clean install keep getting error message listed below. seams maven not know org.eclipse.jface.nl_de. any ideas how resolve this? i'm using eclipse kepler (4.3.2) , jdk 1.7 on win7 box. [info] cannot complete request. generating details. [info] cannot complete request. generating details. [info] {osgi.ws=win32, osgi.os=win32, osgi.arch=x86, org.eclipse.update.install.features=true} [error] cannot resolve project dependencies: [error] software being installed: com.company.mct.pw.client.feature.feature.group 8.0.0 [error] missing requirement: com.company.mct.pw.client.feature.feature.group 8.0.0 requires 'org.eclipse.jface.nl_d