Posts

Showing posts from May, 2015

c# - ListPicker Data Binding and INotifyPropertyChanged -

so have 2 listpickers, device type , device name . if select tablet in device type , want device name listpicker show options ipad , dell venue 8 , etc. if select phone in device type , want device name listpicker show options iphone , samsung galaxy , etc , on. so how can go making data binding between these 2 listpickers , implement inotifypropertychanged changes in 1 listpicker dynamically reflected in other? you can following : in xaml : <toolkit:listpicker x:name="devicetype" itemsource="{binding devicetypelist}" selecteditem="{binding selecteddevicetype, mode=twoway}"/> <toolkit:listpicker x:name="devicename" itemsource="{binding devicenamelist}" /> in code : public class classname : notifychangements { private yourtype selecteddevicetype; public yourtype selecteddevicetype { { return selecteddevicetype; } set { selecteddevicetype = val

shell - bash script to remove files matching those in another directory -

i'm trying create script retrieves files (including subfolders) cvs , stores them temporary directory /tmp/projectdir/ (ok), removes copies of files project directory /home/projectdir/ (not ok) without touching other files in project directory or folder structure itself. i've been attempting 2 methods, i'm running problems both. here's script far: #!/usr/bin/bash cd /tmp/ echo "removing /tmp/projectdir/" rm -rf /tmp/projectdir # cvs login goes here, code redacted # export files /tmp/projectdir/dir_1/file_1 etc cvs export -kv -r $1 projectdir # method 1 file in /tmp/projectdir/* # check zero-length string if [-n "$file"]; echo "removing $file" rm /home/projectdir/"$file" fi done # method 2 find /tmp/projectdir/ -exec rm -i /home/projectdir/{} \; neither method works intended, because need way of stripping /tmp/projectdir/ filename (to replaced /home/projectdir/) , prevent them executing rm /home/projectd

asp.net - Server Error in '/' Application on web site Hosting on internet issue C# aspx -

i have website hosted on www/internet, when tried open abcxxx.com/webapplicationasp/login/login.aspx showing below error; server error in '/' application <%@ page language="c#" autoeventwireup="true" codebehind="login.aspx.cs" inherits="webapplicationasp.login.login" %> same web site hosted on local pc in iis showing no errors. working fine. i have googled , found need change codebehind codefile: got below error: parser error message: file '/webapplicationasp/login/login.aspx.cs' not exist. is means have add c# source files ? i published website in localpc using iis @ filesystem c:\inetpub\wwwroot\webapplicationasp same file structure have put on www hosting site? need more make work ? thanks, ashok

pdf - Remove font using iText -

i have problem pdfs. have default font, helvetica. font unused, need develop script automatically deletes font. after asking 2 questions: unset pdf font script xhtml2pdf doesn't embed helvetica i discover itext. i've been trying work library, , made few successful tests unembeding fonts ( example ). can't find deleting whole font de pdf. thanks lot

C++ template specialization for member function -

i'm trying implement basic vector3 ( vec3 ) class. i'm struggling special case : vec3<size_t> addition vec3<int> . how can make template specialization case? any appreciated. ben #include <array> #include <ostream> #include <vector> // #define vec3f std::array<float, 3> // #define vec3u std::array<size_t, 3> #define vec3f vec3<float> #define vec3u vec3<size_t> #define vec3i vec3<int> template <typename t> class vec3 { public: vec3(): _a() {} vec3(t x, t y, t z): _a({x, y, z}) {} vec3(const vec3<t> & a): _a({a[0], a[1], a[2]}) {} ~vec3() {} /// print vec3. friend std::ostream & operator<<(std::ostream & os, const vec3<t> & v) { os << "(" << v[0] << ", " << v[1] << ", " << v[2] << ")"; return os;

security - How to load PKCS7 (.p7b) file in java -

i have pkcs7 file, , want load , extract contents. i tried these 2 methods: byte[] bytes = files.readallbytes(paths.get("myfile.p7b")); fileinputstream fi = new fileinputstream(file); //creating pkcs7 object pkcs7 pkcs7signature = new pkcs7(bytes); or this fileinputstream fis = new fileinputstream(new file("myfile.p7b")); pkcs7 pkcs7signature = new pkcs7(fis); but got ioexception: sequence tag error so how can load .p7b file ? try this. works other pkcs module not sure 7. final string keystore_file = "file path"; final string keystore_instance = "pkcs7"; final string keystore_pwd = "password"; final string keystore_alias = "key1"; keystore ks = keystore.getinstance(keystore_instance); ks.load(new fileinputstream(keystore_file), keystore_pwd.tochararray()); key key = ks.getkey(keystore_alias, keystore_pwd.tochararray()); privatekey privkey = (privatekey) key;

javascript - Variable being overriden in for loop -

for each event, different location. when displayed on ui locations have been overridden last api call. how can stop happening? $scope.eventloc = ''; api.get({entity: 'organisation', entity_id: oid, property: 'campaign', property_id:cid, property2:'events'}, function(resp) { $scope.orgevents = resp.data; (i in resp.data) { ceid = resp.data[i].campaigneventid; lid = resp.data[i].locationid; api.get({entity: 'location', entity_id: lid}, function(resplocation){ $scope.eventloc = resplocation.data; }) } }); <li ng-repeat="event in orgevents track $index"> <h2>{{event.name}}</h2> {{eventloc.address1}} </li> simply change code this: //$scope.eventloc = ''; //this can removed api.get({entity: 'organisation', entity_id: oid, property: 'campaign', property_id:cid, property2:&

javascript - Issue with SelectBox (country/state) -

i got problem. i've tried selectbox using boostrap form helpers.( http://js.nicdn.de/bootstrap/formhelpers/docs/state.html ) so got selectbox "country" , other "state" <select id="countries" class="form-control bfh-countries"></select> <select id="states" class="form-control bfh-states" data-country="countries"></select> if choose value form country box states appears in states box, ok. but if use script <button onclick="test()" class="btn">load country</button> function test(){ document.getelementbyid('countries').value = "au"; } nothing appends on "states" selectbox, should states of country selected function test() right ? what can fix ? http://jsfiddle.net/xf8ech7k/1/ thanks in advance the problem there aren't triggerent "change" event. take @ modified code

nested forms - Rails 4.2 saving has_and_belongs_to_many association Ids -

i have following bit of code working fine rails 4.1 protected_attributes gem (i didn't have code moved strong_parameters yet) models/employee.rb class employee has_and_belongs_to_many :skills attr_accessible :skill_ids, ... end models/skill.rb class skill has_and_belongs_to_many :employees end i bind skills employee while updating employee view looks below views/employees/_form.html.erb <%= form_for @employee, |f| %> ..... <%= f.collection_select :skill_ids, skill.all, :id, :name, {}, {:multiple => true, class: 'select2 '} %> ...... <% end %> skill_ids part of attr_accessible params worked while saving employee form. (note: doesn't require accepts_nested_attributes_for :skills set @ employee model) rails 4.2 i in process of migrating code rails 4.2 , moving strong parameters. i've white-listed skill_ids in employees controller , invoking on update action, : controllers/employee_controller.rb d

ios - il2cpp compilation errors with Unity3d -

i trying compile unity3d c# scripts run on arm64 devices ios. the unity build generates xcode project no problems xcode build produces semantic issue errors: compilec /users/luis/library/developer/xcode/deriveddata/unity-iphone-eqdiboubmtwcvkcuyaficuwofpvl/build/intermediates/unity-iphone.build/debug-iphoneos/unity-iphone.build/objects-normal/armv7/assemblyattributes_g_mono_posix_assembly.o classes/native/assemblyattributes_g_mono_posix_assembly.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler cd /users/luis/projects/unity/myproject-unity/unity/myproject_xcode export lang=en_us.us-ascii export path="/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -f

IE11 - Object doesn't support property or method 'includes' - javascript window.location.hash -

i checking url see if contains or includes ? in control hash pop state in window. other browsers aren't having issue ie. the debugger gives me error when try load in way object doesn't support property or method 'includes' i no error when load page in tghrough popstate $(document).ready(function(e) { if(window.location.hash) { var hash; if(window.location.hash.includes("?")) { alert('i have ?'); hash = window.location.hash.substring(window.location.hash.indexof('#') + 0,window.location.hash.indexof('?')); }else { hash = window.location.hash; }; if (hash=="#drs" || hash=="#drp" || hash=="#dffi" || hash=="#dci" || hash=="#dcp" || hash=="#drp" || hash=="#drma" || hash=="#eics" || hash=="#org"){ $(hash+'c

traits - Interactively update color in Mayavi, Python -

it first post on stackoverflow. writing mayavi python program. tell me how update/modify color of point interactively? example, in points3d() , changing color of point in real-time when interactively modify position. tried under @on_trait_change , doesn't work. color cannot changed. following code: import mayavi import mayavi.mlab numpy import arange, pi, cos, sin traits.api import hastraits, range, instance, \ on_trait_change traitsui.api import view, item, hgroup mayavi.core.api import pipelinebase mayavi.core.ui.api import mayaviscene, sceneeditor, \ mlabscenemodel def luc_func(x, y, z): return x + y + z; class visualization(hastraits): x1 = range(1, 30, 5) z1 = range(1, 30, 5) scene = instance(mlabscenemodel, ()) def __init__(self): # not forget call parent's __init__ hastraits.__init__(self) z = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] y = [1,1,1,1,1,2,2,2,2,2,3,3,3,3,

angularjs - Can't keep the array order with orderBy in ngRepeat -

i'm totally stucked issue. i've got array returned in specific order server , display items through ngrepeat . i keep same order array's order @ beginning can't. automatically sorts array id. ng-repeat="item in filtered = (items | orderby:predicate:reverse)" when loaded, need keep same order array returned server. what wrong here ?

csv - Python reading cvs files recursively in tree directory and append one of the two columns to data frame -

i have root directory contains hundreds sub-folders. want read csv files in each sub-folder, names same, study.csv after reading csv files, want create data frame store part of data csv files. new data frame contain 3 columns. 1 column newly created mark csv file id, , other 2 columns 2 of csv file columns. for example: structure of original csv file is: row1.... row2.... row3.... row4: column1 column2 column3 column14 column5 row5: 1 2 3 4 5 row6: 2 4 2 1 10 row7: 3 8 9 11 23 ... the expected data frame want: new column column3 column4 1 3 4 1 2 1 1 2 1 1 9 11 so read csv files starting row 4, new column in data frame, value same if rows same csv files. can regard new column csv file id. i found os.walk me traverse tree directory, how can read 2 of specifi

jquery - Check if array is not empty with length JavaScript -

i console.log(arr) shows [] console.log(arr.length) shows 0 ? it's confusing me, best way check if array contain something? you can check if array empty checking length property: if (arr.length === 0) { // arr empty } or, check if contains items: if (arr.length) { // arr not empty } console.log(arr) show [] empty array. that's how shows , length property of 0 means there no items in array.

javascript - Insert/update object array with meteor-autoform -

i have schema.user = new simpleschema({ fullname: { type: string, }, contracts: { type: [object], }, "contracts.$.start_date": { type: date, }, "contracts.$.end_date": { type: date, }, "contracts.$.salary": { type: number, } }); meteor.users.attachschema(schema.user); not want display form in template, making possible update name , add/remove/update contracts. i have tried {{> quickform collection="meteor.users" id="updateusercontractsform" type="update" doc=this fields="fullname,contracts"}} but can update fullname. if trying add new contracts, wont saved. guess it's because have type="update" instead of type="insert" , wont allow me insert edit contracts since don't exist yet. am right? can mix insert/update?

dependencies - Maven downloading incorrect Spring jar versions -

i have been trying find way resolve issue while without success. namespaces using in bean xml follows: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" xsi:schemalocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-sec

Delete duplicates within an array in vba Excel -

i've got values inside array , delete values double entries, e.g. have eur,eur,eur,gbp,yen , remove double euro entries within removing them execel spreadsheet. just save in array. new array should that: eur,gbp,yen after write them spreadsheet. my code far: dim arraycurrency variant rangestart = "e2" rangeend = "e" rangenew = rangestart & ":" & rangeend & lrow currencyarray = range(rangenew).value each element in currencyarray next element i hope can me! best regards matthias use dictionary object unique values - in future. for current case, may use removeduplicates method on range.

scatter plot - How to add title of axis in Highcharts -

i'm implementing data visualization feature in self design web application using highcharts, i'm facing problem, can not add title of axis on chart, i've survey , tried, still doesn't working. the following web of that, , original source. web: http://140.138.152.9/test3d.html original source: http://www.highcharts.com/demo/3d-scatter-draggable you can add title xaxis , yaxis in way. yaxis: { title: { text:'here y axis title', } }, xaxis: { title: { text:'here x axis title', } } here fiddle

c# - Is it possible to pass parameters between web performance tests in visual studio 2013? -

lets assume have 2 web performance tests , b described below: testa: login page a.com testb: call testa, , more stuff. further assume page needs tested against site a.com , b.com (the credentials a.com , b.com same). is possible pass url parameter (which might either a.com or b.com) testb testa? in such way testa instead of loading page a.com, loads page b.com. want flexible, , able pass url parameter over. having said that, should still able execute testa standalone (going a.com). a.com should default value, , if required, should possible overwritten. if possible, need do? thx if 1 test calls via "insert call web test" command in web test editor, context of calling test made available called test. data can passed caller called. (i not sure whether called test can pass values caller via context. have check , update answer in future.) if web tests called load test method available. 1 of context parameters of web test called load test load test conte

html - Scrollbars in modal prevent user action in Chrome -

Image
i have modal dialog loads apsx page within it. i've got table in aspx page list customers. it's working in internet explorer, when open using google chrome, gives me 2 scrolls bar , i'm unable select item, note happen first item, if have more 2 customers can select second 1 on! i have no idea can be. running in ie . running in google chrome code: 1. opening dialog var dialogwindow = new mscrm.crmdialog(mscrm.crmuri.create(webresourceurl), window, 598, 298); dialogwindow.setcallbackreference(function (result) { alert(result) }); dialogwindow.show(); 2. html page load aspx page <form id="myform" runat="server"> <iframe width="590" height="280" id="iframechecklist" frameborder="0" scrolling="yes"></iframe> </form> 3. aspx page .record_table { border-collapse: collapse; } .highlight { background-color: rgb(177, 214, 240); } <form id="

c# - Unable to get result using object -

public object my() { list<string> mystring = new list<string>(); mystring.add("aaaa"); mystring.add("bbb"); return mystring; } in main program p1 = new program(); object test = p1.my(); console.writeline(test); even if converted tolist() i'm getting system.collection.generic.list how convert result list , display elements? you need cast object (test) list<string> , iterate on elements in list<string> print them. try this: program p1 = new program(); object test= p1.my(); list<string> lst = (list<string>) test; foreach(string item in lst) console.writeline(item);

r - Predict the class variable using naiveBayes -

i tried use naivebayes function in e1071 package. here process: >library(e1071) >data(iris) >head(iris, n=5) sepal.length sepal.width petal.length petal.width species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa >model <-naivebayes(species~., data = iris) > pred <- predict(model, newdata = iris, type = 'raw') > head(pred, n=5) setosa versicolor virginica [1,] 1.00000 2.981309e-18 2.152373e-25 [2,] 1.00000 3.169312e-17 6.938030e-25 [3,] 1.00000 2.367113e-18 7.240956e-26 [4,] 1.00000 3.069606e-17 8.690636e-25 [5,] 1.00000 1.017337e-18 8.885794e-26 so far, fine. in next step, tried create new data point , used naivebayes model ( model ) predict class variable

ios - Do something BEFORE unwind segue (swift) -

i have unwind segue goes previous controller , saves image phasset library. unwind segue works, saving works, issue unwinds before image saves. because of that, image doesn't presented on view controller unwinded to, since view controller presented before picture saved (it takes little time image save, whereas goes view controller quickly). wondering if there way unwind previous controller when after photo has been saved, not right away. here code: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if segue.identifier == "savepicture" { //image saved let newimage = self.appraisalpic.image //store picture phassets let priority = dispatch_queue_priority_default dispatch_async(dispatch_get_global_queue(priority, 0), { phphotolibrary.sharedphotolibrary().performchanges({ let createassetrequest = phassetchangerequest.creationrequestforassetfromimage(newimage)

.htaccess - htaccess: php language variable on index page -

i'm trying clean urls extensions , php language variables: test.com/en/ => test.com/?lang=en test.com/ro/page/ => test.com/page.php?lang=ro here .htaccess: adddefaultcharset utf-8 options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule .* - [l] rewriterule ^([^/]+)/([^.]+)\.php /$2.php?lang=$1 [l,nc,qsa] rewritecond %{request_filename} !-f rewriterule ^([^/]+)/$ $1.php rewriterule ^([^/]+)/([^/]+)/$ /$1/$2.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/)$ rewriterule (.*)$ /$1/ [r=301,l] while transforms test.com/ro/page => test.com/page.php?lang=ro , test.com/ro/index => test.com/index.php?lang=ro i cannot transform index page test.com/en/ => test.com/?lang=en can guys please me achieve this? right under rule: rewriterule ^([^/]+)/([^.]+)\.php /$2.php?lang=$1

javascript - Cannot get the HTML value of a dd element with jQuery -

please help, cannot html value of dd element. this code: <table id="tabla_costo"> <h2> costo de producción </h2> <dl> <dt>codigo></dt> <dd class="code"> &nbsp; </dd> <dt>codigo secundario></dt> <dd class="code2"> &nbsp; </dd> <dt>producto</dt> <dd class="name"> &nbsp; </dd> <dt>cantidad</dt> <dd class="quantity"> &nbsp; </dd> <dt>costo</dt> <dd class="cost"> &nbsp; </dd> </dl> </table> i've tried this, not work: var dl = $('#tabla_costo dl').find('dd.code').first().html(); console.log(dl); but i'm getting undefi

java - Andrioid studio start fail: Fatal error initializing 'null' -

i don't know happened android studio,when start ,it shows me error message below. , try uninstall/reinstall it,but doesn't work.who can me!!! internal error. please report https://code.google.com/p/android/issues java.lang.runtimeexception: com.intellij.ide.plugins.pluginmanager$startupabortedexception: fatal error initializing 'null' @ com.intellij.idea.ideaapplication.run(ideaapplication.java:178) @ com.intellij.idea.mainimpl$1$1$1.run(mainimpl.java:52) @ java.awt.event.invocationevent.dispatch(invocationevent.java:209) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:715) @ java.awt.eventqueue.access$400(eventqueue.java:82) @ java.awt.eventqueue$2.run(eventqueue.java:676) @ java.awt.eventqueue$2.run(eventqueue.java:674) @ java.security.accesscontroller.doprivileged(native method) @ java.security.accesscontrolcontext$1.dointersectionprivilege(accesscontrolcontext.java:86) @ java.awt.eventqueue.dispatchevent(eventqu

ios - MKMapview change annotation image -

- (mkannotationview *)mapview:(mkmapview *)mv viewforannotation:(id<mkannotation>)annotation { nslog(@"annotion"); cgsize imgsize; mkannotationview *pinview = nil; static nsstring *defaultpinid = @"pin"; pinview = (mkannotationview *) [self.m_mapview dequeuereusableannotationviewwithidentifier:defaultpinid]; pinview = [[mkannotationview alloc] initwithannotation:annotation reuseidentifier:defaultpinid]; pinview.canshowcallout = no; pinview.image = [uiimage imagename:@"blue.jpg"]; return pinview; } - (void)mapview:(mkmapview *)mapview didselectannotationview:(mkannotationview *)view{ view.image = [uiimage imagename:@"orange.jpg"] } i added annotations on mapview image(i.e blue image).when tap annotation changed image (i.e. orange image). tap on annotation change annotation(i.e.orange image) (i.e blue image) , change selected annotation (i.e.orange image).any appricated.thanks in adva

jquery - Filling empty space with a background color? -

i'm attempting style generated feed tumblr api. testing page here: http://www.nevermorestudiosonline.com/youtubetest feel free ignore url. did youtube thing , didn't bother change file name when started testing tumblr. can't figure out i'm doing wrong background color of divs. want "posted by" section fill downwards, , post content background fill right. (colors placeholders time being. plan adjust when things live on front page.) here's script i'm running pull posts, , subsequently create them within various divs. jquery.ajax({url: "http://api.tumblr.com/v2/blog/nevermorestudiosonline.tumblr.com/posts?api_key={api_key}&limit=5&jsonp=log_me", datatype: "jsonp"}); function log_me(data){ console.log(data); //so can keep eye on how things coming in. removed in live version. for(i=0; (i < data.response.total_posts) && (i < 5); i++){ if (data.response.posts[i].type == &

mongodb - How to write a Mongoose query for items whose IDs are not in an array -

i have 2 models: event , people . schemas.event = new mongoose.schema({ eventid: number, name: {type: string}, size: number, location: {type: string}, date: {type: date}, people: [{type: mongoose.schema.types.objectid, ref: models.person}], note: {type: string} }); and people schemas.person = new mongoose.schema({ firstname: {type: string}, lastname: {type: string}, age: number, email: {type: string}, gender: {type: string} }); given event, want query using mongoose, find people not registered event. something like models.person.find({not in event.people}); the tricky thing me is, event.people not array of ids, rather array of objects like [ { "$oid": "558ced061d35bd072e7b5825" }, { "$oid": "558ced061d35bd072e7b58a0" }, { "$oid": "558ced061d35bd072e7b58c6" } ], is

Lambda function issue in AWS iOS Sdk -

i'm new deal aws web services, i'm working open-identity sending developerauthprovidername , token in login dictionary of awscognitocredentialsprovider class , in viecontroller i'm invoking lambda funtion , giving me error below. have used cognitosyncdemo app , tried importing frameworks through pod result same. please me out of this. awsiossdkv2 [error] awscredentialsprovider.m line:435 | __73-[awscognitocredentialsprovider getcredentialswithcognito:authenticated:]_block_invoke | getcredentialsforidentity failed. error [error domain=com.amazonaws.awscognitoidentityerrordomain code=7 "the operation couldn’t completed. (com.amazonaws.awscognitoidentityerrordomain error 7.)" userinfo=0x1700778c0 {__type=invalidparameterexception, message=please provide valid public provider}] this appdelegate.m - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after applica

git - How can I merge remote branches without going to github? -

this question has answer here: git: merge remote branch locally 4 answers i have pushed local branch "develop" remote branch "develop". now, want merge contents of remote "develop" remote "master" without going github website. i tried checkout remote master typing git checkout origin/master , displays "you in 'detached head' state." what best way so? you can find answer here.. git - how merge remote branch remote master . there no way can merge remote branches directly local git repo. have merge branch local master branch , push changes remote master.

compass sass - @import line expected selector or at-rule, but not because of missing semicolon -

i have compass error line 3: invalid css after "@charset "utf-8"": expected selector or at-rule, "@import 'compass';") the file following. not contain of own code @charset "utf-8" @import 'compass'; i know people error occurs when the @import line misses semicolon , file has semicolon. and same files (scss , config.rb) can compiled in linux no problems. does know wrong? the configuration gives error is windows 8.1 ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32] compass 1.0.3 (polaris) sass 3.4.16 (selective steve) i tried many combinations (1) ------------------- @import 'compass'; ------------------- // line, no @charset line. // result: compilation ok, need charset because // comments (yes comments) have utf8 chars. (2) ------------------- @charset "utf-8"; @import 'compass'; ------------------- // semicolon after @charset // result: comp

javascript - Math.log() inaccuracy - How to deal with it? -

this question has answer here: is floating point math broken? 20 answers i know getting 10 based logarithm have use math.log() divided constant of natural logarithm of 10. var e1000 = math.log(1000) / math.ln10; // result: 2.9999999999999996 instead of // expected 3. console.log(e1000); // result: 999.999999999999 instead of // expected 1000. console.log(math.pow(10, e1000)); but: result approximation. if use calculated value in further calculation inaccuracy becomes worse. am doing wrong? there more elegant way around using math.ceil()? the floating point rounding difference known , coincidentally 2.9999 exact example used in mdn math.log page. mentioned math.ceiling can used alther result. likewise increase base number , use smaller divider decrease change of floating errors. e.g. function log10(value){ return -3 * (math.log(value * 10

floating point - about float datatype in C -

this question has answer here: how floating point numbers stored in memory? 7 answers i studying logic building c, write small code equation. here code: #include<stdio.h> int main() { float a,b; printf("find solutions equation: ax + b = 0\n"); printf("input value a: "); scanf("%f", &a); printf("input value b: "); scanf("%f", &b); if(a == 0) { if (b ==0) { printf("countless solution."); } else { printf("have no solution."); } } else { printf("have 1 solution: x = %.2f", -b/a); } } the problem when input a=any number, b=0, have solution is: x= -0.00. i don't understand why x = -0.00 instead of x = 0.00 ? have tested cases a==0 &&a

sql server - Avoid duplicate records in linq query while joining multiple tables -

Image
i have following tabes in db testpack { id, name, type } documentation { id, tp_id, date, rev } flushing { id, tp_id, date, rev } tp_id testpack id , foreign key in both documentation , flushing tables means testpack may have 1-n documentations , flushings. now want query database (using ef linq) return tests packs, , documentations , flushings against 1 test pack can show information in single datagrid? test packs, dont have documentatoin/flushings should show in result. here query have written far internal list<testpackregister> generatereport2() { var alltestpacks = project.getalltestpacks(); var alldocumentation = project.getalldocoumentations(); var allflushings = project.getallpretestflushings(); var queryresult = tp in alltestpacks join doc in alldocumentation on tp.id equals doc.test_pack_id.value tpdoc subtpdoc in tpdoc.defaultifempty() join flushings in allflushings on tp.id equals flushings.test_pack_i

angularjs - how to per click to reload route and not change route? -

now have menu directive , product page in diff module. here similar menu <ul class="nav navbar-nav" > <li class="active"> <a href="#/product">products</a> </li> </ul> here similar product controller .controller('productctrl', ['$scope','flash','$http','fileuploader','$filter','$cookiestore', function ($scope,flash,$http,fileuploader,$filter,cookie) { $scope.$on('$routechangesuccess', function(angularevent, current, previous) { if ('new_id' in current.params){ $scope.product_id = current.params.new_id; $http.get('/v2/oauth/product/'+current.params.new_id).success(function(data,state,headers,config){ if(state==200){ $scope.product_id = data.answer._id; setproduct_variable(data.answer); flash('get product info:'

Displaying toast message in a text View android -

i trying display toast message in textview needs update every second in order display package names (every second) i'm getting error in code saying "cannot refer non-final variable pnum inside inner class defined in different method" in line "msgto.settext("optimized " + procinfos.get(pnum).processname);" // display package names activitymanager actvitymanager = (activitymanager) getapplicationcontext() .getsystemservice(getapplicationcontext().activity_service); list<runningappprocessinfo> procinfos = actvitymanager .getrunningappprocesses(); (int pnum = 0; pnum < procinfos.size(); pnum++) { if ((procinfos.get(pnum)).processname.contains("android") || (procinfos.get(pnum)).processname.contains("system") || (procinfos.get(pnum)).processname.contains("huawei")

php - Query database with comment meta -

Image
i have wordpress comment box 2 custom files, name , country, written database meta_key tag comment_name , comment_country . need display these comments needs include actual comment, values of 2 custom fields. need query database need retrieve comments, not comments particular page. the code (kind of) have is: <?php global $wpdb; $querystr = " select comment_content $wpdb->comments inner join $wpdb->commentmeta on meta_key = 'comment_name'"; $comment_info = $wpdb->get_results($querystr, object); echo '<ul>'; // display results foreach($comment_info $info) { echo '<li class="commentbox"><p>'. $info->comment_content .'</p><h6>'. $info->meta_value .'</h6></li>'; } echo '</ul>'; ?> as can see, need comment_content field in wp_comments , combine meta_value of 2 meta_keys . haven't figured out how try , add s

vb.net - Loading every day in a month from a database -

i'm creating calendar program can contain 6 events per day. software uses loop check everyday events. takes time opens , closes mysql connection 31 times. method works , takes 1 second per loop, im looking better method, if there one. integer = 1 31 if (i = 32) exit main.hide() end if try dim reader mysqldatareader dim dbconn new mysqlconnection dim dbquery string = "" dim dbcmd new mysqlcommand dim dbadapter new mysqldataadapter dim dbtable new datatable dim count integer if dbconn.state = connectionstate.closed dbconn.connectionstring = "database=###########;data source=###########;user id=###########;password=###########;connection timeout=20" dbconn.open()

ios - Writing a Singleton in Swift for Squeal -

im using squeal access sqlite database app. want write singleton helper class, can't figure out how create class global version of db . heres code whole file: import foundation import squeal class databasehelper { static let sharedinstance = databasehelper() let databasefile = "record_store.db" private init() { let db = database(path:databasefile) // create table db?.createtable( "records", definitions: [ "id integer primary key autoincrement", "artist text", "album text", "gnere text", "year text", "size text", "speed text" ] ) nslog("database created") } func insert() { nslog("inserting stuff") } func delete() { nslog("del