Posts

Showing posts from April, 2014

php - mkdir() not working with this code for creating random directory name for upload photo -

// profile picture upload if (isset($_files['profilepic'])) { if ( ((@$_files["profilepic"]["type"]=="image/jpeg") || (@$_files["profilepic"]["type"]=="image/png") || (@$_files["profilepic"]["type"]=="image/gif")) && (@$_files["profilepic"]["size"] < 1048576) ) //1 megabyte { $chars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789"; $rand_dir_name = substr(str_shuffle($chars), 0, 15); mkdir("userdata/profile_pics/$rand_dir_name"); this directory files are: c:/xampp/htdocs/asweb and want keep new directory: c:/xampp/htdocs/asweb/userdata/profile_pics i tested following: $chars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789"; $rand_dir_name = substr(str_shuffle($chars), 0, 15); echo $rand_dir_name.$b; // ojtxnh

css - Rotate div whitouth breaking structure -

i'm trying keep rotated block align on top of remaining blocks in right side of window. fiddle: https://jsfiddle.net/8tbl6rqs/1/ <div class="side"> <div class="block-first">chat us</div> <div class="block">phone</div> <div class="block">mail</div> <div> .side { position:absolute; right:0px; margin-top:30%; } .block, .block-first { background: #f00; display: block; height: 50px; width:50px; text-align:center; line-height:50px; } .block-first { width:200px!important; transform: rotate(-90deg); } add following css .block-first : position:relative; top:-75px; left:-75px; here's updated fiddle .

php - trying to do registration to display in mysql -

hi im noob @ this, im doing simple project, does'nt need secure or anything im trying registration page , display information to php page looked @ many guides , still find confusing these codes this displaying table in php, working <?php mysql_connect('localhost','root',''); mysql_select_db('login'); $sql="select * registranttb"; $records=mysql_query($sql); ?> <table width="600" border="1" cellpadding="1" cellspacing="1"> <tr> <th>name</th> <th>course applied for</th> <th>email</th> <th>contact number</th> <th>registration date</th> <tr> <h1>course</h1> <?php while($registranttb=mysql_fetch_assoc($records)) { echo "<tr>"; echo "<td>".$registranttb['name']."</td>"; echo "<td>".$registran

rx java - RxJavaSchedulersHook not called when using Hystrix -

the rxjavaschedulershook gets used when use io, computation , newthread schedulers (see javadoc ). when creating observables using hystrixcommand however, rxjavaschedulershook never gets called. leads me believe may not using 1 of these 3 schedulers. there way have schedulershook executed observables created hystrix?

Python/Flask/LoginManager: TypeError: is_active() missing 1 required positional argument: 'self' -

i'm trying code simple login system using flask , loginmanager, keep getting error when logging in: typeerror: is_active() missing 1 required positional argument: 'self'. full error: http://i.imgur.com/wg7ntfu.png models.py: class user(db.model): id = db.column(db.integer, primary_key=true) username = db.column(db.string(64), index=true, unique=true) password = db.column(db.string(100), index=true, unique=true) email = db.column(db.string(120), index=true, unique=true) posts = db.relationship('post', backref='author', lazy='dynamic') def is_authenticated(self): return true def is_active(self): return true def is_anonymous(self): return false def get_id(self): return str(self.id) def __repr__(self): return '<user %r>' % (self.username) views.py: login_manager = loginmanager() login_manager.init_app(app) @login_manager.user_loader def user_

Sound(MediaPlayer) working on emulator but not on a real android device -

the emulator using galaxy nexus api 22, , background music(mp3) works on , running service. however, not work on sumsung galaxy note, has api 16, don't think api-related problem though. am need write some <uses-permission .../> in manifest? or other solutions. thank in advance!! here problem context context = getapplicationcontext(); activitymanager = (activitymanager) context.getsystemservice(context.activity_service); list<activitymanager.runningtaskinfo> taskinfo = am.getrunningtasks(1); if (!taskinfo.isempty()) { componentname topactivity = taskinfo.get(0).topactivity; if (!topactivity.getpackagename().equals(context.getpackagename())) { soundservice.pausesound(); toast.maketext(welcomepage.this, "you left app", toast.length_short).show(); } else { toast.maketext(welcomepage.this, "you switched activities within app", toast.length_short).show(); } } i used these code in onpause() in wel

ruby on rails - How to specify app_secret for a Koala object? -

in devise.rb config.omniauth :facebook, app_id, 'app_secret', :scope => 'email', info_fields: 'email, name, address, birthday, age_range, first_name, gender, hometown, location ' in user.rb (model) def facebook @facebook ||= koala::facebook::api.new(self.oauth_token) end the oauth token user object set , following called. user.facebook.get_object("me") this response {"name"=>"name", "id"=>"uid"} i not additional information address, email, image link etc, although, if user made sign in via omniauth-facebook, params. should do? it's because each user has things restricted or granted default, security settings. oauth, bumps user , says "if want access app, you'll need agree let have these permissions on account" -- user says ok , info need. users security settings let see other about-me info. so... simple answer use oauth login. ensure token gives

