Posts

Showing posts from 2015

verilog - Systemverilog dynamic casting issues -

i've code snippet following in testbench function void write_to_port( my_data_type_base data ); my_data_type_extended data_ext; if(!$cast(data_ext, data)); `uvm_error(get_type_name(), "failed cast"); `uvm_info(get_name(), $psprintf("data_ext :\n%s", data_ext.sprint()), uvm_medium) // write data_ext out port.... endfunction when run it, i'm getting uvm_error "failed cast." i'm not quire sure why $cast not returning 1. can see, i'm printing out extended class data item after casting uvm_info. can see it's being cast properly. if don't use $cast if condition, don't runtime error. isn't coding practice use if dynamic cast check if $cast returning 1 ? what might reason behind cast not returning 1 in above case? i think semicolon on line 'if' not belong? i think consumes if statement, , uvm_error executes regardless of how if evaluates: if(!$cast(data_ext, data)); <- no semico

c# - GameObjects vibrate when in contact with terrain. -

first rather know why happening fix. knowing allow me learn while cut , paste code won't. (an alternative fix nice , thank baffles me , want know why). set up: have primitive shape go (gameobject) spawn above terrain. go has rigid body , attach script it. seed.cs class inherits several functions class called body. once spawned go falls , comes contact terrain , problems happen. go can either go through terrain, stuck half inside, falls stuck , thrown out of ground, or if fall slow enough continuously vibrate. i have tried changing collision detection 3 different types prior running scene on go had little affect. found did work while scene running change collision detection 1 option , problem seems disappear. can throw change in start function of body class , works fine. actual options collision detection irrelevant fixing problem requires change it. continuous discrete or discrete continuousdynamic fact change makes problem go away. i'm hoping has idea why is. scale

python - Setuptools include script in source package -

i'm using setuptool make python packages, , want scripts included in source packages generated i.e. ez_setup.py install setuptools if not installed. i can find how include files in distribution, don't want files want include required running setup.py python install/build package. how can set them included in source packages, , not installed on users system. i found solution, problem lot of documentation poorly worded manifest applies source packages , hence files listed in manifest.in added manifest, , included in source package . see https://docs.python.org/2/distutils/sourcedist.html , setup tools fork of distutils. p.s. don't worry of setup tools documentation makes sound adds files egg manifest doesn't, source distribution affected.

django - tortoisehg ignore file is not ignoring *.pyc and *.db files -

