Posts

Showing posts from March, 2010

javascript - How to locate parent path node.js OS independent manner -

i want portable across oss var path = require("path"), fs = require("fs"); fs.readfile(path.join(__dirname, '../..', 'foo.bar')); this code works mac/linux/unix; what universal manner write code? the correct , easiest way be: path.join(__dirname, '..', '..', 'foo.bar'); but if want write separator manually, this: path.join(__dirname, '..' + path.sep + '..', 'foo.bar');

osx - Really Sporadic Unity Behavior? No Idea What is Causing it -

Image
so have unity 5 mac, i'm on os x 10.11, , i'm using monodevelop. on past week or glitch, bug, whatever has been getting more , more annoying point now. have 1 script running , when play project 2 things happen: the script doesn't run! have outputting ton of things , doesn't output or supposed to. i've tried refreshing assets , everything, after first run, nothing there stranger thing happening. have rawimage used display webcam , plane far far away rawimage. making custom material plane has white , red. nonetheless, plane shows webcam. there no code or property connecting 2 whatsoever. these 2 events happen together. have restart unity every run fix this. i'll run once, maybe twice, 3 times , work fine next time these things. after running few times switch back. i'll run 10 or 15 times , doesn't go , have restart unity. has run form of strange bug / glitch before? [edit] here code might causing problem. code called in start method: ienume

google spreadsheet - Iterate through range and match values -

i have spreadsheet 2 sheets: week#, events. sheet "week#" (calendar week # in column , start day of week in column b): 01 january 4, 2016 02 january 11, 2016 03 january 18, 2016 04 january 25, 2016 05 february 1, 2016 and on till week 52 sheet "events" has next columns: facility, repeats, belongs week #, week # starts on, item, action, status. it's filled (number of rows varies): salona, monthly, 4, january 25,2016, floor, mop floor, created the script this: function createeventmanually (title, date) { var sheet = spreadsheetapp.getactivesheet(); var row = sheet.getactiverange().getrowindex(); var eventstatus = sheet.getrange(row, 7).setvalue("created"); var title = sheet.getrange(row,1).getvalue()+" "+"week "+sheet.getrange(row,3).getvalue()+" "+sheet.getrange(row,5).getvalue()+":"+" "+sheet.getrange(row,6).getvalue(); var cal = calendarapp.getcalendarsbynam

php - MySQL 5.7.9 fulltext research in multiple tables with Sphinx on WAMP -

i have research in multiple mysql tables internship. in fact, web phone directory. have form text input enter research. tried use match/against syntax appears wrong. query 1 : select u_id, 'users' users match ([columns want search in]) against ([the text inside search field]) union select s_id, 'service' service match ([columns want search in]) against ([the text inside search field]) this problem following : type of search, must send variable in many match can't have relevant result (because of multiple against elements). perfect solution replace 'union' 'inter' easy. don't know if usefull, use pdo send query php i tried search solutions couldn't find 1 me : https://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html using full-text search in sql server 2008 across multiple tables, columns mysql fulltext search on multiple tables different fields then tried use sphinx documentation complicated me , couldn't unde

php - Passing Array from Controller to Model CodeIgniter -