mysql - R reading data as factor values -

i imported .csv file r of columns seem being read factors (i think correct terminology). a little background: created file in mysql , exported there. columns being read factors ones not integer type columns in mysql. (varchar , decimals being read factors.) for varchar , decimal columns: > data$column_a[1] [1] 0.1186 1143 levels: 0.0000 0.0112 0.0127 0.0135 0.0139 0.0141 0.0145 0.0149 0.0152 ... null for integer columns: > data$column_b[1] [1] 177 i've never experienced before, , have no idea what's going on. how change they're read , column_a appear column_b does?

css - Responsive background photo -

Image
i have gone through forums , tutorials available , can't seem change background of photo, responsive if possible. here bit of css, i'm clueless on occasion. body { font-family: 'lato', calibri, arial, sans-serif; color: #47a3da; background: url(images/1.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } basically want add responsive photo this: http://tympanus.net/blueprints/nestedaccordion/ try : if images in image folder , css in css folder, need specify image path ../images-directory/imagename.jpg css body { font-family: 'lato', calibri, arial, sans-serif; color: #47a3da; /*-----double check path specified in css-----*/ background: url(images/1.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } y

database performance - Limit of labels on a node in Neo4j -

is there limit on number of labels can put on nodes in neo4j? ramifications of lots of labels on performance of inserts? thanks in theory number of labels unlimited (not sure think integer.max_value). in practice should have few labels reasonable on single node. first 4-5 (don't remember exact number) labels stored directly node. remaining labels stored in different location internally. reading node having more 4-5 labels might result in io operation. upon write operation every labels cause burden since labels self-indexing , therefore neo4j needs write labelscanstore label. most graphs i've seen far (and that's quire few ;-) ) don't have more 3 labels on single node.

ruby - Stubbing Time.now with RSpec -

i trying stub time.now in rspec follows: it "should set date current date" @time_now = time.now time.stub!(:now).and_return(@time_now) @thing.capture_item("description") expect(@thing.items[0].date_captured).to eq(@time_now) end i following error when doing so: failure/error: time.stub!(:now).and_return(@time_now) nomethoderror: undefined method `stub!' time:class any idea why happening? depending on version of rspec might want use newer syntax: allow(time).to receive(:now).and_return(@time_now) see rspec mocks 3.3

node.js - How to use npm module with Brunch -

i'm using brunch.io , i'm trying use npm module ( https://github.com/dylang/shortid in case) in client side. shortid says it's compatible browserify, tried many things including browserify module following command: browserify -r ./index.js:shortid > /project/vendor/shortid.js and use in application code: var shortid = require("shortid"); web page giving following error: typeerror: require.register not function typeerror: loaderpath.indexof not function

java - How to mute audio thread of another application or change max volume of another application? -

please, me solve next issue - how can access audio playback of application(s)? possible situation when 2 apps playing audio content, e.g. game , radio app. how access stream of 1 of them mute it? or maybe there way adjust volume setting of 1 of apps on fly. can't find in android sdk. in advance!

python - How to install prerequisites for running setup.py in setuptools? -

setuptools.setup offers install_requires argument. specified packages installed @ end of setup.py . seems there're other requirements sections ( tests_require , requirements ). didn't find info on latter because help(setuptools.setup) doesn't contain useful information it's arguments. checked source of distutils.distribution distutils/dist.py , doesn't contain useful documentation (one might - @ all). i know setuptools isn't self-bootstrapping (like e.g. maven). want make sure i'm not missing something. i can imagine straightforward workarounds installating pip , subprocress.* functions. i'm looking declarative solution. maybe need setup_requires parameter: building , distributing packages setuptools

c - GSL Polar Complex Numbers Appear to be extremely different -

using minunit.h test built-in gsl structs. i have written following test: static char * test_gsl_polar_complex_number_struct() { double r = 0.325784; double theta = 0.421329; gsl_complex test_polr_complex_number = gsl_complex_polar ( r, theta ); printf("expected r: %f, actual r: %f\n", r, gsl_real(test_polr_complex_number)); mu_assert("real part of polar complex number not match expected", gsl_real(test_polr_complex_number) == r); return 0; } i getting failing test following output: expected r: 0.325784, actual r: 0.297293 expected theta: 0.421329, actual theta: 0.133237 real part of polar complex number not match expected it of note exact same test executes without errors on rectangular complex struct. you have wrong expectations. function gsl_complex_polar() initializes complex number components given in polar complex form: this function returns complex number z = r \exp(i \theta) = r (\cos(\theta) + \sin(\theta))

Cassandra data modelling less then 1000 records to fit in one row -

we have entity uniquely identified generated uuid. need support find name query. need support sorting name. we know there no more 1000 of entities of type can fit in 1 row. viable idea hardcode primary key, use name clustering key , id clustering key there satisfy uniqueness. lets need school entity. here example: create table school ( constant text, name text, id uuid, description text, location text, primary key ((constant), name, id) ); initial state give me schools , filtering exact name happen. our reasoning behind place schools in single row fast access, have name clustering column filtering , have id clustering column guaranty uniqueness. can use constant = school known hardcoded value access row. what solution values in 1 row , fast reads. can solve sorting easy clustering column. not hardcoded value constant seams odd. use name pk have 1000 records spread across couple of partitions, find without name slower , not sorted. question 1 is viable sol

java - Parsing EventElement for XMPP using Smack Library -

can please show me on how parse event pub element , message object following packet. maybe keyword/search term googling not correct i'm not able find helpful while looking documentation or tutorial this. i have read packetparserutils , xmlpullparser , tried implement it, keep on getting null. code eventelement event = groupmessage.getextension("event", "http://jabber.org/protocol/pubsub#event"); try { xmlpullparser parser = packetparserutils.newxmppparser(); log.d(tag, "processstanza event: "+ event.toxml().tostring()); parser.setinput(new stringreader(event.toxml().tostring())); item items = (item) parser.getproperty("items"); log.d(tag, "processstanza: " + items); } catch (xmlpullparserexception e) { e.printstacktrace(); } <message to='+60174443333@crystal.domain.com/resource' from='9176d3d3-e893-4add-91a1-82b42338c223@group.crystal.domain.com'> <event xmlns=&#

Starting with Zend Tutorial - Zend_DB_Adapter throws Exception: "SQLSTATE[HY000] [2002] No such file or directory" -

i start learning zend framework book "zend framework in action" in german. right there start interesting php unit test throws error: "zend_db_adapter_exception: sqlstate[hy000] [2002] no such file or directory" i cant find hints @ google. did in book. can give me hint search fault? is usual beginner mistake? i have problem connecting php mysql... something php trying find socket file, , not finding it, maybe ? (i've had problem couple of times -- not sure error got one, though) if running linux-based system, there should my.cnf file somewhere, used configure mysql -- on ubuntu, it's in /etc/mysql/ . in file, there might : socket = /var/run/mysqld/mysqld.sock php need use same file -- and, depending on distribution, default file might not same 1 mysql uses. in case, adding these lines php.ini file might : mysql.default_socket = /var/run/mysqld/mysqld.sock mysqli.default_socket = /var/run/mysqld/mysqld.sock pdo_mysql.defaul

css - Display input text in Bootstrap radio-inline list -

i have radio-buttons in bootstrap 3.3.5 setup. if radio-button checked addional input field may filled. want place near radio button. way that? whether place in label or li - it's displayed break before , breaks inline display of radios. <ul class="list-inline"> <li> <label class="radio-inline"> <input type="radio" name="rdoinp" id="rdoinp1" value="1"> radio 1 </label> </li><li> <label class="radio-inline"> <input type="radio" name="rdoinp" id="rdoinp6" value="6"> radio 6 </label> </li><li> <label class="radio-inline"> <input type="radio" name="rdoinp" id="rdoinp7"

algorithm - Do multiple loops have same complexity as nested loops? -

this loop has complexity of o(n) for ($i=0; $i < $arrcount - 1; $i++) { } and 2 nested loops have complexity of o(n^2) for ($i=0; $i < $arrcount; $i++) { ($j=0; $j < $arrcount; $i++) { } } but if did 2 loops inside function , folowed each other, no nesting for ($i=0; $i < $arrcount; $i++) { } ($i=0; $i < $arrcount; $i++) { } would function still executed in o(n) ? yes. nested loops means outer loop execute inner 1 each iteration (of outer). means o(n^2) in case, because each i 0 n n operations. i = 0 => inner loop runs n iterations = 1 => inner loop runs n iterations ... = n - 1 => inner loop runs n iterations n iterations n times means n^2 total iterations, o(n^2) . your 2 loops without nesting each iterate n times, total of 2n times. big-oh ignores constants, 2n = o(n) . since not nested, number of times each 1 runs not depend on other. add number of iterations, not multiply them.

java - Why does volley encrypt my post-request without telling it so -

i trying login remote address uses https. use volley send post-request user data. this relevant code ( includes setting stringrequest -> fire stringrequest ): stringrequest mystringrequest = new stringrequest(request.method.post, remoteurl, this, this) { @override public map<string, string> getheaders() throws authfailureerror { map<string, string> headers = new hashmap<>(); headers.put("accept-charset","utf-8"); headers.put("connection","keep-alive"); headers.put("user-agent","mozilla/5.0 (x11; ubuntu; linux x86_64; rv:40.0) gecko/20100101 firefox/40.0"); headers.put("content-type","application/x-www-form-urlencoded"); return headers; } @override protected map<string, string> getparams() throws authfailureerror {

How to generate a values using random.gauss in python for the range 0, 50 -

i confused concept of random.gauss() in python, explained gauss function takes mean , standard deviation parameter. for instance if want generate random numbers in range 0-50 using gauss specifically, parameters. tried using mean , standard deviation of range 0-50. unfortunately not fetch me correct list. a gaussian distribution infinite, can't generate numbers guaranteed between 2 boundaries. can set median 25 , standard deviation make unlikely number fall outside 0 or 50, of course it's tradeoff: either lower/higher numbers won't anywhere close 0/50, or there plenty of outliers. in practice like: random.gauss(25, 25/3) and know 99.7% of results within 0 , 5 (+- 3 sigma mean). can avoid going out of bounds retrying if value above 50 or below 0, it's not gaussian anymore. may need though, enough approximation depending on you're trying model/simulate.

javascript - Updating data from Parse.com without re-login -

i have web app, manages budget user. in settings page, can edit budget, after clicking "save" return main page, , there have line states budget amount. problem is, when log in, see correct budget, after editing budget , returning main page, still see old amount. after logging out , re-login again, line in main page updates new amount. solutions? the code saves new budget: $("#savenewbudgetamount").click(function(){ var user = parse.user.extend("user"); var query = new parse.query(user); var newbudget = $("#newbudgetsum").val(); query.equalto("objectid", parse.user.current().id); query.first({ success: function (user) { user.save(null, { success: function (user) { user.set("budget", newbudget); user.save(); location ="mainpage.html"; } }); } }); });

javascript - How to account for scaling, translating, and rotating in canvas mouse clicks -

i'm working on app requires scaling (by way of style.width , not scale(...) ), translating ( translate(x, y) ) , rotating (e.g. rotate(90deg) ) canvas element. need calculate proper mouse click positions on canvas. is, need make ends of lines appear user clicked. right now, when try incorporate translation, calculations come out off little bit, can see when clicking twice in demo canvas below. part of confuses me order should untranslating, unrotating, , unscaling in produce correct result. demo code: var canvas = document.getelementbyid("canvas"); var scalex = 0.5; var scaley = 0.5; var rot = 1; var dispwidth = (canvas.width * scalex); var dispheight = (canvas.height * scaley); var xlatex = math.floor((dispheight - dispwidth) / 2); var xlatey = math.floor((dispwidth - dispheight) / 2); var transform = "translate(" + xlatex + "px, " + xlatey + "px) rotate(" + (rot * 90) + "deg)"; canvas.style.width = dispw

ios - Cannot invoke 'append' with an argument list of type'(String)' in my firstViewController -

firstviewcontroller. problem is. in 'for loop' giving me error. have tried use xcode suggested, isn't working. still consider myself beginner swift. looked @ other answers when people have posted same question , still can't solve problem. import uikit var todoitems:[string] = [] class firstviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet var taskstable:uitableview? override func viewdidload() { super.viewdidload() } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return todoitems.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell = uitableviewcell(style: uitableviewcellstyle.default, reuseidentifier: "cell") cell.textlabel?.text = todoitems[indexpath.row] return cell } override func didreceivememorywarning() { su

ios - keyboard is shown and the predictive text box on the top of the keyboard is toggled the view shoots up leaving a user with a black screen -

i have bug when keyboard shown , predictive text box on top of keyboard toggled view shoots leaving user black screen. reason happens because i'm using -= operator, compounds value every time method called. method can called multiple times in row. i'm trying find way handle this. func getkeyboardheight(notification: nsnotification) -> cgfloat { let userinfo = notification.userinfo let keyboardsize = userinfo![uikeyboardframeenduserinfokey] as! nsvalue return keyboardsize.cgrectvalue().height } func keyboardwillshow(notification: nsnotification) { if bottomtextfield.isfirstresponder() { self.view.frame.origin.y -= getkeyboardheight(notification) } } func keyboardwillhide(notification: nsnotification) { if bottomtextfield.isfirstresponder() { self.view.frame.origin.y += getkeyboardheight(notification) } } by switching self.view.frame.origin.y -= getkeyboardheight(notification) view.frame.origin.y = -getkeyboard

c++ - Looping over an array in RapidJson and getting the object elements -

how value out of constrvalueiterator? in case know elements of array dictionaries (aka objects). code summed up: for (rapidjson::value::constvalueiterator itr = rawbuttons.begin(); itr != rawbuttons.end(); ++itr) { // ok if (itr->hasmember("yes")) { // ok auto somestring = itr["yes"]->getstring(); // error } } um. iterators need dereferenced or whatever it's called. for (rapidjson::value::constvalueiterator itr = rawbuttons.begin(); itr != rawbuttons.end(); ++itr) { // ok if (itr->hasmember("yes")) { // ok auto somestring = (*itr)["yes"]->getstring(); // bingo } }

python 2.7 - Scrapy - not retuning data -

i new scrapy , trying extract tweets https://twitter.com/abctv . know there api , learning exercise. code returns 0 tweets. item definition: import scrapy class tweet(scrapy.item): username = scrapy.field() data = scrapy.field() created_at= scrapy.field() retweet_count = scrapy.field() my crawler definition: class twitterspider(scrapy.spider): name = "twitter" allowed_domains = ["https://twitter.com/mycpl"] start_urls = ["https://twitter.com/mycpl"] def parse(self, response): sel=selector(response) tweets=sel.xpath('//div[@class="content"]') items = [] tweet in tweets: item = tweet() item['username']=tweet.xpath('.//*[starts-with(@class,"username")]//text()').extract() item['created_at']=tweet.xpath('.//*[starts-with(@class,"_timestamp")]//@data-time-ms').extract() item['r

redis - How to maintain strong consistency in distributed computing? -

for example have master(m) , slave1(s1) , slave2(s2). if synchronous replication below, update master, , lock write replicate slave1 , slave2 unlock write of master. but above not strong consistency. scenario 1, when both replicates s1 , s2 successful, the users reading slave1 or slave2 can different values @ moment. scenario 2, replicate s1 successful, replicate s2 fails. in case, master should cancel write s1. users may read it. so it's hard maintain strong consistency. therefore, algorithms companies use maintain strong consistency if it's necessary? how make eventual write value visible clients @ exact same time ? thanks. putting things in simplest form; there 2 ways provide consistency first take lock before writing database or caching system. ensures read , write lock. includes master server well. to further enhance locking mechanism, distribution of keys maintained such reads re-directed towards consistent server(s) (if new

ruby on rails - How to replace a div tag in my view using Ajax -

i want replace div tag on images index page using ajax. right now, have following: _sub.html.erb <% @group.images.each |image| %> <%= image_tag image.pic.url(:medium) %> <%= button_to '+1', image_upvote_path(image), remote: true, method: :post %> <% end %> index.html.erb <div id="next_group"> <%= render 'sub' %> </div> upvote.js.erb $("#next_group").empty(); $("#next_group").append("<%= j render 'sub' %>"); in images_controller def index @group = group.offset(rand(group.count)).first end def upvote @image = image.find(params[:image_id]) @image.votes.create respond_to |format| format.html { redirect_to groups_path } format.js end end and in routes, have image_upvote post /images/:image_id/upvote(.:format) images#upvote my understanding of going on: on index page have div container renders sub

c# - How to change the cell template in each row of mvc kendo grid -

i'm developing application using kendo ui mvc , want able change template of cell don't know how implement using kendo grid. need change cell template in each row according value, if 'string' need display text box, if date value cell template become date picker.please me find solution. you can using editortemplates (views\shared\editortemplates\ folder), partial views types want. default editor templates created, when use telerik.asp net mvc application template new project. can specify required view via uihint("viewname") attribute.

javascript - Trying to link to specific page within angularjs app -

i'm using api requires me pass in url part of callback after authenticates user, knows send them part of flow. i know if happening on front-end somehow use $location feature angular provides, callback url must specified on node.js server in code below. have linking github url make sure getting executed, need link content.html page on localhost:8887 . know it'd localhost:8887/content.html if weren't using angularjs , don't know using angular. router.post('/add', function(req, res){ var emailadd = req.body.text; ctxioclient.accounts(id).connect_tokens().post({callback_url: "https://github.com/ralphie9224", email: emailadd}, function(err, response){ res.set("content-type", "application/json"); res.header("access-control-allow-origin", "*"); res.send(response.body); console.log("this post response: " + response.body); }); });

performance - Execute bulk find queries with sorting and limit mongo -

i have documents contain category field , want take top 10 documents each category based on popularity, seniority , rise in popularity. plan on using votes field within document determine popularity, _id field seniority , votesperday field determine rising in popularity. there total of 12 categories. typical documents this. { name : 'alpaca', category : 'blue', votes : 500, _id : object.id, votesperday : 50 } { name : 'muon', category : 'green', votes : 100, _id : object.id, votesperday : 20 } i have object needs store categories , within each category store popular, newest , rising in popularity. object refreshed every 24 hours. where running trouble whenever want query mongo 12 different categories. i have tried have loop run 3 queries each category , store results once arrive fails since seems on loading mongo server , crashes. the architecture of object trying build this. var myobj = {category1 : {

php - Forbidden You don't have permission to access / on this server. Server unable to read htaccess file, denying access to be safe -

right i'm getting message in single site of whole reseller account: forbidden you don't have permission access / on server. server unable read htaccess file, denying access safe additionally, 403 forbidden error encountered while trying use errordocument handle request. it happened of sudden. tried renaming root htaccess else, , error still there, tried setting 744 permissions file, still same thing. file using default files permissions, 644. error ocuring at: http://lucrebem.com.br you need add <directory block apache config <directory "/path/to/source/file/directory/www"> options indexes followsymlinks allowoverride require granted </directory> this grants required permission

showing array by group on php is not working as expected -

i want straight forward. it html form have created touch of javascript. has option increase/delete table (i didn't attached code here- wanted make sure know in case. ). here in example using 3 rows. <tbody> <tr> <td><input class="case" type="checkbox"/></td> <td><input type="text" data-type="productcode" name="itemno[]" id="itemno_1" class="form-control autocomplete_txt" autocomplete="off" placeholder="enter imei number"></td> <td><input type="text" data-type="productname" name="itemname[]" id="itemname_1" class="form-control autocomplete_txt" autocomplete="off" placeholder="brand"></td> <td><input type="text" data-type="productname" name="brand[]" id="itemname_2" class="form-contr

assembly - What exactly is an Object code after a compiled state? -

i know object code code after compilation phase present in object file(eg:aaa.obj). file? contains machine instructions? if why can't see 0's , 1's in file. please me out. what's object file in c? an object file real output compilation phase. it's machine code, has info allows linker see symbols in symbols requires in order work. (for reference, "symbols" names of global objects, functions, etc.) a linker takes these object files , combines them form 1 executable (assuming can, ie: there aren't duplicate or undefined symbols). lot of compilers (read: run linker on own) if don't tell them "just compile" using command-line options. (-c common "just compile; don't link" option.) if why can't see 0's , 1's in file. you confusing object file concept executable file concept. thing object file contains compiled code , instructions linker (program building 1 executabl

oop - Why is it wrong to supply type parameter in the constructor of a generic class (Java)? -

i'm learning generics in java textbook, talks class genericstack<e> implemented arraylist<e> . since in order create stack of strings, use genericstack<string> = new genericstack<string>() or genericstack<string> new genericstack<>() therefore shouldn't constructor of genericstack defined public genericstack<e>() , or public genericstack<>() ? answer no. should defined public genericstack() . why this? constructor can infer type class declaration, given verbosity of java, i'm bit befuddled why <e> or <> formalism gotten rid of here. there 2 parts this: the generic type parameter given class definition available within class itself. you can have generic types specific individual methods (including constructor). look @ following example: package snippet; import java.util.arraylist; public class y<e> extends arraylist<e> { public <t> y(t t) { } } whe

Python audio signal classification MFCC features neural network -

Image
i trying classify audio signals speech emotions. purpose extracting mfcc features of audio signal , feed them simple neural network (feedforwardnetwork trained backproptrainer pybrain). unfortunately results bad. 5 classes network seems come same class result. i have 5 classes of emotions , around 7000 labeled audio files, divide 80% of each class used train network , 20% test network. the idea use small windows , extract mfcc features generate lot of training examples. in evaluation windows 1 file evaluated , majority vote decides prediction label. training examples per class: {0: 81310, 1: 60809, 2: 58262, 3: 105907, 4: 73182} example of scaled mfcc features: [ -6.03465056e-01 8.28665733e-01 -7.25728303e-01 2.88611116e-05 1.18677218e-02 -1.65316583e-01 5.67322809e-01 -4.92335095e-01 3.29816126e-01 -2.52946780e-01 -2.26147779e-01 5.27210979e-01 -7.36851560e-01] layers________________________: 13 20 5 (also tried 13 50 5 , 13 100 5) learning rate_______

javascript - What is the value of a blank line in a textarea? -

i'm writing function check value of each line in textarea , output results in textarea. my problem don't know value of blank line in text area, i've tried "", /\w/, undefined, , null, , none of seem work. have right now: function check(){ var textareavalue= $("textarea#mincheck").val(); var valuearray= $("textarea#mincheck").val().split("\n"); var parsedarray=[]; for(i=0; i<valuearray.length;i++){ if(valuearray[i]==/\w/){ parsedarray.push(valuearray[i] + "|blank"); }else if(valuearray[i]>=0 && valuearray[i]<=999){ parsedarray.push(valuearray[i] + "|" + "brand1"); }else if(valuearray[i]>=1000 && valuearray[i]<=1999){ parsedarray.push(valuearray[i] + "|" + "brand2"); }else if(val

jena - SPARQL query relates records like one-many -

i have type of model(schema) 1 product hasoffer (many) offers 1 offer hserule (many) shipment rules like product(1)--->offer(n)----->rules(m) how can query 1 product offers , shipping rules. in simple words. how can query one-many related records ? this can achieved using simple sparql query multiple triples in clause. works because graph model on sparql queries naturally joins data together. eg. select ?product ?offer ?rules { {?product ns:hasoffer ?offer} {?offer ns:hasrules ?rules} } source: running same example in protege query. edit: question: there way construct product{ offers:{ rules:{} }, productattributes } ? answer: yes there is, can add ?attribute select clause triple ?product ns:productattribute ?attribute where clause (or multiple such clauses if have attributes across multiple data properties). recommend refrain doing so. query going return potentially large set of data similar sql result set. going see multiple rows same pro

Chrome extension inline install not working in verified IP site -

i have verified ip (not domain) using webmasters tool , verified. i have added <link> , called chrome.webstore.install() , getting error: inline installs can initiated chrome web store items have 1 or more verified sites. i think should call chrome.webstore.install() subdomain or page. calling page (index.html) url ip.(like http://52.1.165.721/#/home ) (angular ui routing , index default page.) my questions are: 1.i didn't have domain yet. problem? 2.i have install extension home page itself. got websites (eg: https://adblockplus.org/ ) examples. don't know how that. please help. i went through how test inline installation of chromium/chrome extensions locally? , chrome inline install extension not working , chrome.webstore.install(); not working on verified site so xan said added website link , didn't fill verify official item website own: because domain not listing there. the problem uploaded extension using work account , verif

c# - Cardboard, Only Rotate main camera with Unity 5 -

i start work google cardboard , unity 5 , have scene, when build apk , run android realzed when around camera seems move little, want around in camera animation, movement can see through floor , other errors, want take tour of room. i modify cardboardhead removing condition doesn't work if (trackposition) { vector3 pos = cardboard.sdk.headpose.position; if (target == null) { transform.localposition = pos; } else { transform.position = target.position + target.rotation * pos; } } do guys know c# file have modify, thank lot! there value called "neckmodelscale" in cardboard settings on cardboardmain. set 0 rid of neck model.

matlab - How does rowfun know to reference variables inside a table -

from documentation , see following example: g = gallery('integerdata',3,[15,1],1); x = gallery('uniformdata',[15,1],9); y = gallery('uniformdata',[15,1],2); = table(g,x,y) func = @(x, y) (x - y); b = rowfun(func,a,... 'groupingvariable','g',... 'outputvariablename','meandiff') when function func applied a in rowfun how know there variables in a called x , y ? edit : feel last statement must not true, not same result if did a = table(g, y, x) . i still confused how rowfun can use function not use variables defined within calling environment. unless specify rows (and order) name/value argument inputvariables , matlab take column 1 first input, column 2 second input etc, ignoring eventual grouping columns. consequently, better readability , maintainability of code, consider practice specify inputvariables explicitly.

smtp - Send Email through c# in asp.net -

this question has answer here: sending email in .net through gmail 21 answers below code of sending email mail getting error please ! error: email not sent!system.net.mail.smtpexception: operation has timed out. @ system.net.mail.smtpclient.send(mailmessage message) @ _default.button1_click(object sender, eventargs e) try{ mailmessage mailmessage = new mailmessage(); mailmessage.to.add(textbox3.text); mailmessage.from=new mailaddress("sadiazar05@gmail.com"); mailmessage.subject = "user signup"; mailmessage.body = "hello you're registered!"; smtpclient smtpclient = new smtpclient("smtp.gmail.com",465); mailmessage.priority = mailpriority.high; smtpclient.timeout = 60000; smtpclient.send(mailmessage); response.write("email sent

r - how to add the third legend in ggplot graph -

the problem want add multiple legend different layer of layoutkaryogram function in ggbio plot. library(genomicranges) library(ggbio) df<-data.frame(chromosome=c(9,9,9,9,9,9),start=c(12229,12244,12245,12248,19576961,19792417) ,end=c(12229,12244,12245,12248,19576961,19792417),sample1=c("kdnl","ct","ir","ir","dh","dh"), marker=c('snp',"snp",'snp',"snp",'ssr',"ssr")) myideo<-data.frame(chromosome=9,start=1,end=21757032) then change granges object > dfgr granges object 6 ranges , 2 metadata columns: seqnames ranges strand | sample marker <rle> <iranges> <rle> | <factor> <factor> [1] 9 [ 12229, 12229] * | kdnl snp [2] 9 [ 12244, 12244] * | ct snp [3] 9 [ 12245, 12245] * | dh s

css - iOS 9 HTML DOM with position: relative drifts away (floats) from its given position -

there 2 distinctive dom structures in page. main content , footer. css: .footer{ height: 65px; width: 100%; z-index: 999; position: fixed; } .maincontent{ width: 100%; height: 705px; position: relative; } these 2 inside media query of max width of 1024px. the problem while dragging main content main content floats gesture. what expected main content should in same place. happens in ios 9 , not in ios 8 or 7!!

nginx - Open bucket error with PHP Couchbase client -

i have couchbase 3.0.1 installtion on 64bit centos vps. have installed nginx server php-fpm. have installed c sdk , php sdk. when want open bucket, return 'generic network failure' error. my code is: <?php $mycluster = new couchbasecluster('couchbase://localhost'); $mybucket = $mycluster->openbucket('messenger','password'); ?> stack trace: 0 [couchbasenative]/couchbasebucket.class.php(74): _couchbasebucket->__construct('couchbase://loc...', 'messenger', 'password') 1 [couchbasenative]/couchbasecluster.class.php(61): couchbasebucket->__construct('couchbase://loc...', 'messenger', 'password') 2 /usr/share/nginx/html/cb.php(5): couchbasecluster->openbucket('messenger', 'password') 3 {main} thrown in [couchbasenative]/couchbasebucket.class.php on line 74

PHP get words with length longer than 3 from string -

is there function can cut words string small length e.g. "the, and, you, me, or" these short words common in sentences. want use function fill fulltext search criteria before method: $fulltext = "there ongoing work on creating formal php specification."; outcome: $fulltext_method_solution = "there ongoing work creating formal specification." $fulltext = "there ongoing work on creating formal php specification."; $words = array_filter(explode(' ', $fulltext), function($val){ return strlen($val) > 3; // filter words having length > 3 in array }); $fulltext_method_solution = implode(' ', $words); // join words sentence

Grouping and ungrouping a specified range with excel VBA -

i have range of cells (a60 y70) . group , ungroup columns of these cells way broad , complexed view. possible ungroup , group specified range use of vba. there many more ranges of such function useful me! thank you:) you can use group function: range("a60", "y70").group or ungroup them: range("a60", "y70").ungroup

android - Is ACCESS_COARSE_LOCATION necessary if the user has already granted ACCESS_FINE_LOCATION? -

i updating app work new android marshmallow permission framework , looks it's enough user grant access_fine_location permission @ runtime app work fine. do: public static final string[] runtimepermissions = { permission.access_fine_location }; public static final int location_permission_identifier = 1; and further down class: public static boolean checkconnectionpermission(final context context) { if (build.version.sdk_int > build.version_codes.lollipop_mr1) { if (context.checkselfpermission(permission.access_fine_location) == packagemanager.permission_granted) { return true; } else { ((activity) context).requestpermissions(runtimepermissions, location_permission_identifier); return false; } } // since in api levels below m permission granted on // installation, // considered given permission has been gr

validation - on action error message not showing on same page -

i have insert , view on same page. problem error message not showing <action name="viewallcostings" class="volo.tms.costings.costings" method="viewallcostings"> <result name="success">/costings/costings.jsp</result> </action> <action name="addcosting" class="volo.tms.costings.costings"> <result name="input">/costings/costings.jsp</result> <result name="success" type="chain">viewallcostings</result> <result name="error" >/costings/costings.jsp</result> </action> and costings.jsp <s:actionerror/> <s:form action="addcosting" method="post"> <s:textfield label="costing type" name="costtype" required="true"/> <s:textfield label="cost(rs.)" name="costrs" required="true&quo

sql - Ignored characters in Where-Clause? -

i have following problem: i try select below 'g-' seems ignores - , selects g , below. select * tablea columna > 'g-' order columna if use > 'g-t' ignores '-' totally, giving me things 'gt...' the sorting value of '-' lower 1 't' 'g-' lower 'gt' . so select * tablea columna > 'g-' order columna will return 'gt' , but select * tablea columna < 'g-' order columna won't. '-' not ignored, it's lower 't' . of course, same goes if try using columna > 'g-t' , same reasons. if want select starts 'g-' , use like : select * tablea columna 'g-%' order columna see this fiddle showing results.

Jmeter - Test for login/logout of a wordpress site - Failing for logout -

it turns out every login there new nonce value generated. i having hard time finding how dynamic value upon successful login , use in url parameter logout. %site_url%/logout/?_wpnonce= in jmeter. if don't pass parameter 403 webserver. protection csrf attacks. any input appreciated. thank you. this quite common situation. check answers how parse jmeter response , make new request question or try smartmeter's automatic correlation feature . works same fits better scenarios when need use token multiple times.

java - Spring-Data-Mongodb depedencies not picked by Play-Framework 2.4 -

i using play-framework 2.4 spring-data-mongodb. when compile project compile throw error: [error] /home/james/play-spring-data-mongodb/app/configuration/springdatamongoconfiguration.java:10: package org.springframework.data.mongodb.config not exist [error] org.springframework.data.mongodb.config.abstractmongoconfiguration [error] /home/james/play-spring-data-mongodb/app/configuration/springdatamongoconfiguration.java:11: package org.springframework.data.mongodb.repository.config not exist [error] org.springframework.data.mongodb.repository.config.enablemongorepositories [error] /home/james/play-spring-data-mongodb/app/configuration/springdatamongoconfiguration.java:25: cannot find symbol [error] symbol: class abstractmongoconfiguration [error] abstractmongoconfiguration [error] /home/james/play-spring-data-mongodb/app/configuration/springdatamongoconfiguration.java:24: cannot find symbol [error] symbol: class enablemongorepositories [error] enablemongorepositories the main

javascript - How to add characters before and after h2 innerhtml -

i've scoured ways this, i'm missing obvious, , sorry. i'm trying add 2 characters h2 element. have done, if more 1 h2 first 1 copied. unique innerhtml of each h2 have these characters added before , after. i aware css have before , after on element doing other things. $(window).on("load", function() { // on page load, add greater , less signs h2s var regh2 = $('h2').html(); $('h2').html( '&#60;' + regh2 + '&#62;' ); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <h2>header1</h2> <h2>header2</h2> try this $('h2').each(function(){ var regh2 = $(this).html(); $(this).html( '&#60;' + regh2 + '&#62;' ); });