i have ignore file: syntax: glob *.pyc *.db mysite/app/migrations/** it ignoring migration files not pyc , db files. why this? the usual answer have run hg add on .pyc , .db files. try running $ hg locate "set:hgignore() , not ignored()" to see tracked files match .hgignore patterns. use $ hg forget "set:hgignore() , not ignored()" to make mercurial forget them.

wpf - DbSet.Load() method is too slow -

i have sqlite database, contains 1 table named "main". each record of table contains 2 fields: id (integer, primary key) , name (string). there 100 records in database. using entity framework power tools i've created code first model existing database. model rather simple: // mainmap.cs public class mainmap : entitytypeconfiguration<main> { public mainmap() { // primary key this.haskey(t => t.id); // properties this.property(t => t.name) .isrequired() .hasmaxlength(50); // table & column mappings this.totable("main"); this.property(t => t.id).hascolumnname("id"); this.property(t => t.name).hascolumnname("name"); } } // main.cs public partial class main { public long id { get; set; } public string name { get; set; } } // maincontext.cs public partial class maincontext : dbcontext { static maincontex

What kind of memory protections does Mac OSX 10.9 have compared to others? -

i have small project work on in free time runs 32- , 64-bit assembler code managed .net assemblies based on operating system on. can see techniques use shell code run in template, pretty basic stuff. https://github.com/brandonprry/metafang2/blob/master/metasploitpayloadutility/generaltemplate.txt the methods work on windows , linux fine, expected unix way of executing code work on mac , doesn't. selinux enabled (and sure other pax , grsec), not achieve execution. totally expected though. my question is, mac protect memory? have similar mechanisms selinux? on slight tangent, if does, looking implement similar code @ bottom of page circumvent selinux , see if worked on mac well. http://www.akkadia.org/drepper/selinux-mem.html

file - How HTTP downloads are segmented inside TCP packets? -

Image
i'm trying figure out how http server encoding/spliting file during http download. when i'm using wireshark can find 4 http headers (see below) , bunch of tcp packets without headers. know how tcp packets formed , if can retrieve concrete data them (like name of file, id or substantial). first header : get /upload/toto.test http/1.1 host: 192.168.223.167:90 connection: keep-alive accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.114 safari/537.36 accept-encoding: gzip,deflate,sdch accept-language: fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4 range: bytes=3821-3821 if-range: "40248-5800428-4fab43ec800ce" second header : http/1.1 206 partial content date: sat, 31 may 2014 21:25:31 gmt server: apache/2.2.22 (debian) last-modified: sat, 31 may 2014 15:59:21 gmt etag: "40248-5800428-4fab43ec800ce" accept-ranges: bytes content-le

python - Building paragraph tag in beautifulsoup -

i want add paragraph soup. paragraph should - <p class="test-class"><strong>test message</strong></p> i have working code this. paragraphtag = soup.new_tag('p') paragraphtag['class'] = 'test-class' strongtag = soup.new_tag('strong') strongtag.append('test message') paragraphtag.append(strongtag) paragraph.insert_before(paragraphtag) note insert_before purposely done since part of bigger code need insert_before. my question - there better way this? or there smaller piece of code can write achieve this? please note tried putting in 1 string , added paragraph. when used find_all search p tags newly added p tag getting skipped. guess did not added. any input appreciated. thanks you build snippet html in new beautifulsoup() object: html = '<p class="test-class"><strong>test message</strong></p>' snippet = beautifulsoup(html).p.extract() paragraph.

java - Apache Camel SEDA exception handling -

using apache camel, need perform xsd validation on xml files contained within zip files, exceptions resulting in zip file being shifted error folder. the following (simplified) route works well * : from("file:/my/path&movefailed=../error").split(new zipsplitter()). streaming().filter(header(exchange.file_name).endswith(".xml")). bean(mycustomvalidator.class).to("validator:schemas/my/schema.xsd").end(); in order improve efficiency, have tweaked use seda zip content checks: from("file:/my/path&movefailed=../error").split(new zipsplitter()). streaming().filter(header(exchange.file_name).endswith(".xml")). to("seda:validateevents"); from("seda:validateevents?concurrentconsumers=20").bean(myvalidator.class). to("validator:schemas/my/schema.xsd").end(); however, movefailed parameter isn't being honoured file component. if add explicit onexception() , attemp

c# - AES Encryption between .NET WinRT and iOS Obj-C isn't the same -

i'm having hard time getting ios aes encryption/decryption same 1 have on winrt. i can't change implementation on winrt side since it's used in published app. here 2 sampls made zeroed key , zeroed iv, outputs differents. c# sample code : using (memorystream savedatamemorystreamcrypto = new memorystream()) { var savedatakeyprovider = windows.security.cryptography.core.symmetrickeyalgorithmprovider.openalgorithm(windows.security.cryptography.core.symmetricalgorithmnames.aescbcpkcs7); var savedatakeybuffer = windows.security.cryptography.cryptographicbuffer.createfrombytearray(new byte[32]); var savedatakey = savedatakeyprovider.createsymmetrickey(savedatakeybuffer); var savedatasaltbuffer = windows.security.cryptography.cryptographicbuffer.createfrombytearray(new byte[32]); var savedatadatabuffer = windows.security.cryptography.cryptographicbuffer.convertstringtobinary("abcdefgh", windows.security.cryptography.binarystringencoding.u

python - Django: how to transfer scattered data to a template? -

introduction in django, when data want display on template included in 1 object, it's f**** easy. sum steps (that knows actually): you write right method object in model class you call method in view, passing result template you iterate on result in template for loop, display objects in table, example. now, let's take more complex situation let's data want display spread on different objects of different classes. need call many methods these data. once call these different methods, got different variables (unsimilar objects, integers, list of strings, etc.) nevertheless, still want pass template , display pretty table in end. the problem is: if you're passing raw objects containing data need template, unorganised , can't iterate on variables in clean way need display table. the question is: how (which structure) , (models? views?) should organize complex data before passing template? my idea on this (which can totally wrong): for

excel - Change PivotTable data source without validating the connection -

i've developing solution client includes excel template pivottable. pivottable's data source query against sql server. before send template client, i'd change connection string reference client's sql server instead of local server. problem is, connection string doesn't work on computer, excel throws error when try edit connection , won't save new connection string. what's frustrating somehow did week ago, can't remember how. have version of spreadsheet created external connection string. unfortunately, had make change query, , trying make change existing spreadsheet results in same problem -- excel tries connect data source validate query, , fails so. how can change connection string without excel trying refresh data? know can done, because i've done it, have no idea did! you able suppress auto-refresh setting .enablerefresh = false property of pivotcache . however, need somehow reset property true upon start of spreadsheet or de

How to call SQL function from Qt -

i have function returns integer. can't figure how call function in qt. create function islastappversion( @currentversion nvarchar(10), @appcode nvarchar(128), @serial nvarchar(128)) returns int begin declare @ret int select @ret = case when @currentversion = (select *from getapplastversion(@appcode,@serial)) 1 else 0 end return @ret end from sql server call this: declare @i int exec @i = dbo.islastappversion @currentversion = '2.1',@appcode = '33fdd5f4-e24b-11e3-a375-82687f4fc15c',@serial='14jt-cf3c-24b1-c1e3' print @i how qt? tried. not working qstring dbconnection::islastversion(qstring version, qstring appcode, qstring serialno){ qsqlquery query; qstring result; qstring connectionstring = connection.arg(servername).arg(dbname); qsqldatabase db = qsqldatabase::adddatabase("qodbc"); db.setdatabasename(connectionstring); if (db.open()) { qdebug() << &q

jquery - how to send partial view form without refreshing main form and load another partialview? -

hi have main form tow partial views in it: "_orderdetail" , "_orderdetaillist" . the "_orderdetaillist" have form named "orderdetailform" .when submit orderdetailform's button, want send data action , return "_orderdetaillist" has bootstrap grid. want load "_orderdetaillist" in main form without refreshing page. main form: @using (html.beginform(null, null, formmethod.post, new { role = "form" ,id="mainform"})) { @html.antiforgerytoken() @html.validationsummary(true) /////some helpers... <div class="clr"></div> <div id="stufforderdetail"> @html.partial("_orderdetail") </div> <div id="stufforderdetail"> @html.partial("_orderdetaillist") </div> <div class="box-footer"> <input type="submit" value="ثبت" class="btn

php - using joins in sql - not getting all wanted results -

i'm trying query mysql db following sql : $sql = " select t1.discipline, t4disc.color, t4disc.naam, t1.date_posted, t2ploeg.naam ploegid, t1.cat, t1.tekst, t3user.naam posterid, t3user.voornaam log_logboek_".$log." t1 join log_ploegen_".$log." t2ploeg on t1.ploegid = t2ploeg.id join log_users t3user on t1.posterid = t3user.id join log_disciplines t4disc on t1.discipline = t4disc.id ". $where ." , t1.discipline in ($vis_ids) order date_posted asc; "; this query work , gives results. problem joins if 1 of joined tables doesn't contain matching id, row gets skipped results entirely. let's say, example, user deleted log_users table, records id gets skipped in query because there no matching user t1.posterid. is there way of joining these tables can in 1 query, , still getting row in results ? if so, can substitute missing id's in someway ? any app

php - best SEO header status to redirect index for user languages -

i have multi-language site www.sooran.com food.sooran.com/en/ // global food.sooran.com/fa/ // persian user first page of site(index.php) designed based on ip redirects user's language but late in search engines have reduced 10 times. to mind should use header location don't just don't redirect users. if user coming persia , wanna see en version won't able to? as google says: "let user chooses". did article way design homepage international users: http://googlewebmastercentral.blogspot.fr/2014/05/creating-right-homepage-for-your.html moreover, redirect based on ip dangerous. google not have spiders in whole countries in world might not see different behaviors. if have : 302 redirect (client force or not understand users hate redirected or ...) use http 302 status redirect. why ? because 302 means both urls exist. google keep both url indexed.

is.element() doesn't check correctly (?) in R -

i got little weird problem here: setprogress <- function(total) { ticks <- seq(.01, 1, = 0.01) * total return(ticks) } ticks <- setprogress(10000) is.element(100, ticks) is.element(205, ticks) # ... is.element(700, ticks) if run code get: clearly 100 part of vector ticks . -> true 205 not. -> false 700 is part of ticks but receive output false . what going on here? cheers, martin it's rounding error. set options(digits=22) , view ticks . you'll find value: 7000.0000000000009094947 the error because 0.7 cannot represented binary floating point number. you may able fix using definition: setprogress <- function(total) { seq(total/100, total, length=100) }

Animation css3 blinking stars -

please following code :- html:- <figure class="star"> <figure class="star-top"></figure> <figure class="star-bottom"></figure> </figure> js:- var limit=100, // max number of starts body=document.body; loop={ //initilizeing start:function(){ (var i=0; <= limit; i++) { var star=this.newstar(); star.style.top=this.rand()*100+"%"; star.style.left=this.rand()*100+"%"; star.style.webkitanimationdelay=this.rand()+"s"; star.style.mozanimationdelay=this.rand()+"s"; body.appendchild(star); }; }, //to random number rand:function(){ return math.random(); }, //createing html dom star newstar:function(){ var d = document.createelement('div'); d.innerhtml = '<figure class="star"><figure class="star-top"></figure> <figure class="star-bottom"&

java - How to load persistence unit from other jars? -

thanks all... i've 3 jars, 1 dao logic, other persistence archive (mappings, persistence.xml , orm files) , other application project. i'm using intellij idea 13 , gradle develop application in application project, when try run obtains next error: exception [eclipselink-30009] (eclipse persistence services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.persistenceunitloadingexception exception description: exception thrown while trying load persistence unit @ url: file:/f:/ideaprojects/com.reyma.db/out/artifacts/com_reyma_db/com.reyma.db.jar internal exception: java.lang.nullpointerexception @ org.eclipse.persistence.exceptions.persistenceunitloadingexception.exceptionloadingfromurl(persistenceunitloadingexception.java:100) @ org.eclipse.persistence.internal.jpa.deployment.persistenceunitprocessor.processpersistencearchive(persistenceunitprocessor.java:597) @ org.eclipse.persistence.internal.jpa.deployment.persistenceunitprocessor.getpersiste

heroku - Excluding fonts from the asset pipeline in Rails 4 -

i'm struggling firefox's cors same domain policy when using cloudfront serve assets. i've tried using font assets gem without luck. i thought having in stylesheet: src: url('<%= rails.application.config.local_static_url %>/belinda-webfont.eot'); and config value config.local_static_url = '//mydomain.com' i'm keeping fonts inside app/assets/fonts folder. i'm not sure how make work, because fonts copied s3, , digest added them. is there way of keeping fonts on heroku , serving them /assets folder? thanks. you can create separate files , include main layout normal <link> tag. post might helpful: http://thelazylog.com/posts/resolve-cors-fonts-issue-on-firefox-and-now-chrome-too-with-rails-assets-pipeline

database - mysql trigger after insert update value on different table -

i'm trying song voting system: imagine have these tables in database: table 'songs' song_id(primary) song_name song_artist song_votes table 'votes' vote_id(primary) iddevice song_id table 'users' iddevice(primary) the table users, register id of device. the table sonts, register info songs. the table votes, created make sure every unique device can vote once each song. what want achieve that, when device votes song, new row inserted on votes table, registering iddevice of person votes, , song_id of song receives vote. @ same time, field song_votes on songs table, has updated new vote, , assume has done trigger. so, when insert row on votes table, song referenced song_id, has song_votes field updated. if experience in mysql appreciate it. thx.

php - Sharing views for different controllers -

originally, php (and consequently laravel) developer. when write example simple blog app, have these routes: /blog/:id -> singlecontroller /blog/:id/edit -> editcontroller /blog/new -> newcontroller and because of laravel's form binding, use same template creating , editing blog post, so: {{ form::model($post, array('route' => '...')) }} {{ form::label('name', 'name') }} {{ form::text('name') }} {{ form::close() }} which awesome, because laravel fill in text field if executed edit controller, , otherwise leave field empty. of course, example above simplified, because changes in action/route have taken care of too. but currently, working on angularjs app (first time), , not find information best approach go this. advisable adopt same method angular too, or have been doing wrong along? the reason why because makes easier change form: need apply changes 1 file/form, instead of two. i recommend @ an

compilation - compiling hunspell-1.3.2 with cygwin in win 7 ultimate -

i need hunspell. windows user. using win 7 ultimate english. os name microsoft windows 7 ultimate version 6.1.7601 service pack 1 build 7601 other os description not available os manufacturer microsoft corporation system name nuras-pc system manufacturer sony corporation system model vpcw21m1e system type x64-based pc processor intel(r) atom(tm) cpu n450 @ 1.66ghz, 1666 mhz, 1 core(s), 2 logical processor(s) bios version/date insyde r0240e2, 07-dec-09 smbios version 2.6 windows directory c:\windows system directory c:\windows\system32 boot device \device\harddiskvolume1 locale united states hardware abstraction layer version = "6.1.7601.17514" user name nuras-pc\nuras time zone turkey daylight time installed physical memory (ram) 2.00 gb total physical memory 1.99 gb available physical memory 704 mb total virtual memory 4.23 gb available virtual memory 1.84 gb page file space 2.24 gb page file c:\pagefile.sys yesterday installed cyg