Posts

Showing posts from May, 2010

objective c - Parse iOS Unit Testing a subclass of PFUser -

i'm trying unit test (with xctest) subclass of subclass of pfobject getting warnings such subclasses part of testing target: class mysubclassofsubclassofpfobject implemented in both /var/mobile/containers/bundle/application/84c7811f-348e-42ef-9ff4-f243db669591/myapp.app/myapp , /var/mobile/containers/data/application/a84479a8-1acd-4f7b-b02d-a28cb412cd14/tmp/myapptests.xctest/myapptests. 1 of 2 used. 1 undefined. i'm getting exception subclass of pfuser: *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'tried register both parseuser , parseuser native pfobject subclass of _user. cannot determine right class use because neither inherits other.' i've installed parse 1.12 via cocoapods , running xcode 7.2. my podfile looks this: target 'watchi' use_frameworks! pod 'parse' end target 'watchitests' end in test target build settings, i've added $(srcroot) user header search paths...

c# - Linq union two tables where on has an extra column -

i using union combine 2 tables audit , message . both have same column names except audit has column called deletedate . try use union merge both table if deletedate not exist, sets deletedate method null. commented out trying work. when uncomment code, error. there work around? here code var audit = in _audit.getall() .where(a => a.pint == pint && a.createdate < startdate && (enddate == null || enddate > a.createdate)) select new { a.mint, a.mid, a.desc, a.pstring, a.ptype, a.mtype, a.createdate, // a.deletedate, a.pint }; var message = in _message.getall() .where(a => a.partnerint == partn...

MySQL: group by hour AND by other distinct fields -

i have 'logs' table, in search results' counters stored, search query , user searched it. my goal display results grouped hour, i'm having issues when using group because i'm losing distinct users / queries in process. here's fiddle: http://sqlfiddle.com/#!9/484c01/7 as can see, results being count according results no. output not correct. in advance help. there data size limits on can returned following method, if want preserve distinct row values of non-grouped-by-columns when doing group by , can use group_concat mysql function combine each row's value 1 row separated commas. see http://dev.mysql.com/doc/refman/5.6/en/group-by-functions.html#function_group-concat usage examples. important: sure read documentation's note on group_concat_max_len , max_allowed_packet in link provided above.

entity framework - Convert String to Int in LINQ to Entities -

i trying duplicate following sql statement linq entities query (where "products" table mapped entity) ... note iqueryable ... of have seen posted solutions convert either search parameters , or dump results ienumerable , proceed convert there. dealing 100's of millions of records , cannot afford load 200 million records memory, have filter through them again. like, if possible in single query databse. select * products model_code = '65' , cast(serial_number int) > 927000 , cast(serial_number int) < 928000 i have tried following ... int startsn, endsn; startsn = 9500 endsn = 9500 if (!int.tryparse(startserialnumber, out startsn)) throw new invalidcastexception("the start serial number not valid value"); if (!int.tryparse(endserialnumber, out endsn)) throw new invalidcastexception("the end serial number not valid value"); iqueryable<product> resultlist = base.context.products.where(b => ...

android - How to set visibility of TextView? -

i want check! example - if (tv.visible == true) showmessage ("yee it's visible") else ("its not visible"); hope you're understand! you provide little information, think after... textview tv = (textview)findviewbyid(r.id.textview); tv.setvisibility(view.invisible); you need adjust id own. edit: can check see if textview invisible by: if (tv.getvisibility() == view.invisible) { // something. }

Jetty 9.3.6 + Spring: HTTPS automatically redirected to HTTP -

i don't know why https request automatically redirected http, , that's problem: the original request: remote address:127.0.1.1:7171 request url:https://w-rli09-ben:7171/main/app/test request method:get status code:302 found response headers: content-length:0 date:sat, 16 jan 2016 01:02:11 gmt location:http://w-rli09-ben:7171/main/login server:jetty(9.3.z-snapshot) the jetty + spring debug logs: 2016-01-15 16:58:58 debug o.e.j.s.session:347 - scavenging sessions @ 1452905938843 2016-01-15 16:58:58 debug o.e.j.i.managedselector:234 - selector loop woken select, 1/1 selected 2016-01-15 16:58:58 debug o.e.j.i.selectchannelendpoint:159 - onselected 1->0 r=true w=false selectchannelendpoint@33c50677{/127.0.0.1:56564<->7171,open,in,out,fi,-,14176/30000,sslconnection}{io=1/0,kio=1,kro=1} 2016-01-15 16:58:58 debug o.e.j.i.selectchannelendpoint:186 - task selectchannelendpoint@33c50677{/127.0.0.1:56564<->7171,open,in,out,fi,-,14176/30000,sslconnection}{io=1...

Android proguard error com.google.ads.util.i: and setMediaPlaybackRequiresUserGesture(boolean) -

i trying create apk file, when press finish on export dialog, got error, , apk not created. cannot find on net far, maybe here can help? error: proguard returned error code 1. see console warning: com.google.ads.util.i: can't find referenced method 'void setmediaplaybackrequiresusergesture(boolean)' in class android.webkit.websettings should check if need specify additional program jars. warning: there 1 unresolved references program class members. input classes appear inconsistent. may need recompile them , try again. alternatively, may have specify option '-dontskipnonpubliclibraryclassmembers'. java.io.ioexception: please correct above warnings first. @ proguard.initializer.execute(initializer.java:321) @ proguard.proguard.initialize(proguard.java:211) @ proguard.proguard.execute(proguard.java:86) @ proguard.proguard.main(proguard.java:492) i tried add -dontskipnonpubliclibraryclassmembers but...

java - Freemarker can't find JSP tld-s -

i creating project tomcat 7, spring 4.1.7 (with spring mvc) , freemarker 2.3.23. libs deployed under /web-inf/lib contains custom libs tlds under own /meta-inf/. but when freemarker scans <#assign a=jsptaglib["/web-inf/a.tld"]>, system complains can't find definition file. after debugging freemarker's taglibfacotry.java, found explicitly mapped tld location not working. means have put tlds directly under class path. tried copy on 1 tld /web-inf/, works. further investigation shows "servletcontext.getresourcepaths("/web-inf/lib")" returns null value. did miss configurations? or related compatibility problem since works fine jetty? thanks in advance. verify if deployment copying jars web-inf/lib. taglibfactory scans every jar inside there searching /meta-inf/**/*tlds. take @ https://stackoverflow.com/a/37092269/1113510

Using the matching class of isAssignableFrom() method in Java -

i have abstract class called pet lots of classes subclassing it. public abstract class animal { } public abstract class wildanimal extends animal { } public abstract class pet extends animal { public abstract void mynameis(); } public class dog extends pet { @override public void mynameis() { system.out.println("dog meat"); } public void bark() { system.out.println("woof"); } } public class cat extends pet { @override public void mynameis() { system.out.println("cheshire"); } public void purr() { system.out.println("purr"); } } // somewhere else in project ... list<animal> animals = new arraylist<animal>(); // lots of animals added by: animalmoves(animals); public void petmoves(list<animal> animals) { if (pet.class.isassignablefrom(animals.getclass())) { // dog, cat, mouse, etc. pet = (pet)pet; i want able call overridden my...

ios - Static Height Custom Cell ListView -

i having trouble working out static height (35) on custom cell row. keep getting overlapped list defined height when try bring down return height below 120 35. - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 120; } thanks in advance help.