i ran trouble while passing array controller model in code igniter further processing. controller: public function list_out(){ $this->show_pagination(); $action = array( 'page'=>'public/'.$this->class_name.'/list', 'title'=>'my title', 'success'=>$this->success, 'data'=>$this->public_model->my_function(array('make'=>'apple','color'=>'black')) ); $this->public_page($action); } model: public function my_function($arr){ $this->db->select('main_tbl.*,image_table.image_url'); $this->db->from('main_tbl'); $this->db->join('image_tbl','image_tbl.prod_id=main_tbl.prod_id'); $this->db->where('main_tbl.prod_status',1); $table = 'main_tbl'; ($i = 0; $i < count($arr); $i++) { $key=key($arr);

angularjs - angular ng-animate directive with ng-show directive -

i cant ng-animate work ng-show directive. here jsbin simplified example: http://jsbin.com/uquzal/1/edit for reason css classes .show-animation-setup , .show-animation-start not working. ideas? thanks! you need running angularjs version 1.1.4 or newer, 1.1.5 being latest right now. need use different set of css rules — they've changed since first release. updated jsbin modify html point 1.1.5: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> and change css rules use .show-animation setup , .show-animation.show-animation.active active animation: .show-animation { background-color:red; -webkit-transition:all linear 0.5s; -moz-transition:all linear 0.5s; -ms-transition:all linear 0.5s; -o-transition:all linear 0.5s; transition:all linear 0.5s; opacity: 0; } .show-animation.show-animation-active { background: blue; opacity: 1; } also please note, if testing under firefox,

openerp - automate actions with cron and the new api odoo -

i want automate action , here code i'm using: <?xml version="1.0" encoding="utf-8"?> <openerp> <data noupdate="1"> <record id="ir_cron_scheduler_demo_action" model="ir.cron"> <field name="name">demo scheduler</field> <field name="user_id" ref="base.user_root"/> <field name="interval_number">2</field> <field name="interval_type">minutes</field> <field name="numbercall">-1</field> <field eval="false" name="doall"/> <field eval="'note.admin'" name="model"/> <field eval="'process_demo_scheduler_queue'" name="function"/> </record> </data> </openerp> @api.model def pro

java - kotlin project can't be build in gradle -

i have java project write in kotlin ,i use intellij idea develop project. have trouble on dependencies setting (multiple project). read lot of examples , can't find workaround , here dependencies setting code, can build in java class correctly , kotlin class lot of error 'unresolved reference' . wrong setting or gradle not suitable kotlin . ps : when build core project , build process successful , build @ test project reference unresolved error allprojects { apply plugin: 'java' apply plugin: 'kotlin' group 'testproject' version '1.0' } subprojects{ apply plugin: 'java' apply plugin: 'kotlin' def defaultencoding = 'utf-8' compilejava.options.encoding = defaultencoding sourcecompatibility = 1.8 targetcompatibility = 1.8 repositories { mavencentral() mavenlocal() } dependencies { // kotlin compile "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" compile "org

c++ - Bad scaling with OpenMP (cache contention?) -

i trying learn more openmp , cache contention, wrote simple program better understand how works. getting bad thread scaling simple addition of vectors, don't understand why. program: #include <iostream> #include <omp.h> #include <vector> using namespace std; int main(){ // initialize stuff int nuelements=20000000; // number of elements int i; vector<int> x, y, z; x.assign(nuelements,0); y.assign(nuelements,0); z.assign(nuelements,0); double start; // timer (i=0;i<nuelements;++i){ x[i]=i; y[i]=i; } // increase threads 1 every time, , add 2 vectors (int t=1;t<5;++t){ // re-set z vector values z.clear(); // set number of threads iteration omp_set_num_threads(t); // start timer start=omp_get_wtime(); // parallel #pragma omp parallel (i=0;i<nuelements;++i) { z[i]=x[i]+y[i]; }

amazon web services - Change content-type in S3 bucket policy for a specific file extension -

currently when place property list file (plist extension) s3 bucket, sets content-type application/octet-stream reason. causes issues when download in objective-c (ios). how can change bucket policy automatically sets content-type text/plain you cannot. default content-type "application/octet-stream". please find below aws documentation same http://docs.aws.amazon.com/amazons3/latest/api/restobjectput.html the option have setting content-type @ time of upload or updating once upload complete.

vba - Provider=Microsoft.Jet.OLEDB.4.0 And error : path not valid for CSV records retriving -

Image
currentpath2 = "c:\output-cities.txt" dim cn,rs set cn = createobject("adodb.connection") set rs = createobject("adodb.recordset") strconn= "provider=microsoft.jet.oledb.4.0;data source=" & currentpath2 & ";extended properties='text;hdr=no'" cn.connectionstring = strconn cn.open rs.activeconnection = cn rs.source = "select * " & currentpath2`enter code here` it gives error on provider=... line says path not valid, need install oledb driver see ole folder in system folder of c drive, please lemme know if have achieve more. baiscally want retrive csv records in recordsets, please lemme know if can me here., has work in both vba , lotusscript. have added reference vba project?

Sending Message Using Twilio-C# -

Image
hy... i'm learning twilio rightnow, , have seen post here http://www.markhagan.me/samples/send-sms-using-twilio-aspnet i have made own code because in above site "sendsmsmessage" deprecated now, here code : using system.text; using system.threading.tasks; using twilio; namespace smsusingtwilio { class program { static void main(string[] args) { string account_sid = "acmysid"; string auth_token = "40myauthtoken"; twiliorestclient client = new twiliorestclient(account_sid, auth_token); message response = client.sendmessage("(732)305-8856", "+6285220446195", "hellow hyosoka poipo :d"); console.writeline(response.status); console.writeline(response.accountsid); console.writeline("sms berhasil di kirim"); console.readline(); } } } the problem don't sms message phon

winapi - How do I call the ReplaceFile function from C#? -

i have googled lot , couldn't find solution, posting here. microsoft document bool winapi replacefile( _in_ lpctstr lpreplacedfilename, _in_ lpctstr lpreplacementfilename, _in_opt_ lpctstr lpbackupfilename, _in_ dword dwreplaceflags, _reserved_ lpvoid lpexclude, _reserved_ lpvoid lpreserved ); i need implement in c# basic structure. [dllimport("kernel32", setlasterror = true)] private static extern bool replacefile( ///argument implemetation here ); but don't know how implement arguments in c#. googled lot didnt solution. can me on this? according pinvoke.net info on replacefile , need: [dllimport("kernel32.dll", setlasterror=true, charset=charset.auto)] static extern bool replacefile( string lpreplacedfilename, string lpreplacementfilename, string lpbackupfilename, replacefileflags dwreplaceflags, intptr

sockets - Swift: How to update UI when listening to a stream -

code below seems work, except can't seem update button after getting stream event. i've tried both delegate , dispatch_async , neither seem trick. what magic missing here? import uikit class testviewcontroller: uiviewcontroller { @iboutlet weak var connectbutton: uibarbuttonitem! @iboutlet weak var stopbutton: uibarbuttonitem! let socket = socket() override func viewdidload() { super.viewdidload() } override func didreceivememorywarning() { super.didreceivememorywarning() } @ibaction func connectserver(sender: uibarbuttonitem) { socket.connect("10.0.0.1", port: 12345) } func setstopbuttonstate(state: string) { switch state { case "go": stopbutton?.title = "stop" break case "stop": stopbutton?.title = "start" break default: break } } } class so

.net - How to retrieve embeddedMap type from orient DB to asp.net side? -

i have class named "testclass" , has property called "settings" , type embedded map. my query follows. select settings testclass how can value in .net side using https://github.com/orientechnologies/orientdb-net.binary api? thanks in advanced..

swift - Unable to subtract two sets containing two dictonaries -

// compare 2 arrays getting result same first set let precontactset = set(arrayliteral: temppreviouscontactarray ) let currentcontactset = set(arrayliteral: tempcurrentcontactarray) let subtractset = currentcontactset.intersect(precontactset) print(subtractset) you can subtract 2 set using following code. try hope you. let test1 : nsarray = nsarray(array: [1, 2, 3, 4, 5, 6]) let test2 : nsarray = nsarray(array: [4, 3]) let set1 : nsmutableset = nsmutableset(array: test1 [anyobject]) let set2:nsset = nsset(array: test2 [anyobject]) set1.intersectset(set2 set<nsobject>) print(set1.allobjects)

How to Programatically resize Detached Viewpart Window in Eclipse RCP? -

i have viewpart in eclipse rcp detaching using inbuild method. have button on detached viewpart , upon clicking window size of windows (in detached viewpart there) should increase can't find api same. can please ? there 1 question found still don't know how resize eclipse rcp part you need set size of shell containing part. for example, command handler increases size of shell containing active part 100 pixels in each direction: public class resizehandler extends abstracthandler { @override public object execute(final executionevent event) throws executionexception { // active part iworkbenchpart part = handlerutil.getactivepart(event); // shell part site shell shell = part.getsite().getshell(); point size = shell.getsize(); // set new size shell.setsize(size.x + 100, size.y + 100); return null; } } note: question linked talking new 'e4' api. since asking viewpart using 3.x compatibility api.

Execute PL\SQL script in Oracle using Powershell -

i have following script written helps me execute pl\sql insert/update commands using powershell 1 file. if add select commands in same file won't work. script below, cls # oracle read file # load assembly add-type -path "c:\app\ssz\product\12.1.0\client_1\odp.net\managed\common\oracle.manageddataaccess.dll" # production connexion string $compconstr = "data source=(description=(address_list=(address=(protocol=tcp)(host=host1)(port=1521)))(connect_data=(server=dedicated)(service_name=serv1)));user id=test1;password=test123;" # connection object $oraconn= new-object oracle.manageddataaccess.client.oracleconnection($compconstr) $oraconn.open() # requête sql $myquery = get-content "c:\panel_update.sql"; write-output $myquery # command object $command1 = new-object oracle.manageddataaccess.client.oraclecommand($myquery, $oraconn) #$command1 = new-object oracle.manageddataaccess.client.oraclecommand #$command1.commandtext = $myquery #$command1.c

android - java.lang.IllegalArgumentException: 'retrofit2.Response' is not a valid response body type. Did you mean ResponseBody? -

my question similar retrofit 2.0 beta 4 response illegalargumentexception answer didn't me. i'm migrating retrofit 1.9 2.0.2. i'm registering app messaging once launches. /** * synchronous method register gcm token on backend server * * @return true, in case of success response, false otherwise. */ public boolean registergcmtoken() { ... try { call<response> call = mservice.registergcmtoken(sessionid, this.additional_query); final response response = call.execute().body(); // <<< error points here final defaultresponse defaultresponse = defaultresponse.newinstance(response); return defaultresponse.issuccess(); } catch (ioexception ignored) { } return false; } my interface looks like: @get("my/url") call<response> registergcmtoken(@header(constant.header_wildcard) string acce

python - How to change contrib.auth.views.password_change view texts in Django? -

i use djangos default passoword_change view, want change text requirement texts , field labels. example, these texts site: your password can't similar other personal information. your password must contain @ least 8 characters. how can change these texts? urls.py: url(r'^password-change/$', 'django.contrib.auth.views.password_change', {'template_name': 'index/salasanan_vaihto.html'}, name='userauth_password_change'), url(r'^password-change-done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'index/salasanan_vaihto_valmis.html'}, name='password_change_done'), the password checked using validators defined settings.auth_password_validators . those classes implemented here , write own , overwrite def get_help_text(self) and/or validate() methods.

Upload file with google drive from web service c# fail for base uri = null -

i have implemented web service calling class uploads pdf folder on google drive. request list of folders contents. the problem if called main pdf uploaded , list done. if webservice makes call list done upload fails , can see exception in response: the base uri null. if after calling main try call web service in localhost (via soapui) webservice able upload pdf. the class implement gdrive api same. the code used service gdrive is: var keyfilepath = @"c:\progetti\pippo.p12"; var serviceaccountemail = "reportbatch@appspot.gserviceaccount.com"; var certificate = new x509certificate2(keyfilepath, "notasecret", x509keystorageflags.exportable); var credential = new serviceaccountcredential(new serviceaccountcredential.initializer(serviceaccountemail) { scopes = scopes }.fromcertificate(certificate)); var service = new driveservice(new baseclientservice.initializer()

c++ - Find offset exported function in DLL file -

in order apply hot fixes dll used 'loadlibrary' , 'getprocaddress' find base address , offset of exported function in dll. example: // use handle base address base = loadlibrary(...); // offset relative base offset = getprocaddress(...); and using way: // calculate offset in file offsetinfile = offset - base; // apply hotfix in file patchexportedfunction(offsetinfile, "mydll.dll"); this worked fine far - have problem there dlls different in way calculated offset not match offset in file anymore. obviously approach finding function simple have no clue i'm missing , why works of time not always. maybe has idea?

node.js - Store an Image from registration page using NodeJS -

i using expressjs , nodejs . build registration page require user upload image. code in jade .form-container h1 create user form(name="adduser",method="post",action="/adduser") .col-xs-13 p username input.form-control(type="text", name="username") .col-xs-13 p email input.form-control(type="text", name="useremail") .col-xs-13 p upload image input.form-control(type='file', name ="pic", accept='image/*') .col-xs-13 p password input#password.form-control(type='text', name='pass', required='') .col-xs-13 p confirm password input#confirm_password.form-control(type='text', required='' , onkeyup='checkpass(); return false;') span#confirmmessage.confirmmessage br .form-group button#mybtn.btn.btn-primary(type="submit") submit i have script down there doesnt matter right n

ssl - C# Paypal Sandbox's IPN simulator fails to send event because "the handshake was not verified" -

i developing paypal ipn event listener in c#. using paypal's ipn simulator able send events server , listener receive event. listener receive events using "subscribe" button generated paypal's sandbox. starting few days ago however, sending ipn simulator server fails error message "ipn not sent, , handshake not verified. please review information." when use openssl command openssl s_client -connect api-3t.sandbox.paypal.com:443 -showcerts -capath /etc/ssl/certs/ loading 'screen' random state - done connected(00000114) 2092:error:14077410:ssl routines:ssl23_get_server_hello:sslv3 alert handshake fa ilure:.\ssl\s23_clnt.c:602: as result. noticed in ipn history (which events generated using paypal button) of sandbox merchant account, http status code 500. i've tried editing registry enable tls 1.2 on server, importing verisign g5 root certificate mmc. nothing seems working. certificate i'm using on server go daddy secure cer

c# - Windows Azure web role useUnsafeHeaderParsing="true" not working getting "The server committed a protocol violation. Section=ResponseStatusLine" -

i know post may duplicate have tried every solution method around internet & stackoverflow , have still no idea how fix it. i trying simple other linux-php system windows azure web role, , "the server committed protocol violation. section=responsestatusline" on local machine works on production inside windows azure it's not :-(. i had verified loaded assembly correct, framework version correct. what had tried do: i have tried adding web.config <system.net> <settings> <httpwebrequest useunsafeheaderparsing ="true"/> </settings> didn't work @ all. tried adding these : request.servicepoint.expect100continue = false; request.keepalive = false; servicepointmanager.expect100continue = false; servicepointmanager.maxservicepointidletime = 99999; didn't work @ all. i had tried use http://restsharp.org/ request didn't work @ all. i had tried use https://www.nuget.org/packages/microsoft.net.htt

python - Something about using inorder traversal prints all the items in the Binary tree -

we don't know how print in traversal order , don't know how print out result if enter binary_str, can us? class treenode: def __init__(self , item , left , right): self.item = item self.right = right self.left = left class binarytree: def __init__(self): self.root = none def add(self , item , binary_str): binary_str_itr = iter(binary_str) self.root = self.add_aux(self.root , item , binary_str_itr) def add_aux(self , current , item , binary_str_itr): if current none: current = treenode(none , none , none) try: bit = next(binary_str_itr) if bit == '0': current.left = self.add_aux(current.left , item , binary_str_itr) elif bit == '1': current.right = self.add_aux(current.right , item , binary_str_itr) except stopiteration: current.item = item return current def print

sql - MS Access Grouped Percentage Calculation -

not sure how best explain 1 have table example looks this: date websitepage visits 01/01/2016 visits 50 01/01/2016 basket 40 01/01/2016 checkout 35 01/01/2016 thankyou 25 02/01/2016 visits 43 02/01/2016 basket 23 02/01/2016 checkout 20 02/01/2016 thankyou 12 as can see website pages (fictional example). want create query, access query calculation or sql or vba (limited cant use case statement in access sql), calculate websitepage conversion percentage e.g basket/checkout, checkout/thankyou , visits conversion of thankyou/visits etc. i'm struggling how compile query or write calculation. simple in excel typically. dont want split websitepage out separate columns. can point me in right direction? you use query 4 different counts in 4 different columns make task easier: select [date], sum(iif(websitepage = "visits", visits, 0)) visits, sum(iif(websitepage = "basket"

rest - Extra info in pdf content sent as MULTIPART-FORMDATA in RESTFUL(JERSEY) -

while uploading pdf/text file using jersey client, information being appended original pdf file.(i using jersey glassfish api client) below content getting appended original file when saved in server: --boundary_1_10166575_1464163574882 content-type: text/plain content-disposition: form-data; name="foo" bar --boundary_1_10166575_1464163574882 content-type: application/pdf content-disposition: form-data; filename="abc.pdf"; modification-date="tue, 03 may 2016 06:34:59 gmt"; size=109494; name="inputpdffile" ========================================================================= refer below client source code: final client client = clientbuilder.newbuilder() .register(multipartfeature.class).build(); final filedatabodypart filepart = new filedatabodypart( "inputpdffile", new file( "c:/test/abc.pdf")); formdatamultipa

mathematical optimization - Constraint violation in GLPK (Pulp wrapper) -

i'm using pulp glpk solver , have follow constraint: -1000000*f1 + v1 + 1000000*f2 - v2 >= -10.999 solver: problem.solve(glpk(options=['--mipgap', '0.000001', '--cuts'])) but in result solved problem (status 'optimal') constraint violation: f1 = 0 v1 = 11 f2 = 1 v2 = 1000000 so, can in case? can increase accuracy somehow or use solution? i think, run in problems numerical accuracy. coefficients in order of 1.e7 (and want solution 1.e-6). solution needs @ least correct in 1.e11 hold constraint , argument require maximum 1.e-14 relative error. simply pure numercal solver. (expect maximum 1.e-6 1.e-7 run reliable lp-solver)there exact solvers qsopt , think, soplex got features now. here link qsopt http://www.math.uwaterloo.ca/~bico/qsopt/downloads/downloads.htm here link soplex stuff. http://soplex.zib.de/doc/html/exact.php qsopt available binary (i think) , soplex free research (as understand). further u can use s

java - How to implement a method for multiple strategies having completely different logic? -

i find hard give question concret title, i'm not aware of how name type of problem. suggestions welcome. i have service run logic literally performs same action (eg save thumbnail), contains different logic different providers: @service public class thumbnailservice { public void saveforprovider1(prov1 url) { } public void saveforprovider2(prov2 url) { //completely different logic provider1; different parameter object "prov2" } } problem 1 : new provider have create additional method in thumbnailservice . now @ specific point, want run methods async: //basically async wrapper service @service @async public class thumbnailserviceasync { @autowired private thumbnailservice delegator; public class asyncsaveforprovider1(prov1 url) { delegator.saveforprovider1(url); } public class asyncsaveforprovider2(prov2 url) { delegator.saveforprovider2(url); } } switching an integer variable know numb

c - regarding a line of code on bit operation -

how understand following lines of c# code in terms of bit operation a = 15 & ( ^ (b << 3)); and bit operations in following segment of code, way declare uint8_t a , uint8_t b int decode(const void* raw_in, void* raw_out, uint32_t password, size_t len) { ## code here ## const uint8_t* in = (const uint8_t*)raw_in; uint32_t seed = password ^ 0x48879c19u; (size_t = 0 ; < len; ++i) { uint8_t = (in[i] << 4) ^ seed; uint8_t b = (((uint32_t)in[i]) << 7 ^ seed) >> 11; ....... a = 15 & ( ^ (b << 3)); | | | | | |_left shift (b's bits left shifted 3) | | | |_bitwise xor (a xor result of (b<<3) ) | |_ bitwise , ( 15 , result of above ) similarly >> right shift operator

node.js - how to get all collection names from a specific db in mongo using nodejs -

recently want collection names db in mongo. , develop environment nodejs + express + mongoose. tried mongooser.conncetion.db.getcollectionnames(or listcollections or collections) , not work. guess version problem, maybe latest mongoose api not contain functions. consequently, how obtain collection names db using mongoose? thank help!

angular - In javascript, use object['property string']. How can I do like that in AngularJS 2? -

i have 2 objects. object {'id': 'abc', 'pwd': 'pwd1'} , b object array. b string of object property. this. ['id', 'pwd'] i want use @ ng2 component template. *ngfor(#str of b) {{a[str]}} but not working.. how can javascript? ng2 using {{object.property}}. i don't know how can use javascript! ++ edit vote.. template: '<tr *ngfor="#str of b"> <th>{{str}}</th> <td>{{a[str]}}</td> </tr>' export class @@{ = [{'id': '1', 'pwd': 'pwd1'}]; b = ['id', 'pwd']; } i use that. don't showing values. how can do??? the following code works me: @component({ selector: 'my-app', template: ` <div *ngfor="let str of b"> {{a[str]}} </div> ` }) export class app { = {'id': 'abc', 'pwd': 'pwd1'} b = ['id', 'pwd

html - Add a css class on td of table according to TD less or more value -

i have table in html 2 td content in it. dynamic td. want implement functionality if in each of table row, each big td value text color displayed green , less value text display red; please find source code: fordata+='<tr><td>'+forplant+'</td><td>'+forasking+'</td><td>'+forproduction+'</td></tr>'; $(".fortable").append(fordata); if(forasking<forproduction){ console.info("less value"); //-----here want display whatever value less displayed red , other green }else{ //---same manner followed in there console.info("more asking"); } create 2 classes colors .green{ color:green; } .red{ color:red; } then first compare values append result. fordata+='<tr><td>'+forplant+'</td>'; if(forasking<forproduction){

java - Finding the maximum among three integers and knowing which one is chosen -

i working on code has find best solution. first check whether 1 of 3 larger other two. hence, there maximum occurs once. if there 2 numbers larger third one, equal each other, have compare distance of 2 , 1 smallest distance chosen. the profit functions , distances calculated outside method , not important. what have come far use lot of if statements. however, wondering whether there more efficient method this. public void bestsolution(list<route> ls, list<route> sa, list<route> rr) { int profitls = profitroutes(ls); int profitsa = profitroutes(sa); int profitrr = profitroutes(rr); int distancels = totaldistance(ls); int distancesa = totaldistance(sa); int distancerr = totaldistance(rr); if ((profitls > profitsa) & (profitls > profitrr)) { } } in case of finding max between 3 integers - int mostprofit = math.max(profitls, math.max(profitsa, profitrr)); considering case - "distance of 2 , 1

jasper reports - Tomcat: JRStyledTextParser not Initialized. java.awt is set to true -

Image
i keep getting java.lang.noclassdeffounderror: not initialize class net.sf.jasperreports.engine.util.jrstyledtextparser the full stacktrace is: java.lang.noclassdeffounderror: not initialize class net.sf.jasperreports.engine.util.jrstyledtextparser net.sf.jasperreports.engine.fill.jrbasefiller.<init>(jrbasefiller.java:108) net.sf.jasperreports.engine.fill.jrverticalfiller.<init>(jrverticalfiller.java:69) net.sf.jasperreports.engine.fill.jrverticalfiller.<init>(jrverticalfiller.java:57) net.sf.jasperreports.engine.fill.jrfiller.createbandreportfiller(jrfiller.java:200) net.sf.jasperreports.engine.fill.jrfiller.createreportfiller(jrfiller.java:215) net.sf.jasperreports.engine.fill.jrfiller.fill(jrfiller.java:115) net.sf.jasperreports.engine.jasperfillmanager.fill(jasperfillmanager.java:583) net.sf.jasperreports.engine.jasperrunmanager.runtopdf(jasperrunmanager.java:455) net.sf.jasperreports.engine.jasperrunmanager.runreporttopdf(jasperrunmanager.java:870) com.ev

directory - How to turn a git repository into a subdirectory of a new repo? -

it turns out git repo created betters suits subdirectory, module x , of more general repository. how can copy original history (no signed commits) on such paths have prefix module x\ ? i of course make moving subdirectory new commit, i'd prefer solution makes history if former repo in subdirectory. i tried git subtree add --prefix="module x" ../module_x master temporary parallel folder fresh repository (since otherwise git subtree complains existing prefix), end with fatal: ambiguous argument 'head': unknown revision or path not in working tree. use '--' separate paths revisions, this: 'git <command> [<revision>...] -- [<file>...]' working tree has modifications. cannot add. this seems due lack of initial commit, because if i touch .gitignore git add .gitignore git commit -m"init" it works, end original history in separate branch plus commit of moving, manual solution mentioned before... git

html - image positioning / div height with display flex -

i positioning of 2 box class div's justify-content: flex-end i'd center top img-container div vertically in remaining space above i'm not sure if possible, preferably without javascript. the layout portrait orientation mobile devices. maybe justifying content isn't best approach i'd layout places form elements towards bottom of screen , spaces them responds smaller devices taking space logo area. .flexcontainer { display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: center; align-items: center; -webkit-justify-content: flex-end; justify-content: flex-end; /*iphone 4*/ height: 480px; width:320px; /*iphone 6*/ /*height: 667px; width:375px;*/ background-color: blue; border: 1px solid red; } .box { text-align:center; height: auto; width: 100%; background-color: green; border: 1

How to remove icon glare in XCode 5 / iOS 7? -

Image
i using xcode 5 developer preview create ios 7 app. in ios 7, glare effect of icon not exist anymore. that's fine. now, when run app compiled xcode 5 on ios 6 device (or simulator) see glare effect on icon! usual ways of disabling glare (editing app-info.plist file) don't work anymore. so question is: how can disable glare effect on ios 6 in app compiled xcode 5? side note: i'm using asset library configure different icon sizes. as nda has been lift, can tell answer: go images.xcassets in xcode 5 project look appicon select iphone app ios 5,6 57pt in inspector side bar, tick/untick "ios icon pre-rendered" checkbox wish!

Install ruby requirements on ubuntu -

i'm trying installation steps http://sharadchhetri.com/2014/06/30/install-jekyll-on-ubuntu-14-04-lts/ linux@ubuntu:~$ rvm requirements checking requirements ubuntu. installing requirements ubuntu. updating system................... error running 'requirements_debian_update_system ', showing last 15 lines of /home/jobi/.rvm/log/1464166761/update_system.log + case "${term:-dumb}" in + case "$1" in + [[ -t 2 ]] + return 1 + printf %b 'there has been error while updating '\''apt-get'\'', please give time , try again later. 404 errors should fixed rvm proceed. check sources configured in: /etc/apt/sources.list /etc/apt/sources.list.d/*.list \n' there has been error while updating 'apt-get', please give time , try again later. 404 errors should fixed rvm proceed. check sources configured in: /etc/apt/sources.list /etc/apt/sources.list.d/*.list + return 100 requirements installation failed status:

javascript - How to filter a liste of checkboxes? -

i beginner in js/jquery, , trying code input zone allows show items contain letters entered user in input. did following example, list in case static, , i'm trying create function list variable. https://jsfiddle.net/m33d/ffudxhqv/ this did resolve problem, doesnt work. , don't know do https://jsfiddle.net/m33d/ae2wlnfp/ i tried function (autocomplete) of jquery , doesn't work: function filtreraptitudes() { var listedesaptitudes = jquery('#conteneuraptitudes input'); var nbritem = listedesaptitudes.length; var availabletags = []; for(var i=0; i<nbritem; i++) availabletags.add(listedesaptitudes[i].name); $( "#conteneuraptitudes" ).autocomplete({ source: availabletags }); }; thank in advance time , help.

javascript - How to pass image,title and description to Bootstrap Modal popup? -

how can pass image,title , description bootstrap modal? when 1 image link click modal open image title , description. code is: <?php $result = mysql_query("select * project"); $file_path = 'admin1\projectimages/'; while($post=mysql_fetch_array($result)){ $id=$post['id']; $ptitle=$post['title']; $image=$post['image']; $des=$post ['description']; $src = $file_path . $post['image']; echo'<li class="col-md-4 col-sm-6"><a href="#modal" class="fa" data-toggle="modal" data-placement="right"><h4 class="project_heading">'.$ptitle.'</h4></a> <a href="#modal" class="fa ok " data-toggle="modal" data-target="#modal" data-placement="right"><img src='.$src.' style="width:250px; border:1px solid red;&quo

python - There is an errors embed album art with mutagen? -

the problem is, whenever embed picture mp3 , mp3 file increase less bytes picture is. i'll explain in code: import os mutagen.mp3 import mp3 mutagen.id3 import id3, apic, error mutagen import file audio = id3() open('111.mp3', 'rb') f: rawfile = f.read() dirpath, dirnames, filenames in os.walk('e:/exp/apic'): fname in filenames: path = os.path.join(dirpath, fname) ap = apic( encoding = 3, mime = 'image/jpg', type = 3, desc = u'cover', data = open(path, 'rb').read() ) sz_changed = os.stat('111.mp3').st_size audio.add(ap) audio.save('111.mp3') sz_changed = os.stat('111.mp3').st_size - sz_changed print u'lost bytes:%d' % (len(ap.data)-sz_changed) open('111.mp3', 'wb') f: f.write(rawfile) #reset the code shows can't embed whole pictur

java - Difference between maxUploadsize and maxInMemorySize -

what difference betweenn maxuploadsize , maxinmemorysize in commonsmultipartresolver maxuploadsize : maximum upload size single request. means total size of upload files cannot exceed configured maximum. default unlimited (value of -1). can set maxuploadsize , value property. maxinmemorysize : files size below value stored in memory, otherwise stored in disk directly. default 10kb (10240 bytes). or can customize maxinmemorysize , value property .

javascript - How do I find the sum value of an array of objects in a loop? -

Image
i'm not sure if wording of question accurate based on description of problem please edit if can more accurate. i trying build stamp duty calculator improve js, have array of objects different "bands" , "percents" using calculate tax based on users input. have attached image better understanding i displaying amount of tax each band in table , trying find total tax finding sum of values in "tax" column. currently displaying highest value. i have tried can thing off , nothing has worked, how can fix this? here code, $(function (jquery) { (function stampdutycalculator() { var taxbands = [ { min: 0, max: 125000, percent: 0 }, { min: 125000, max: 250000, percent: 0.02 }, { min: 250000, max: 925000, percent: 0.05 }, { min: 925000,

jenkins - How to build a svn project that depends on other svn project -

i try jenkins ci of project ! for building project, need 3 others svn modules (that contains other project). for example, project architecture : - https://scm-svn/myproject/build - build subproject 1 - build subproject 2 - build subproject 3 - https://scm-svn/myproject/common - common subproject 1 - common subproject 2 - common subproject 3 - https://scm-svn/myproject/server - server subproject 1 - server subproject 2 - https://scm-svn/mainproject/server - main project server 1 main project server 1 contains build.xml ant file build whole project (with modules) when in same workspace (like eclipse does). in jenkins, when use svn module, after each new module, workspace cleaned ! so try use "clone workspace plugin", i've created new project each svn module , create workspace.zip each projects. but in mainproject configuration, how can configure copy/past others subproject workspace mainproject's workspace ? in way ab

php - PHPMailer get addresses from file -

i'm trying get addresses simple text file , people don't understand code can still add/remove or change adresses. phpmailer working totally fine when set address normally , writing directly in code, , array , foreach. so @ moment have : mail.php : //all phpmailer settings on $mail var $addresses = file('mail.txt', file_ignore_new_lines); foreach($addresses $email) { echo "$email<br>"; $mail->addaddress($email); } mail.txt : 'first@address.com' 'second@address.fr' the echo return both addresses var doesn't seem work in addaddress() line, , usual error : mailer error: must provide @ least 1 recipient email address. thanks correcting me if i'm wrong or if know other solution work ! okay here working code corrected of waqas shahid : mail.php : //all phpmailer settings on $mail var $addresses = file('mail.txt', file_ignore_new_lines); foreach($addresses $email) { $email = trim($emai

android - How to inject same Dagger 2 dependency with different implementations based on the Context? -

i have dagger 2 dependency provided differently if it’s activity or other context instance (e.g., service ). both refer same interface implementation varies. how organise using dagger 2? right now, i’m trying 2 different components, activitycomponent , contextcomponent respective modules follows: @activityscope @subcomponent( modules = { activitymodule.class, contextmodule.class }) public interface activitycomponent { } @module public class activitymodule { @provides @myactivityqualifier public myobject providemyobject() { } } @contextscope @subcomponent( modules = { contextmodule.class }) public interface contextcomponent { } @module public class contextmodule.class { @provides public myobject providemyobject() { } } then, if i’m using myobject in activity , have add qualifier follows: @inject @myactivityqualifier myobject myobject; t

python - Share in-memory database between processes sqlite -

it possible [in way, poorly hacked solution] share in-memory database between many processes? application has 1 process opens in-memory database , other running select queries on database. note: need solution python 2.7, , btw if matters module use making new processes multiprocessing . on linux can use /dev/shm file location of sqlite. this memory mounted drive suitable that.

How to set iOS system alert sounds as push notification sound like Whatsapp does -

Image
i'm aware of apple documentation setting custom push notification sound ios here . said can set sounds located either in app's main bundle or in library/sounds folder app's data container. however, can seen in images below, whatsapp ios allows user select sounds same alert system sound ios, example, popcorn, circles , on. my question is, there way use system sounds push notifications alert or whatsapp copy/paste same sounds main bundle? as far know, have copy/paste same sounds app's main bundle. however, careful legal issues of sounds use. there question's answer here might find how it.

database - MySQL Order by before group by in view (No Sub-Querys) -

i realize question has been asked quite few times, haven't managed find working solution case. essentially problem arises because mysql doesn't allow sub-querys in views. found few workarounds don't seem work. in more detail... my first table (competitions) stores users competitions: id_tournament | id_competition | id_user | result ------------------------------------------------- 1 | 1 | 1 | 10 1 | 1 | 2 | 30 1 | 2 | 1 | 20 1 | 2 | 3 | 50 1 | 3 | 2 | 90 1 | 3 | 3 | 100 1 | 3 | 4 | 85 in example there 3 competitions: ( user1 vs. user2, user1 vs. user3, user2 vs. user3 vs. user4 ) my problem need define view gives me winners in each competition. expected result: id_tournament | id_competition | id_winner -------