Posts

Showing posts from February, 2014

visual studio - Assembly lands in bin with Build Action: None and Output Directory: Do not copy -

Image
the question assembly properties. build action: none copy output directory: not copy oddly, these settings still land assemblies in bin. i've read answer question: what various "build action" settings in visual studio project properties , do? seems these shouldn't landing in bin. why these landing in bin? is expected behavior settings? if isn't expected behavior, settings more appropriate? scenario : we're deploying sql server ce entity framework windows azure web app. after running install-package entityframework.sqlservercompact , our csproj has _bin_deployableassemblies directory. directory contains bunch of assemblies azure web app requires (we don't need them locally if sql server ce installed.) when build csproj, of assemblies end in bin. good. images assembly properties build results i wrong, think if msbuild detects dependency on dll include in output regardless of setting, if 1 of things ar

jquery - Highcharts - Drilldown with setSize causes chart corruption -

i need able resize chart when drill down through data, because instance, top level might have say, series of 3, drilldown might series of 10 or vice versa. however, having issue this. using fiddle able reproduce bug: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-drilldown/ type: 'bar', events: { drilldown: function(e) { this.setsize( this.chartwidth, ( e.seriesoptions.data.length * 50 ) + 150 ); }, drillup: function(e) { this.setsize( this.chartwidth, ( e.seriesoptions.data.length * 50 ) + 150 ); } } }, notice: if drill down internet explorer, bottom "proprietary or undetectable", left on top level "brands" chart. if remove the this.setsize stuff, chart work correctly. here chart above changes. http://jsfiddle.net/7oatr7xe/ image of issue: http://i.imgur.com/rrjvlri.png

java - Multiline REGEX - match only the first line, ignore the rest of lines -

here method remote smtp server name: public static string getmtaname(string data) { pattern p = pattern.compile("^\\d{3}[ -](.*?)( .*)*$"); matcher m = p.matcher(data); if (m.find()) { return m.group(1); } return "undefined"; } the problem if pass multiline response like: string s = "220-xsistema.lt esmtpsa xmailserver 1.2 service ready\r\n220 other info"; system.out.println(getmtaname(s)); the output "undefined". if: s = "220-xsistema.lt esmtpsa xmailserver 1.2 service ready"; then works fine - output "xsistema.lt". question - how match first line? . default not match newline .so use [\s\s] instead of . or use dotall flag, pattern.dotall or (?s) tells java allow dot match newline characters, too. pattern regex = pattern.compile("^\\d{3}[ -](.*?)( .*)*$", pattern.dotall);

java - How to draw an 100 sided regular polygon -

i trying draw regular circle , 100 sided regular polygon. can draw regular circle: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class shapes extends jframe implements actionlistener { private jbutton button; private jpanel panel; public static void main(string[] args){ } private void createline(){ setdefaultcloseoperation(exit-on-close); container window=getcontentpane(); window.setlayout(new flowlayout()); panel=new jpanel(); panel.setpreferredsize(new dimension(700, 700)); panel.setbackground(color.white); window.add(panel); button=new jbutton("ok"); window.add(button); button.addactionlistener(this); } public void actionperformed(actionevent event) { graphics paper= panel.getgraphics(); int r = 75; int x = 300; int y = 150; paper.drawoval(x,y,r,r); } } i don't know how dr

spring - STS 3.6.4 CodeSet 'initial': Can't use 'Maven': There is no 'pom.xml' -

when import spring getting started content, , choose consuming rest android shows error : codeset 'initial': can't use 'maven': there no 'pom.xml' i not have maven installed, in stead use embedded maven comes sts (3.2.1 embedded). see, creates .m2 folder under user, , downloads jars, when selected create spring starter project dashboard. not sure, why saying codeset 'initial': can't use 'maven': there no 'pom.xml'. i deleted m2 folder, , tried, no luck. trying find pom.xml ?

java - Is it okay for a class to have a field of its own type -

i did following, got stackoverflow error after time, , understand why was. public class cat { string name="default name"; cat insidecat; public cat(){ system.out.println("cat constructor"); insidecat = new cat(); } } but if don't create new cat object within constructor, take parameter of cat type , assign insidecat field. public class cat { string name="default name"; cat insidecat; public cat(cat insidecat){ system.out.println("cat constructor"); this.insidecat = insidecat; } } i playing around code, trying find out java can , cannot. in second code, looked normal, until started test class. need cat object create cat object (and create cat object need cat object...and goes on). technically cannot test class. so question why java allow create instance variable of own type? guess whole purpose of constructor initialize it's instance variables. either hav