javascript - Not working 'PImage' as Class Property in Processing.js -

what trying is, declare class has image it's property.then declaring object of class , call draw function.but it's not working....why? here processing.js part of .html page <script type="text/processing"> pimage starimage; void setup(){ size(400,400); smooth(); starimage = loadimage("star.png"); } var star = function(x,y) { this.x = x; this.y = y; this.img = starimage; }; star.prototype.drawstar = function(){ image(this.img,this.x,this.y,50,50); }; var obj = new star(50,50); draw = function(){ obj.drawstar(); }; </script> but if change "image(this.img,this.x,this.y,50,50);" "image(starimage,this.x,this.y,50,50);",it's works.that seems assignment of 'starimage' (pimage) in...

no matching function for call to sc_trace in systemc -

i using systemc simulation , got error message telling that g++ -i/opt/xilinx-14.2/vivado_hls/2012.2/linux_x86_64/tools/systemc/include/ -o testbench.exe testbench.cc -l/opt/xilinx-14.2/vivado_hls/2012.2/linux_x86_64/tools/systemc/lib -lsystemc -lm /opt/xilinx-14.2/vivado_hls/2012.2/linux_x86_64/tools/systemc/include/sysc/communication/sc_signal_ports.h: in member function void sc_core::sc_in::end_of_elaboration() [with t = std::basic_string, std::allocator >]: testbench.cc:126: instantiated here /opt/xilinx-14.2/vivado_hls/2012.2/linux_x86_64/tools/systemc/include/sysc/communication/sc_signal_ports.h:285: error: no matching function call sc_trace(sc_core::sc_trace_file*&, const std::basic_string, std::allocator >&, std::string&)̢۪ do guys have idea error , how fix it? #include "systemc.h" #include "multichipmodule.cc" #include <vector> #include <string> #include <iostream> int converttime(std::string input){ // ...

javascript - How to align elements center on resize? -