javascript - Download file directly, not from window.open(url) -

i'm having session issues in asp.net application. main application opens asp.net dialog, contains link pdf file. file 'downloaded' using window.open('myurl/file.pdf'); this results in new window opening, file cannot downloaded due session object not transferred (keep in mind solution bit more complex, trying keep session in new window not work because it's embedded in c# webbrowser frame). are there possibilities downloading file directly link, not through window.open()? if file exists on file system, link it. know winds opening file in browser depending on user's setup. if don't want through opening window , file generated dynamically: use button or linkbutton use response.addheader in click event of button/linkbutton response.addheader("content-disposition", "attachment;filename={filename.extension}") response.contenttype = "application/{mime type here}" stream results client (you'd ne

Single digit displaying after entering double digit as input in java Program -

in below java code if entering double digit input getting value entered single digit.i think problem & num variable of diff data types. 2.if taking num int value entered converted different value. entered 20 & took 50. please help. class primenumber { public static void main(string args[]) throws java.io.ioexception{ system.out.println("enter number test prime number"); char num; num=(char)system.in.read(); system.out.println("number entered "+num); boolean tarun =true; for(int i=2;i<=num/i;i++){ if(num%i==0){ tarun=false; break; } } if(tarun) system.out.println(num +" prime number"); else system.out.println(num +" not prime number "); } } `output:- enter number test prime number 22 number entered 2 2 no

SetTimeout Does not work for validation in jQuery -

below code: have written function form validation , works well. want call validation function after few seconds because feels more comfortable warn users few seconds after type field , it's less shocking. problem when paste "//this code" "//here" doesn't work , "settimeout called" doesn't show in console, , console triggers "if()" line in settimeout scope. guess problem scope of $(this) inner function don't know how solve it! :) var firstname = $('#firstname'); var reg_firstname = /^[a-za-z]{1,50}$/; var color_valid = "#e0ffe0"; var color_invalid = "#e09898"; var unable_btn = false; function validform (variable, reg_variable) { variable.on('keyup',function(){ settimeout(function(){ // here: console.log("settimeout called"); // called },5000); //this code: if (reg_variable.test($(this).val()) == false || $(this

xml - XPATH return with no child tag and child tags of specific value -

new xpath, have following xml: <lessons> <lesson>blah</lesson> <lesson>blah</lesson> <lesson>blah</lesson> <lesson> <a>yes</a> </lesson> <lesson> <a>no</a> </lesson> <lesson> <a>booyah</a> </lesson> <lesson> <a>wowzer</a> </lesson> </lessons> what want select lessons no <a> tag, , lessons <a> tag having text yes. others excluded. how can accomplish this? if description of requirement reads "return x, excluding have y", need predicate . simply use following xpath expression: /lessons/lesson[not(a = 'no')] assuming well-formed input document (yours not, because 1 of lesson elements not closed), result (individual results separated -------- ): <lesson>blah</lesson> ----------------------- <lesson&g

css - Is it possible to have different styles for top and bottom WebKit scrollbar buttons? -

Image
i want make webkit scrollbar has different border-radius top , bottom buttons, this: this css @ moment buttons: ::-webkit-scrollbar-button { border-bottom-left-radius: 8.5px; border-bottom-right-radius: 8.5px; } but makes both buttons have curved bottom corners. is there way (preferrably css only)? you can differentiate top , bottom buttons using ::-webkit-scrollbar-button:vertical:decrement and ::-webkit-scrollbar-button:vertical:increment css: ::-webkit-scrollbar-button:vertical:decrement { border-bottom-left-radius: 8.5px; border-bottom-right-radius: 8.5px; } ::-webkit-scrollbar-button:vertical:increment { border-top-left-radius: 8.5px; border-top-right-radius: 8.5px; } fiddle

ios - Preprocessor #define tag on Objective-C non-Macro -

this isn't possible wanted verify cant find on web it. given objective-c call this: [nsstring stringwithformat:@"%@-%@", var1, var2]; i redefine using this: #define [nsstring stringwithformat(...)] //i realize not macro can //it done ? nslocalizedstring([nsstring stringwithformat(...)],@"comment"]); is possible ? update: let me explain want. have inherited code not localized. 95% of calls this: [nsstring stringwithformat:@"%@-%@", stringvalue1,stringvalue2]; i had brainstorming idea wondering if 'redefine' stringwithformat use nslocalizedstring macro localize string. wanted in prefix header stringwithformat calls redefined nslocalizedstring macro first.

sqlite - Python 3.4 - How to transform a Pandas Data Panel (not frame) to a mySQL database? -

i trying organize financial data in 'multidimensional' sql database can, @ later stage, take slices needed across time or asset (or attribute such 'close_price'). pandas panel.to_sql seemed nice way (albeit lack of detailed documentation on data panels specifically), , have managed store data in pandas data panel: http://pandas.pydata.org/pandas-docs/dev/generated/pandas.panel.to_sql.html <class 'pandas.core.panel.panel'> dimensions: 1322 (items) x 2717 (major_axis) x 15 (minor_axis) items axis: 0 1321 major_axis axis: 2004-01-02 00:00:00 2014-12-24 00:00:00 minor_axis axis: open name in case items security ids (or stock symbols), major_axis dates, , minor_axis hold various attributes (prices etc.) i tried (assume 'dp' name of data panel , 'path' target path database): from sqlalchemy import create_engine import sqlalchemy engine = create_engine('sqlite:///'+ path) dp.to_sql(name = 'equities_data', con = eng

java - Android passing Context everywhere -

i've developed android app (for me) it's ugly , i'm pretty sure approach wrong. i have bunch of fragments activities , lot of classes async-tasks, business rules , on. in special, have class called propertiesreader use read properties file. use class in lot of places fragments , on business rules. public class propertyreader { private properties properties; public propertyreader(context context){ super(); try { properties = new properties(); properties.load(context.getresources().getassets().open("badass.properties")); } catch (ioexception e){ log.e("error", "error opening properties file", e); } } public string getvalue(string key){ return properties.getproperty(key); } } in every place use class, like: propertyreader bla = new propertyreader(this); //or new propertyreader(context); i wondering best approach work classes need conte

C# file extensions -

i attempting loop through folder , return files extension .err. however, extensions vary .err .err .err depending upon contained within file itself. using below; directory.getfiles(@"\\" + textbox1.text + @"\\d$\\", "*.err") is above code case sensitive in limited returning .err only? case in-sensitive windows file system case insensitive default.

matlab - Cross Validation Using libsvm -

i performing 5 - fold cross validation using code : %# read training data [labels,data] = libsvmread('training_data_libsvmformat.txt'); %# grid of parameters folds = 5; [c,gamma] = meshgrid(-5:2:15, -15:2:3) %coarse grid search: bestc = 8 bestgamma = 2 %[c,gamma] = meshgrid(1:0.5:4, -1:0.25:3) %fine grid search: bestc = 4 bestgamma = 2 %# grid search, , cross-validation cv_acc = zeros(numel(c),1); i=1:numel(c) cv_acc(i) = svmtrain(labels, data, sprintf('-c %f -g %f -v %d', 2^c(i), 2^gamma(i), folds)); end %# pair (c,gamma) best accuracy [~,idx] = max(cv_acc); %# contour plot of paramter selection contour(c, gamma, reshape(cv_acc,size(c))), colorbar hold on plot(c(idx), gamma(idx), 'rx') text(c(idx), gamma(idx), sprintf('acc = %.2f %%',cv_acc(idx)), 'horizontalalign','left', 'verticalalign','top') hold off xlabel('log_2(c)'), ylabel('log_2(\gamma)'), title('cross-validation accuracy')

c# - An unhandled exception occurred in mscorlib.dll -

int i=convert.toint16(textbox1.text); console.write(i); the above lines of code showing error 'system.formatexception' . me out. this error means input string ( textbox1.text ) in incorrect format. (ie, not number) try using int16.tryparse method handle errors appropriately: short number; bool result = int16.tryparse(textbox1.text, out number); if (result) { console.writeline(number); } else { // handle error! } see why code throwing formatexception?

Java(Android) stuck in while loop -

when run app continuously stuck in while loop. should leave while loop when button pressed, after pressing button continues loop. view.onclicklistener listener11 = new view.onclicklistener() { @override public void onclick(view view) { temp1 = button[0]; temp3 = button[0].getbackground(); state++; } }; while(state == 0) { try { thread.sleep(500); } catch (interruptedexception e) { e.printstacktrace(); } button[0].setonclicklistener(listener11); } variable: state int temp1 button temp3 drawable the delay there because have 20 buttons , have setonclicklisteners buttons inside while loop think causes crash without delay. question possible have setonclicklisteners outside while loop still able check button clicks inside loop? the problem pressing button while thread in sleeping state causing event

php - Memory usage high on server compared to wamp -

lately site (with 260000 posts, 12000 images, 2,360,987 mysql rows , 450.7 mib size) running slow , @ times not loading many mins i installed debug bar plugin https://wordpress.org/plugins/debug-bar/ memory usage on server is : 174,319,288 bytes intel(r) xeon(r) cpu e3-1230 v2 @ 3.30ghz , 16 gb (php: 5.5.23, mysql: 5.6.23, apache 2.4) even tried disabling plugins doesnt much... comes down 160-163,xxx,xxx bytes on wamp is : 37,834,920 bytes (php: 5.5.12, mysql: 5.6.17) why difference huge? how detect problem? been using following plugins acunetix wp security akismet antispam bee cloudflare contact form 7 custom post type ui debug bar login lockdown redirection theme test drive w3 total cache wordpress seo wp-optimize wp missed schedule my.cnf values above server are [mysqld] slow-query-log=1 long-query-time=1 slow-query-log-file="/var/log/mysql-slow.log" default-storage-engine = myisam local-infile = 0 innodb_buffer_pool_size = 1g innodb_log_file_s

Jquery DataTables AJAX Default Sorting Not Working -

i'm pulling raw json in fill out datatable. the problem things pagination , sorting don't work. i'm not pulling info database, i'm pulling data aws. from aws --> cache file --> json --> datatables. my json looks so: { "count": 332, "data": [ { "account": "netops", "architecture": "x86_64", "block_devices": [ { "delete_on_terminate": true, "name": "/dev/sda1", "status": "attached", "volume_id": "vol-secret" } ], "ebs_optimized": false, "group_name": null, "hypervisor": "xen", "id": "i-secret", "instance_type": "m1.small"} ]} of course real result returns 323 records... the json valid json according json lint here use datatables: <script> $(document).ready(function(

import fails when running python as script, but not in iPython? -

i have project structured such: folder1 | folder2 | tests i have __init__.py in each folder. when in parent directory of folder1, run ipython , do from folder1.folder2.tests.test1 import main main() everything works fine. when run python folder1/folder2/tests/test1.py i importerror: no module named folder1.folder2.file1, import statement in test1 from folder1.folder2.file1 import class1 confused - guessing path issue don't understand wrong code (many similar setups in other folders) , why still works in ipython , not python run script. the module search path ( python 3 docu ) different , without script file: interactive python interpreter (goes both python , ipython ) $ python python 2.7.3 (default, dec 18 2014, 19:10:20) [gcc 4.6.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import sys >>> print(sys.path) [

jquery - How can I updateSize for CarouFredsel when inside of an accordion? -

i'm using jquery accordion hide/show content. when content expended in accordion - carousel hidden (the carousel shown expected if accordion set open default). my issue seems similar 1 in regards tabs: carofredsel , jquery ui tabs elements hidden i have tried apply suggestion within accordion call, not work (the carousel still not show/resize when accordion expands/opens): $( ".dnd-accordion" ).accordion({ collapsible: true, active: true, heightstyle: "content", create: function( event, ui ) { var expanded = $(this).data("expanded"); if(expanded===0){ expanded = true; } else{ expanded = expanded-1; } $(this).accordion( "option", "active", expanded); }, $(this).click(function () { $('.dnd-carousel').trigger('updatesizes'); }, }); and i've tried well, same thing, doesn't work: $(".

optimization - Hungarian algorithm with multiple assignments -

let's we're given n jobs , k workers jobs. jobs need 2 employees, while need one. employees can't jobs. example worker 1 can jobs 1,2 , 5, while not jobs 3 , 4. if hire worker 1 job 1, want him jobs 2 , 5, since we've paid him. so example let's have 5 jobs , 6 workers. jobs 1,2 , 4 need 2 men, while jobs 3 , 5 need one. , here's list of jobs every worker can , wage requires. worker 1 can jobs 1,3,5 , requires 1000 dollars. worker 2 can jobs 1,5 , requires 2000 dollars. worker 3 can jobs 1,2 , requires 1500 dollars. worker 4 can jobs 2,4 , requires 2500 dollars. worker 5 can jobs 4,5 , requires 1500 dollars. worker 6 can jobs 3,5 , requires 1000 dollars. after little calculation , logical thinking can conclude have hire workers 1,3,4 , 5, means minimum wage need pay is: 1000+1500+2500+1500=5500 dollars. but how can find efficient algorithm output amount? somehow reminds me of hungarian algorithm, additional constrains makes impossible me apply i

Pushbullet API via http in Android -

how can receive pushbullet notes/images/profile details via api-key on android? main problem ssl security in point. (btw: i'm pretty beginner in android , know basics.) the auth looks this: https://apikey@api.pushbullet.com/v2/users/me i'm requesting content of webpage (e.g. wikipedia.org) via try { url url = new url("https://www.wikipedia.org"); urlconnection urlconnection = url.openconnection(); inputstream in = urlconnection.getinputstream(); stringwriter writer = new stringwriter(); ioutils.copy(in, writer); thestring = writer.tostring(); textview.settext(thestring); } catch (exception e) { textview.settext("error: "+e "string content: " +thestring); } but when i'm requesting, example, profile details i'm getting a javaio filenotfoundexception if run requests through https://www.runscope.com can see request client making (they have free plan trying out). if had guess it'

javascript - How do I grab part of a URL string and make it display as text in the HTML? -

say have url "www.example.com/example.html?storeid=1400&shopperid=1200" , want pull information shopperid equals, in example 1200.i added script header added html. why not working? js: function getparameterbyname(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new regexp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); } var shopperid = getparameterbyname('shopperid'); your url isn't formatted correctly. have 2 ?, second should &. "www.example.com/example.html?storeid=1400?shopperid=1200" to: "www.example.com/example.html?storeid=1400&shopperid=1200"

c++ - vector size reverts to 0 outside constructor -

i have class [network] during construction creates vector of objects [nodes] inside constructor have declaration vector<node> nodes (nodecount); where nodecount int, lets 5 inside constructor can call cout << nodes.size() and output 5 here constructor network::network() //establish initial node count network /* cout << "how many nodes: "; cin >> nodecount; */ nodecount = 5; vector<node> nodes (nodecount); cout << "nodes.size(): " << nodes.size() << endl; //initialize tables nodes for(int = 0; < nodes.size(); i++) { nodes[i].inittable(i, nodecount); //cout << "nodes[" << << "].table[0] - " << nodes[i].table[0] << endl; debug(); pardon comments trying debug but outside constructor if in function void network::debug() cout << "nodecount: " << nodecount << endl; cout << "nodes.size(): "

knockout.js - knockout get old value of the text box -

i'm using mapping plugin. have on 'blur' event whenever takes away focus text box. know if old value different new value. works correct "enter" key. reason whenever change value , press enter console output first time; 'oldvalue | newvalue'. not case when 'blur' fires. 'newvalue | newvalue' how come?. how can new , old values on blur? html: <input class="percent-text" data-bind="text: percent, value: percent, event: { keypress: $root.percentupdate, blur: $root.percentupdate }" type="number" min="1" max="100" oninput="maxlength(this)" maxlength="3" /> knockout: self.percentupdate = function (data, event) { if (event.keycode === 13 || event.type == 'blur') { var $target = $(event.currenttarget); console.log(data.percent() + " | " + event.target.value); } return true; };

asynchronous - Saving/inserting multiple records with Python Twistar -

extending twistar example code , i'm trying write multiple records @ once: from twisted.enterprise import adbapi twistar.registry import registry twistar.dbobject import dbobject twisted.internet import reactor class user(dbobject): pass def done(user): print "a user created name %s" % user.first_name #the example calls reactor.stop() here registry.dbpool = adbapi.connectionpool('mysqldb', user="twistar", passwd="apass", db="twistar") # i've added function: def write_user(first_name) u = user(first_name=first_name) u.save().addcallback(done) new_users = ["alice","bob"] new_user in new_users: #here's call function repeatedly: write_user(new_user) reactor.run() as is, example prints: a user created name alice user created name bob but program never exits! adding reactor.stop() done() function causes script exit after printing just a user created name a

C - 2D Array malloc/free - Segmentation fault -

i have simple snippet below trying figure out reason getting segmentation fault. int main (int argc, char** argv) { const int size = 2; char** test1 = null; int index = 0; test1=(char**)malloc(sizeof(char*) * size); if (test1 != null) { (index = 0; index < size ; index++) { test1[index]=(char*)malloc(sizeof(char)); test1[index]='a'; } //removing block not result in seg fault - start (index = 0 ; index < size ; index++) { free(test1[index]); //seg. fault here } //removing block not result in seg fault - end free(test1); } return 0; } if remove block enclosed within start , end comment - not see seg fault. think result in leak. any appreciated. i think meant dereference test1[index]. code overwrites address of allocated memory 'a', hence when tries

nixos - Build vim with a predefined list of plugins in Nix -

so far have been able build vim custom flags using vim_configurable nix package , setting proper values in ~/.nixpkgs/config.nix . instance, building vim lua support (which isn't default when installing vim nix package), simple working config.vim set: pkgs : { vim = { lua = true; }; } the main problem facing how set vim different plugins different nix profiles. what's proper way achieve this? right manually installing corresponding nix vim plugins each profile , modifying ~/.vimrc after each profile switch, not ideal. seems possible when using nixos , haven't been able make work in nix. any hints? the nixpkgs config global, , that's reason don't such package config vim does. for sure can packageoverrides vim1 = ...; vim2 = ...; without using vim config on top-level, rather per-package override. not sure clear enough. in other words, use vim_configurable.override passing flags there directly, instead of using nixpkgs global config

url - Why java.net.URLEncoder gives different result for same string? -

on webapp server when try encoding " médicaux_jérôme.txt " using java.net.urlencoder gives following string: me%cc%81dicaux_je%cc%81ro%cc%82me.txt while on backend server when try encoding same string gives following: m%c3%a9dicaux_j%c3%a9r%c3%b4me.txt can me understanding different output same input? how can standardized output each time decode same string? the outcome depends on platform, if don't specify it. see java.net.urlencoder javadocs : encode(string s) deprecated .  the resulting string may vary depending on platform's default encoding. instead, use encode(string,string) method specify encoding. so, use suggested method , specify encoding: string urlencodedstring = urlencoder.encode(stringtobeurlencoded, "utf-8") about different representations same string, if specified "utf-8" : the 2 url encoded strings gave in question, although differently encoded, represent same unencoded valu

amazon web services - How to select a file from aws s3 by using wild character -

i have many files in s3 bucket , want copy files have start date of 2012. below command copies file. aws s3 cp s3://bp-dev/bp_source_input/ c:\business_panorama\nts\data\in --recursive --include "201502_nts_*.xlsx" you may want add "--exclude" flag before include filter. the aws cli takes filter "--include" include in existing search. since files being returned, need exclude files first, before including 2015*.xlsx. if want files format "201502_nts_*.xlsx", can run aws s3 cp s3://bp-dev/bp_source_input/ c:\business_panorama\nts\data\in --recursive --exclude * --include "201502_nts_*.xlsx"

c++ - How to provide const read-only access to a wrapper class -

i have following program. accomplish create constant reference mutable wrapper on unordered_map can pass around read-only lookup. however, not able compile following code, due operator[] overloads. from code, know doing wrong? #include <unordered_map> #include <string> using std::unordered_map; using std::string; class m { private: unordered_map<string, string> m; public: string const& operator[](string const& s) const { return m[s]; // line 13 } string& operator[](string const& s) { return m[s]; } }; int main() { m m; m[string("a")] = string("answer_a"); m const& m1 = m; string const& test = m1[string("a")]; return 0; } the error (on line 13) is error: passing 'const std::unordered_map, std::basic_string >' 'this' argument of 'std::__detail::_map_base<_key, _pair, std::_select1st<_pair>, true, _hash

c - Multithreaded program outputs different results every time it runs -

i have been trying create multithreaded program calculates multiples of 3 , 5 1 999 can't seem right every time run different value think might have fact use shared variable 10 threads have no idea how around that. program work if calculate multiples of 3 , 5 1 9. #include <stdlib.h> #include <stdio.h> #include <omp.h> #include <string.h> #define num_threads 10 #define max 1000 //finds multiples of 3 , 5 , sums of multiples int main(int argc, char ** argv) { omp_set_num_threads(10);//set number of threads used in parallel loop unsigned int nums[1000] = { 0 }; int j = 0; #pragma omp parallel { int id = omp_get_thread_num();//get thread id int i; for(i = id + 1;i < max; i+= num_threads) { if( % 5 == 0 || % 3 == 0) { nums[j++] = i;//store multiples of 3 , 5 in array sum later } } } int = 0; unsigned int total;

android - How to make an editable/typeable widget (like the Google Now search box)? -

my first guess try edittext it's not available appwidget. did research , found out it's possible on selected htc devices , not solution seek. however can see behaviour want in google search widget - tap on , keyboard appears. can't seem though. is there way that? or reserved google-stuff , couple devices have such mechanism implemented?

How to do center alignment in multirow in Lyx -

Image
i have problem center alignment in lyx. can see on screen. possible fix somehow in lyx have limited options edit code? thank petr merge of cells (0,3) (0,6), i'm using lyx version 2.1.3. to merge of cells you'll need delete text, unmerge, re-merge , add text in.

ios - Fetching subclassed objects from Parse -

in our project, have class called attendee , inherits pfobject . run pfquery fetches list of pfobjects, want store global attendee array. below code array , our query: var attendees: [attendee] = [] query.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if( error == nil ) { attendees = objects as! [attendee] } else { println( error ) } } however, when check contents of attendees array in debugger, empty. using debugger, checked objects array returned findobjectsinbackgroundwithblock , , there objects being fetched. i've attached attendee class definition below. class attendee: pfobject, pfsubclassing { override class func initialize() { var oncetoken : dispatch_once_t = 0; dispatch_once(&oncetoken) { self.registersubclass() } } class func parseclassname() -> string {

security problems with Java applications -

i remember in past there tons of security concerns java applications. after many java updates, fixed lot of bugs , made more secure vulnerability still exists. there in particular can enhance security in java web applications? tl;dr run them on server, or short answer - no. any complex system has bugs. operating systems have bugs, physical hardware has bugs , virtual machines have bugs. there nothing (as application developer) can enhance security of environment run on. however, if wanted to, might run java environment on virtual machine. if disable writes hard-drive it's difficult image successful attack vector, it's possible has exploit re-enable it. basically, can run software trusted sources.

java - How to move my Realm file in SD card? -

how move realm file in sd card? and not move, connect application? realm has constructors opening file: http://realm.io/docs/java/0.80.0/api/io/realm/realm.html#getinstance-java.io.file-java.lang.string- so should work: realm realm = realm.getinstance(environment.getexternalstoragedirectory()); and remember add manifest: <manifest ...> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> ... </manifest> also not phones has sd card , might not mounted need additional checks if don't want encounter lots of weird crashes in production: http://developer.android.com/guide/topics/data/data-storage.html#filesexternal

ocaml - List.iter & List.fold_right used together -

i trying use fold_right , list.iter functions in list module. there anyway use them in conjunction 1 another? let step nfa start transition = let transition_list = get_transition nfa in list.iter ( fun state -> list.fold_right (fun ct nl -> if ((get_pre_trans transition)= state && (get_trans ct) = transition) (get_post_transition transition)::nl else nl ) transition_list [] ) start ;; ** get_xxx functions values tuple there pre-transition, transition value, , post-transition. return error: error: expression has type 'a list expression expected of type unit. not sure do. the body of function pass iter contains 1 expression, call fold_right , evaluates value of type list , iter signature requires pass function, returns value of type unit . compiler tries you. if you're not interested in value fold_right evaluated, can ignore using ignore function, takes value of type , returns value of type uni

sublimetext3 - How do I automatically have multiple cursors in a Sublime Text 3 snippet? -

i have console log snippet sublime text 3. { "keys": ["alt+super+l"], "command": "insert_snippet", "args": { "contents": "console.log('$1', $2)" }, "context": [ { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, ] } i there multiple cursors, that, when call key snippet, cursor @ both $1 , $2 locations, want log variable name , variable value in console. how manage this? use ${1:placeholder} (or $1 ) in both places. particular snippet, like: { ... "contents": "console.log('${1:variable}', ${1:variable})" ... } if don't want placeholder , want cursor in 2 places, it'll this: { ... "contents": "console.log('$1', $1)" ... } let me know if works you.

python 3.x - Wand Image from PDF doesn't apply resizing -

i'm using wand in django project, generate thumbnail different kind of files, e.g pdf, thumbnail generation process done in memory, source file request , thumbnail saved temporary file, django filefiled saves image in correct path, thumbnail generated keeps initial size, code: with image.image(file=self.content.file, format="png") im: # self.content django model filefield didn't saved yet, file inside still in memory (from request) im.resize(200, 200) name = self.content.file.name self.temp = tempfile.namedtemporaryfile() im.save(file=self.temp) self.thumbnail = inmemoryuploadedfile(self.temp, none, name + ".png", 'image/png', 0, 0, none) # self.thumnail filefield saves image do have idea happen? bug? i've reported issue on wand github page. the problem comes fact pdf has more 1 page. if resize first page (which 1 want display), works. try adding following line after with statement: im = image.image(image=

vbscript - Sorting files by numerical order -

i have batch create shortcut based on order of files , problem when comes numbers presents following problem when passing number 100. 01.mp4 02.mp4 03.rmvb 04.mp4 05.rmvb 06.rmvb 07.rmvb 08.rmvb 09.rmvb 10.rmvb 100.mp4 101.mp4 102.mp4 103.mp4 104.mp4 105.mp4 106.mp4 107.mp4 108.mp4 109.mp4 11.rmvb i searched here , found various methods script use works folders , files use accents , & and/or ! example: c:\séries & movies\remix!.mkv (brazil , use e place of and). i wonder if there way check content , organize can before save in .ini or after saving same in .ini. observations: the folder path loaded first time set command. after entering path saved in .ini file , loaded. the script list files within directory not list subfolders , files , folders within it. the script needs other files work download link below: https://www.mediafire.com/?zcoybkfo8k4nm1t my full code: @echo off title create shortcuts in alphabetical order mode con:lines=3 cols=25 color

jquery - What is the technique to achieve this effect? -

Image
i trying similar effect (snapshot) via html , css result ? assume 1 done css3 transition. anyone me how can effect through css3 transition ? site url https://www.mrd.com/ i have tried these // html <span class="highlighter"></span> // css .highlighter { position: absolute; z-index: 1000; pointer-events: none; -webkit-border-radius: 50%; -moz-border-radius: 50%; -o-border-radius: 50%; border-radius: 50%; border: 1px solid #fff; width: 20px; height: 20px; padding: 12px; transform: pulse 1s infinite; display: block; } .highlighter:after { content: ""; display: block; -webkit-border-radius: 50%; -moz-border-radius: 50%; -o-border-radius: 50%; border-radius: 50%; background: #fff; width: 20px; height: 20px; opacity: 0.5; box-shadow: 0 0 3px rgba(0,0,0,0.2); } something this? .highlighter { position: absolute; z-index: 1000; pointer-events: none; -webkit-border-ra

spring - EERROR: org.hibernate.tool.hbm2ddl.SchemaExport - HHH000231: Schema export unsuccessful -

i use junit4 test code, , in first line code: applicationcontext context = new classpathxmlapplicationcontext( new string[] { "applicationcontext.xml" }); i got error: info : org.springframework.context.support.classpathxmlapplicationcontext - refreshing org.springframework.context.support.classpathxmlapplicationcontext@5a39699c: startup date [fri apr 10 04:47:54 west 2015]; root of context hierarchy info : org.springframework.beans.factory.xml.xmlbeandefinitionreader - loading xml bean definitions class path resource [applicationcontext.xml] info : org.springframework.jdbc.datasource.drivermanagerdatasource - loaded jdbc driver: com.mysql.jdbc.driver info : org.springframework.context.support.classpathxmlapplicationcontext - bean 'datasource' of type [class org.springframework.jdbc.datasource.drivermanagerdatasource] not eligible getting processed beanpostprocessors (for example: not eligible auto-proxying) info : org.springfr