there position:inline-block; elements within wrapper, positioned absolutely. using text-align:center or margin:0 auto not working. here jsfiddle: jsfiddle.net/dralyuk/r7y7qucv/1/ var el = document.getelementsbyclassname('el');; function buildgallery() { (var = 0; < el.length; i++) { el[i].style.position = 'static'; el[i].style.top = el[i].offsettop + 'px'; el[i].style.left = el[i].offsetleft + 'px'; } (var = 0; < el.length; i++) { el[i].style.position = 'absolute'; } } buildgallery(); window.onresize = function() { buildgallery(); } .elswrap { font-size: 0; position: relative; } .el { font-size: 12px; height: 120px; width: 120px; margin: 5px; display: inline-block; vertical-align: top; -webkit-transition-duration: 1s; -moz-transition-duration: 1s; -ms-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; over...

python - Login returns extended model not the base model -

disclaimer: i'm 1 month python , django, , building first project budding programmer. desired functionality: new user opens app , registers username , password. taken profile page input series of things. submit it, , should linked user (creator) , profile (content). can see , edit page. current problem: when log in admin, can see profile information. when log in regular user, see information requested @ registration (username) user. not see profile information, although fields(empty) there. effectively, login taking me user not profile. i'm guessing have problems in models. should start on abstractuser model , use one-to-one extended profile model? think may have done backwards. thank you!! what see when: logged in user "bbasil": student name: preferred first name: email: bbasil@gobble.edu school name: short bio: interests: , , logged in "admin": student name: blanche camille basil preferred first name: betty email: b...

c# - Rich Domain Model Implementation -

i started reading rich domain model instead of anemic models. projects worked on before, followed service pattern. in new new project i'm trying implement rich domain model. 1 of issues i'm running trying decide behavior goes in (in class). consider example - public class order { int orderid; string ordername; list<items> orderitems; } public class item { int orderid; int itemid; string itemname; } so in example, have additem method in item class. before add item order, need make sure valid order id passed in. validation in additem method. on right track this? or need create validation in order class tells if orderid valid? wouldn't order have additem method? item added order, not other way around. public class order { int orderid; string ordername; list<items> orderitems; bool additem(item item) { //add item list } } in case, order valid, because has been created. of course, order doesn't ...

reactjs - Webpack style-loader modules are overriding installed component css -

i using react-super-select component in react/redux project i'm working on. that project uses webpack , style-loader load styling: const path = require('path'); const webpack = require('webpack'); const poststylus = require('poststylus'); module.exports = { entry: [ 'webpack-hot-middleware/client', './src/client/index', ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicpath: '/static/', }, plugins: [ new webpack.optimize.occurenceorderplugin(), new webpack.hotmodulereplacementplugin(), new webpack.noerrorsplugin(), ], module: { loaders: [{ test: /\.js$/, loaders: ['babel'], exclude: /node_modules/, }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=app...

c# - `Collection was modified; enumeration operation may not execute` error while reading data -

we have web-application , uses entity framework access data (db oracle). we've moved ef6 recently. use transactions in following way: we create transaction, have entitytransaction object , entityconnection object now. several concurrent requests done db. each request runs in own thread (actually requests come client). each request own objectcontext created using same entityconnection object. requests of transaction run in parallel partially, in given moment of time there few parallel running requests. and under these conditions strange error started occur: exception - collection modified; enumeration operation may not execute . it happens when data read or updated, , when connection property of entitytransaction accessed. the beginning of stack trace may vary, end same: system.invalidoperationexception: collection modified; enumeration operation may not execute. @ system.collections.generic.list 1.enumerator.movenextrare() @ system.linq.enumerabl...

javascript - onmouseover & onmouseleave functions not working properly -

i'm new site , relatively new web development. trying incorporate javascript webpage made html & css. webpage online store products , trying when has mouse on 1 of products, provide details such name of product , price , when move mouse out, go image of product. reason, code, change elements shows details won't change original image after mouse moves away. i've tried think of , goal of project make sure had understanding of javascript trying without jquery. advice appreciated. here code: //holds div elements class attribute "productlink" hold product images var products = document.getelementsbyclassname("productlink"); //when function called, product image changed show image of product, name , price //classnum - specifc class element being called //priceamount - price of product //describe - description/name of product function hoverdetails(classnum, priceamount, describe) { ...

session - Meteor & Semantic UI - How do I give some transition effect to specific template after modal pops up & click 'Approval' button? -

1. want : give transition effect semantic-ui template a(template 'card') after modal pops & user click 'approval' button. 2. did first : save template instance of template session, template instance using session.get(), , give transition effect in modal initializer inside of template b(template 'modalremove')`s onrendered function. 3. how did : template.card.events ({ "click #remove-item": function (event, template) { event.preventdefault(); session.set('removetemplate', template); // error session.set('removeitem',this); $('.ui.basic.modal').modal('show'); } }); template.modalremove.onrendered(function () { $('.ui.basic.modal') .modal({ closable : true, blurring : true, ondeny : function(){ return; }, ...

How would I import a module within an npm package subfolder with webpack? -

lets theres package in node_modules called foo , want import module within library such foo/module via webpack & babel... import foo 'foo'; works import someothermodule 'foo/module'; fails following: module not found: error: cannot resolve module 'foo/module' in /users/x/desktop/someproject/js which makes make seem webpack looking file in wrong place instead of node_modules my webpack.config looks this: var webpack = require('webpack'); var path = require('path'); module.exports = { entry: ['babel-polyfill','./js/script.js'], output: { path: __dirname, filename: './build/script.js' }, module: { loaders: [ { test: /\.js$/, loader: 'babel', query: { cachedirectory: true, presets: ['es2015'] } } ], }, ...

Combining Appended Values in PHP Function Output -

i have following php function "renders" output appended values: protected function getfieldrow($label, $value, $encode = true) { if (empty($value)) { return ''; } return foxhtmlelem::create()->append(foxhtmlelem::create('div')->classes('field-title')->text(jfilterinput::getinstance()->clean($label .= ":&nbsp;")))->append(foxhtmlelem::create('div')->classes('field-content')->html($encode ? nl2br(foxhtmlencoder::encode(jfilterinput::getinstance()->clean($value))) : $value))->render(); } which outputs list this: <div class="field-title">label : </div><div class="field-content">value</div> <div class="field-title">label : </div><div class="field-content">value</div> <div class="field-title">label : </div><div class="field-content">value...

python 2.7 - Plotting circle diagram with rotary arrow -

Image
this diagram clipped paper . http://i11.tietuku.com/e1c71d1b84b37a51.png i can plot circle , straight arrow, how plot rotary arrow in specific angle? you can draw circle , rotary arrow in matplotlib using sine/cosine, arc , arrow : import math matplotlib.patches import arc import matplotlib.pyplot plt ax = plt.axes() x0, y0 = 0.5, 0.5 radius = 0.4 angle = 135 angle_rad = angle * math.pi / 180 # degrees radians # draw circle circle = plt.circle((x0,y0), radius, color='red', fill=false) fig = plt.gcf() fig.gca().add_artist(circle) # draw radius arrow head_length = 0.05 ax.arrow(x0, y0, (radius - head_length) * math.cos(angle_rad), (radius - head_length) * math.sin(angle_rad), head_width=0.05, head_length=head_length, fc='k', ec='k') # draw arc arrow. arc_radius = radius / 4 arc = arc((x0, y0), arc_radius*2, arc_radius*2, # ellipse width , height theta1=0, theta2=angle, linestyle='dashed...

arrays - Equality of copy.copy and copy.deepcopy in python copy module -

i creating list of numpy arrays copying array keep original copy. copying done using deepcopy() function. when comparing 2 arrays now, showing false in equivalence. when using copy() function .i understand difference between copy , deepcopy function, shall equivalence not same? that is: grid1=np.empty([3,3],dtype=object) in xrange(3): j in xrange(3): grid1[i][j] = [i,np.random.uniform(-3.5,3.5,(3,3))] grid_init=[] grid_init=copy.deepcopy(grid1) grid1==grid_init #returns false grid_init=[] grid_init=copy.copy(grid1) grid1==grid_init #returns true grid_init=[] grid_init=copy.deepcopy(grid1) np.array_equal(grid1,grid_init) #returns false shall not true? i must running different version of numpy/python, different errors and/or results. still same issue applies - mixing arrays , lists can produce complicated results. make 2 copies in [217]: x=copy.copy(grid1) in [218]: y=copy.deepcopy(grid1) equality shallow copy, gives e...

What are "good" expected response times when processing large tables in MySQL remotely? -

as have never worked large data remotely have absolutely no idea "slow" , "fast" when processing large tables in remote server. say have table: 'create table `kardex` ( `kardexid` int(10) unsigned not null auto_increment, `codproduct` char(14) not null, `date` date not null, `reference` char(3) not null, `effect` char(1) not null, `priority` char(2) not null, `quantity` double(14,6) default null, `numdocument` char(8) default null, `serie` char(10) default null, `subsidiary` char(2) not null, `subsidiary2` char(2) default null, `quant_entry` double(14,6) default null, `cost_entry` decimal(12,2) default null, `quant_egress` double(14,6) default null, `cost_egress` decimal(12,2) default null, `quant_balance` double(14,6) default null, `cost_balance` decimal(12,2) default null, `cost_average` decimal(12,4) default null, `costentry` decimal(1...