Posts

Showing posts from April, 2010

android - how to call getWritableDatabase() from a different thread or intent service, App crashing on calling it in the main thread -

this main activity import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.edittext; import android.widget.textview; public class mainactivity extends appcompatactivity { edittext myinput; textview mytext; mydbhandler dbhandler; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myinput =(edittext) findviewbyid(r.id.myinput); mytext =(textview) findviewbyid(r.id.mytext); dbhandler= new mydbhandler(this, null, null, 1); printdatabase(); } //add product database public void addstuff(view view) { products product = new products(myinput.gettext().tostring()); dbhandler.addproduct(product); printdatabase(); } //delete items database public void deletestuff(view view) { string inputtex

ruby on rails - Use devise to route to specific url -

when user not signed in visits homepage gets redirected users/sign_in which has sign in form. when user signs in gets redirected root of page. http://localhost:3000/#/_=_ but want user redirected url http://localhost:3000/#/home i've found this on devise page. def after_sign_in_path_for(resource) current_user_path end but i'm not sure how should change code devise redirect users http://localhost:3000/#/home corrosponds router-ui state. .state('home', { url: '/home', templateurl: '../assets/angular-app/templates/_home.html.haml', controller: 'mainctrl', resolve: { postpromise: ['posts', function(posts){ return posts.getall(); }] } }) try in application controller def after_sign_in_path_for(resource) "your_path_here" end for example if want go root_path "your_path_here" = root_path

c++ - Is erasing element after before_begin() defined in an empty std::forward_list? -

does code have defined behaviour in c++ standard library? std::forward_list<t> list; list.erase_after(list.before_begin()); intuition no, haven't been able locate exact standards wording particular case. the precondition on erase_after is: iterator erase_after(const_iterator position); requires: iterator following position dereferenceable. so example has undefined behaviour, because list empty, list.before_begin() not incrementable, there no iterator following it. if list has @ least 1 element list.erase_after(list.before_begin()) valid.

c# - Json class definition, is my structure correct for deserialization? -

i trying dezilirze json class used tool @ http://json2csharp.com/ transform json request following { "movie_details": { "id": "1", "name": "movie 1", "description": "movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n\r\nmovie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n\r\nmovie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n\r\nmovie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n\r\nmovie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n\r\nmovie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1movie 1\r\n", "image": "http:

java - Regular Expression that does not match a given sequence -

i need regular expression matches text description: "any sequence not f (upper case only) followed run of 1 or more digits (0-9)". this needs go input java's scanner.usedelimiter(). suppose input line this: f8 has pretty solid open source cred: in f12 founded f25, f44 of f1 , f121, , helped pave way f99. the tokenizer class scanner should retrieve f8, f12, f25, f44, f1, f121 , f99 me. alternately, java allow negating given regex? use pattern , matcher classes fetch chars want. matcher m = pattern.compile("\\bf\\d+").matcher(s); while(m.find()) { system.out.println(m.group()); }

php - Login Session doesn't work first time -

i'm having trouble login session. it's working fine issue doesn't work first time when login, instead keeps on loading until login second time. below code of login session. please me out in it. login.php <?php session_start(); $error=''; if (isset($_post['submit'])) { if (empty($_post['username']) || empty($_post['password'])) { $error = "username or password invalid"; } else { $username=$_post['username']; $password=$_post['password']; $connection = mysql_connect("localhost", "root", "12345"); $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $db = mysql_select_db("company", $connection); $query = mysql_query("select * login password='$password' , username='$username'", $connection); $rows = mysql_num_rows($query);

linker - Linking to the MariaDB C Connector from Rust fails on Windows -

i working on rust project requires me connect mariadb server. have decided create rust bindings officially provided c connector, works fine in linux, not on windows. since msvc-binaries provided download, don't work due linker issues between microsft linker , mingw linker used rust cause program crash when first function called, tried compile mariadb sources myself, though compilation under mingw should work of 2.0 release of mariadb, fails with error: conflicting types ssize_t typedef ssize_t ssize_t since has been defined in file, , when tried remove redefinition, other errors occured. i tried cross-compile arch using mingw-w64-mariadb-connector-c package , did not show compilation errors connector, when tested binaries on windows, threw undefined reference linking error every of c-function declarations, this: extern crate libc; use self::libc::{c_int, /*...*/}; #[link(name="mariadb", kind="dylib")] extern { pub fn mysql_init(mysql: *

elasticsearch - Difference between Rsyslog and Packetbeat -

while surfing through internet came accross rsyslog term monitoring , logging tool. fer points collected : 1.multi-threading 2.tcp, ssl, tls, relp 3.mysql, postgresql, oracle , more 4.filter part of syslog message 5.fully configurable output format 6.suitable enterprise-class relay chains similarly packetbeat used monitor network packets , uses elasticsearch , kibana. packetbeat monitors tcp, mysql etc. so prime diff between these two? rsyslog unix , unix operating system while on other hand packetbeat provides support operating systems. apart packetbeat can used analyze following protocols: icmp (v4 , v6) dns http mysql postgresql redis thrift-rpc mongodb memcache while rsyslog provides support following protocols: 3195 auditd gssapi journal klog kmsg mark ptcp relp solaris tcp udp uxsock zmq3 so use cases of both rsyslog , packetbeat varies if want monitor rest api transactions , mongo db tra

htmlspecialchars - powermail and the special characters -

i have known issue special characters < > " & , powermail extension in typo3. googled , found it's related double trigger of htmlspecialchars in 2 files. tried many suggestions didn't help. - removed htmlspecialchars class.tx_powermail_html.php. - removed class.tx_powermail_markers.php. - ... does has exact solution issue? in advance. ps: using v. 1.6.9 on typo3 4.5 well , i find answer in case faces same problem. comment out both appearances of "htmlspecialchars" in function sec() in "lib\class.tx_powermail_functions_div.php". that should fix

indexing - How Oracle manages constraints and indexes bound to them -

i've encountered situation can't understand. i've created patch db, drops constraints(private keys) , drops indexes bound constraints. worked flawlessly few times on test environment. when run on prod crashed on first index. test db re-created test production few times(but don't know how done exactly) , there wasn't problems. how possible error didn't occurred while testing? it possible dropping constraint drops supporting index, depending on how constraint , index created in first place, script ought check that. it more robust create non-unique indexes , add primary , unique constraints use indexes, can drop constraint without losing benefits of having index in place. the difference in behaviour when dropping constraints based on existing or system-generated index documented here: http://docs.oracle.com/database/121/sqlrf/clauses002.htm#cjagebig

sql server - DataSet Performance -

could explain me why there such difference when comes filling , updating dataset? working on program takes data 1 db , puts them second db. original db contains quite lot of data. wonder why fast program fill dataset data, long update. code schema looks that: create connections; openconnections(); create dataadapter1, dataadapter2; create commandbuilder1, commandbuilder2; create dataset; dataadapter1.fill(dataset, connection1); dataadapter2.update(dataset, connection2); closeconnections();

dhtmlx - Scrollable cell with multiple attached components in dhtmlxLayout -

i attache cell several tabbars follows 1 , found in cell scrolling content. possible? you can use next way of appending different objects like here . divs tabbars containers and can use method showinnerscroll() force cell's scroll

oracle - SQL: DISTINCT not working with cursor -

am facing issues sql query not returning distinct values, having sql query below mentioned select distinct m.firstname, m.secondname, m.creation_date, cursor (select distinct o.certifications, o.country othertable o o.othertable_id = m.maintable_id ) details maintable m m.manager_id = 100 here maintable has 20 records respective manager (100), 1 record available below mentioned columns. select distinct m.firstname, m.secondname, m.creation_date maintable m m.manager_id = 100 but when executed cursor returning 20 rows, without consideration of distinct. i tried below query, need above mentioned format. select distinct m.firstname, m.secondname, m.creation_date, o.certifications, o.country maintable m left join othertable o on o.othertable_id = m.maintable_id m.manager_id = 100 could please let know, how achieve this? this bit difficult explain, i'm going try. your comparison query is select distin

Swift, SSL Self Signed certificate IOS8+ -

i want implement ssl in webservice call. having error below: nsurlconnection/cfurlconnection http load failed (kcfstreamerrordomainssl, -9813) my code below func checknetworkconnection(callback: ((isconnected: bool) -> void)!) { var checknetworkurl: string = “testurl” var request = nsmutableurlrequest(url: nsurl(string: checknetworkurl)!) request.httpmethod = "post" request.addvalue("application/xml", forhttpheaderfield: "content-type") request.addvalue("application/xml", forhttpheaderfield: "accept") request.timeoutinterval = 20000.0 var response: nsurlresponse? var error: nserror? var data = nsurlconnection.sendsynchronousrequest(request, returningresponse: &response, error: &error) if error == nil{ if data != nil{ self.parser.getloginresultdatadictionary(data!) {(datadictionary) -> void in if let datadict = datadi

UI-Router Reload State without a full page refresh -

currently if want reload state, have use $state.reload(). causes full page refresh, unfriendly. looking way re-resolve dependencies , reset controller. possible? just add on @dag 's answer: do note, of 0.2.14 have option reload current state , not it's parent. so $state.go(people.search, {}, {reload: true}); reload people state childs. while $state.go(people.search, {}, {reload: "people.search"}); not reload people state reload people.search , childs.

osx - Docker Toolbox Mac command line and Kitematics fails -

Image
i have installed new docker toolbox application mac using both graphical installer (the official one) , brew cask install . in both cases, virtual machine correctly created, seems wrong in environment because when try execute docker-machine on command line, fails this: $ docker-machine env default open /users/adeynack/.docker/machine/machines/default/ca.pem: no such file or directory when try kitematics , fails this: i tried delete vm , retry setup , without success. insight or idea welcome here. edit: using test build 5.0.3 of virtualbox. this may have been caused issue virtualbox . issue has been fixed latest testbuild virtualbox here: virtualbox test build . you have uninstall current version of virtual box , install test build. edit you may need create new docker machine. create new docker machine: docker-machine create --driver virtualbox dev next, start dev environment: docker-machine env dev set environment dev machine: eval "$(do

OpenCL program on amazon EC2 hanging at the end -

i have opencl c++ program i'm running on nvidia gpu-enabled ec2 instance. quite often, @ end of program, hangs, , end having stop instance out of it. here end of code, there should doing differently? /* finalization */ ret = clflush(command_queue); printf("clflush: %s\n", geterrorstring(ret)); ret = clfinish(command_queue); printf("clfinish: %s\n", geterrorstring(ret)); ret = clreleasememobject(ymobj); printf("clreleasememobject: %s\n", geterrorstring(ret)); ret = clreleaseprogram(program); printf("clreleaseprogram: %s\n", geterrorstring(ret)); ret = clreleasekernel(kernel); printf("clreleasekernel: %s\n", geterrorstring(ret)); ret = clreleasecommandqueue(command_queue); printf("clreleasecommandqueue: %s\n", geterrorstring(ret)); ret = clreleasecontext(context); printf("clreleasecontext: %s\n", geterrorstring(ret)); free(source_str); free(y); exit(0); typically can see output command following clfin

sqlite - Unable to set values in javascript array -

i unable set project activities inside clientsdata. here scenario by time control reaches inside callback function of executesql, values of , j maximum possible values because executesql() asynchronous function. when try execute following line clientdata[i].projects[j].activities = result.rows; it gives me error saying "cannot read property 'projects' of undefined" code snippet (var = 0; < clientdata.length; i++) { (var j = 0; j < clientdata[i].projects.length; j++) { var getactivities = "select * activity \n\ activityid \n\ in \n\ (" + clientdata[i].projects[j].activityids + ")"; tx.executesql(getactivities, [], function (tx, result) { clientdata[i].projects[j].activities = result.rows; updateclientdata(clientdata); }); } }

java - Fiddler doesn't capture Apache HttpClient post -

somehow fiddler doesn't capture posts send httpclient provided apache. but when send same post in c# using httpclient same server, fiddler intercept sessions. my java code: private defaulthttpclient client = new defaulthttpclient(); private httpcontext context = new basichttpcontext(); private basiccookiestore store = new basiccookiestore(); public client() throws urisyntaxexception { context.setattribute(clientcontext.cookie_store, store); login(); } private void login() throws urisyntaxexception { httpurirequest login = requestbuilder.post() .seturi(new uri("http://www.derpforum.nl")) .addparameter("username", "kattoor4") .addparameter("password", "xxxx") .addheader("referer", "http://www.derpforum.nl/") .build(); try (closeablehttpresponse response = client.execute(login, context)) { httpentity entity = response.get

c# - Azure Table Storage Client Side Encryption WITHOUT Using KeyVault -

i've got sensitive information want encrypted , stored in azure table storage. honestly, naive approach, using same aes key values sufficient near approach having enough data encrypted in order meaningful cryptanalysis. but, know best practice limit usage of same symmetric key. recently, microsoft released client side encryption azure table storage via azure keyvault. allows generate rsa key , store in keyvault , client library generate new symmetric key every row in table storage , encrypts symmetric key rsa key. perfect because there no way differential cryptanalysis on ciphertext since used different keys. nice because library plumbing, have grab rsa key keyvault, decorate designated properties encryptpropertyattribute , handles else. therein lies rub... find keyvault kind of obtuse use , manage. have use powershell set oauth authentication between app , keyvault , looks tremendous amount of overhead storing single rsa key. if have hundreds of keys store, can imagine mo

javascript - AngularJS and jQuery... What's wrong with using both? -

i saw few blog articles saying angularjs , jquery used in 1 app. seems jquery has functionalities angular doesn't have , angular allows make structured logic web app. the fact is, i'm french take @ french blog articles that, , french tends should never use jquery , angular together. asked why on forum , people said it's because beginners use jquery , angular same things : adding elements dynamically, use ajax requests, etc... i'd use jquery things angular not , allow bootstrap js work on app. what think, jquery , angular bad @ working in 1 single app? or depend on how make them work together? angularjs uses jquery itself, major reason not mix , match described of them stepping on each other's toes. while learning angular lot of time end using jquery alongside because didn't understand angular or know it's full capabilities. after learning better code has continuously less jquery in it, if can't figure out in angular, i'll make sure

excel vba - arrays vba - type mismatch: array or user-defined type expected -

i having issue passing array sub (receiving type mismatch: array or user-defined type expected). have worked array structures in other languages , must missing here in vba since can't work. have posted code snippets below comment: private sub x() dim ssn_vals(1 9) string dim ssn_cells(1 9) string 'define employee object dim emp employee 'create new employee foreach row set emp = new employee 'ssn values ssn_vals(1) = cell.offset(0, 60) ssn_vals(2) = cell.offset(0, 61) ssn_vals(3) = cell.offset(0, 62) ssn_vals(4) = cell.offset(0, 63) ssn_vals(5) = cell.offset(0, 64) ssn_vals(6) = cell.offset(0, 65) ssn_vals(7) = cell.offset(0, 66) ssn_vals(8) = cell.offset(0, 67) ssn_vals(9) = cell.offset(0, 68) 'ssn cell addresses ssn_cells(1) = cell.offset(0, 60).address ssn_cells(2) = cell.offset(0, 61).address ssn_cells(3) = cell.offs

android - Muzei database doesn't update when I update external JSON -

i'm in middle of making wallpaper app android , i'm have problem muzei support , hoping here can me see i'm missing. i have json file app uses wallpaper urls , display pictures from. works fine , gets right images. if update json more entries , more images muzei extension still uses old database. thinking maybe caches database , doesn't update whatever reason. way use updated json file clear data of app , set different extension in muzei , reset muzei extension. not user friendly. probably being blind appreciated. artsource.java: package com.main.walls.muzei; import android.content.intent; import android.net.uri; import android.util.log; import com.google.android.apps.muzei.api.artwork; import com.google.android.apps.muzei.api.remotemuzeiartsource; import com.google.android.apps.muzei.api.usercommand; import com.main.walls.utilities.preferences; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.me

asp.net mvc - Query String Formatting not working in MVC2 -

i trying create url query string in mcv application here code <%= html.actionlink(resources.strings.signin_lbl, "signin", "account", new { lang = viewdata["user-language"] })%> and here generated url mydomain.com/admin/account.aspx?length=7 you're using wrong overload of html.actionlink if remember correctly, may using overload takes in htmlattributes parameters, pass in null. <%= html.actionlink(resources.strings.signin_lbl, "signin", "account", new { lang = viewdata["user-language"] }, null)%>

ios - Can't put image inside tableviewcell -

Image
i have other tables working ok, 1 not working. image dont stay inside cell (see little lines): i want this: the mode aspect fit, ive tried , nothing seems work. my code: import uikit import parse class pratosviewcontroller: uiviewcontroller,uitableviewdatasource,uitableviewdelegate { var restauranterow: pfobject! @iboutlet var tableview: uitableview! @iboutlet var scroller: uiscrollview! @iboutlet var titulorestaurante: uilabel! @iboutlet var imagemrestaurante: uiimageview! override func viewdidload() { super.viewdidload() scroller.contentinset = uiedgeinsetsmake(0, 0, 400, 0) navigationcontroller?.navigationbar.tintcolor = uicolor.blackcolor() titulorestaurante.text = restauranterow["nome"] as? string } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } override func viewwilllayoutsubviews() { super.viewwilllayoutsubviews() self.scroller.f

angular - Angular2 Routing -

i following this tutorial of routing in angular, , doesn't work. when use 'comp' selector put it's html code, works, when i'm trying route router-outlet, shows header index.html . i have following: main.ts: import * ng 'angular2/angular2'; import {comp} './comp'; @ng.component({ selector: 'my-app' }) @ng.view({ directives: [ng.formdirectives, ng.routeroutlet], template: ` <nav> <ul> <li>start</li> <li>about</li> <li>contact</li> </ul> </nav> <main> <router-outlet></router-outlet> </main> ` }) @ng.routeconfig([{ path: '/', component: comp }]) class appcomponent { } ng.bootstrap(appcomponent, [ng.routerinjectables]); comp.ts: import * ng2 'angular2/angular2'; @ng2.component({ selector: 'comp' }) @ng2.view({

How to add global parameters to Meteor Iron Router? -

i can specify specific route in iron router router.path('/:lang/path') and change language according :lang parameter in beforeaction(). how can on global scale, e.g. every path should have :lang prefix? (and yes know there iron-router-i18n package this, cannot use in context). here's 1 pattern might efficiently: var myroutes = ['about','info','help','item','post']; // list of layouts (use own names) myroutes.foreach(function(r){ // create routes /:lang/routename router.route(':lang/'+r,{ name: r, controller: 'mycontroller' }); }); mycontroller = routecontroller.extend({ // define own controller onbeforeaction: function(){ session.set('language',this.params.lang); // set language } });

c# - Get variables from text File -

i have text file each item in <> , sepperated , there no spaces. i need able read total number of records , asign variable. also need asign each item in row variable , number of row variable. can processed later. i have search internet seem going in circles, or source ideas appriciated. instructions not clear, give try. using system; using system.data; using system.io; using system.collections.generic; class test { public dictionary<int, string> readandsortfile() { streamreader sr = new streamreader("file.txt"); dictionary<int, string> dic = new dictionary<int, string>(); int loop = 0; while (!sr.endofstream) { dic.add(loop, sr.readline()); loop++; } sr.close(); return dic; } } your result should this: [0] {[0, <a>]} [1] {[1, <b>]} [2] {[2, <c>]}

Ruby: adding a new element to each array in an array, such that the new element is the downcased version of an existing element -

if @users = user.all.group_by(&:iso).map{|k,v| [k, v.count]} returns [["gb", 1], ["gi", 3], ["bd", 1]] why can't this @users = user.all.group_by(&:iso).map{|k,v| [k, v.count, k.downcase]} to [["gb", 1, "gb"], ["gi", 3, "gi"], ["bd", 1, "bd"]] i getting error undefined method `downcase' nil:nilclass how this. if @user_json = user.all.group_by(&:iso).map{|k,v| [k, v.count, k.inspect]} i [["gb", 1, "\"gb\""], ["gi", 3, "\"gi\""], ["bd", 1, "\"bd\""] and @user_json = user.all.group_by(&:iso).map{|k,v| [k, v.count, k.inspect.downcase]} [["gb", 1, "\"gb\""], ["gi", 3, "\"gi\""], ["bd", 1, "\"bd\""] v. confused for more details - works (but if wro

MYSQL variable In php query -

i trying query multiple mysql statement in 1 query failed. $testq =""; $testq .= mysql_query("set @@group_concat_max_len = 5000"); $testq .= mysql_query("set @sql = null"); $testq .= mysql_query("select group_concat(distinct concat( 'max(if(property_name = ''', property_name, ''', value, null)) ', property_name ) ) @sql properties"); $testq .= mysql_query("set @sql = concat('select item_id, ', @sql, ' properties group item_id')"); $testq .= mysql_query("prepare stmt @sql"); $testq .= mysql_query("execute stmt"); $da = mysql_query($testq, $dbconnect); while($rt = mysql_fetch_assoc($da){ //print } error is: warning: mysq

java - JPA 2.1 - Not able to call Oracle function -

i not able call oracle function through jpa 2.1. same function works fine jdbc callablestatement. i have below definition in entity class. @namednativequery(name = "getallairlinesnq", query = "{? = call pkg_airlines.get_airlines()}", resultclass = airline.class, hints = { @queryhint(name = "org.hibernate.callable", value = "true") }) and in dao call oracle function this, entitymanager entitymanager = entitymanagerfactory.createentitymanager(); query query = entitymanager.createnativequery("getallairlinesnq"); list<airline> airlines = query.getresultlist(); return airlines; oracle function: function get_airlines return sys_refcursor o_cursor sys_refcursor; begin open o_cursor select a1.id id, a1.name name, a1.alias alias, a1.iata iata, a1.icao icao, a1.call_sign call_sign, a1.country_code country_code

java - how to call method of one fragment from another fragment class in android -

i want call method of fragmentb (class) fragmenta tried making object of fragmentb in fragmenta (class) it's not working here code of fragmenta in class have method through call method of fragmentb class adddata.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { boolean isinserted = mydb.addalldata(monthly_income.gettext().tostring(), room_rent.gettext().tostring(), mess_rent.gettext().tostring()); if (isinserted = true) toast.maketext(getactivity().getbasecontext(), "data inserted", toast.length_long).show(); else toast.maketext(getactivity().getbasecontext(), "data not inserted", toast.length_long).show(); } } ); i want call method of fragmentb public void show() { cursor res = mydb.getalldata(); stringbuffer buffer = new stringbuffer(); while (res.movetonext()) {

angularjs - Empty href tag returns current url on remote server -

i left few href tags without values. after deploying application remote server, tags filled url corresponding app location on server. so, if application lived @ http://www.foo.org/ , href = "" gets replaced href = "http://www.foo.org/" . why? empty assumes href="#" try using <a href="javascript:void(0);">click</a> or <a href="" onclick="event.preventdefault();">click</a>

python - Django loaddata error doesn't show message -

i have mezzanine app , purpose move data sqlite3 prostgres. found solution solved erors. have wrong again , can't understand happend because got name of error django.db.utils.dataerror . here full traceback: manage.py loaddata dump.json traceback (most recent call last): file "d:\gitrepos\newbesturfu\manage.py", line 14, in <module> execute_from_command_line(sys.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute() file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\python27\lib\site-packages\django\core\management\base.py", line 393, in run_from_argv self.execute(*args, **cmd_options) file "c:\python27\lib\site-packages\django\core\management\base.py", line 444, in execute output = self.handle(*args,

sql - MSsql select count case only if > 0 -

i have query select , display values matching criteria with cte ( select row_number() over(order cars.make asc,cars.model asc) rn, cars.id, cars.make cars left join transport on cars.transportfrom=transport.id make in ('daihatsu','dodge','jeep','kia','lancia') ) select make, count(case when rn between 51 , 100 1 end) countinresponse, count(1) total cte group make i got result make | countinresponse | total daihatsu | 0 | 5 dodge | 0 | 2 jeep | 0 | 14 kia | 10 | 39 lancia | 17 | 17 but how result > 0? make | countinresponse | total kia | 10 | 39 lancia | 17 | 17 with cte ( select row_number() over(order cars.make asc,cars.model asc) rn, cars.id, cars.make cars left join transport on car

Simplify SQL Query to look in a list -

i have query like select * table filename = "abc.exe" or filename = "test.txt" or filename = "def.exe" .... or is there way simplify 'cleaner' can where filename = ("abc.exe", "test.txt", "def.exe", ...) use in operator instead of multiple or conditions. = cannot compare more 1 value where filename in ("abc.exe","test.txt","def.exe",..)

css - Make materialize labels move out of input box when input box is filled via javascript -

normally, materialize , labels text input boxes show inside input boxes until user enter selects box , enters text in it. however, when box's value filled via javascript, label not move out of way. stays in box , overlaps text entered. there way trigger label transition javascript well, doesn't happen? more specifically, if using materialize in rails turbolinks enabled, find materialize form fields prefilled non-empty values not active on page load. the following method worked me: $(function() { materialize.updatetextfields(); }); it add class 'active' both corresponding labels , prefix icons.

ruby on rails - Query about calling instance variables in view -

i'm calling following in application.html.erb view layout <%= @time %> and what's in application controller: def time_now @time = time.current end yet time not displaying on browser. helps? thanks are sure calling method time_now somewhere in your, say, index method? e.g., try following in application controller (and make sure no 1 overriding method in subclass: def index @time = time.current end so if config/routes.rb has root 'welcome#index' , make sure welcomecontroller not have index method or calling super applicationcontroller#index method called set @time .

sql - How query works with missing Group by values -

i tryng write query pull total discount revenue of customer's orders day. note each ship_id there several items want have sum clauses below , in end, have group , want group them ship_id (this unique each order). i got result of 2m rows (this correct because big) not sure if group correct. if put ship_id there? how query understands it? d.ship_id ,to_char(d.order_datetime,'yyyy/mm/dd hh24:mi:ss') datetime_order ,to_char(d.order_datetime, 'd') day_order ,to_char(d.order_datetime, 'mm') month_order ,sum(di.discount) discount ,sum(di.price * di.units) price table1 d join table2 di on d.ship_id = di.ship_id group d.ship_id ,to_char(d.order_datetime,'yyyy/mm/dd hh24:mi:ss') ,to_char(d.order_datetime, 'd') ,to_char(d.order_datetime, &#

android - format a string with fill places -

i have setup edittext box , set maxlength 10. when copy edittext string mytitles. need mytiles 10 chars long , not dependent on entered in edittext box. mytitles[0] = titlesedit.gettext().tostring(); the edittext filled abcd need add 6 spaces or placeholders after abcd. have seen other post str_pad , substr without success mytitles[0] = str_pad(strtest, 0, 10); mytitles[0] = substr(strtest,0, 10); try like public static string newstring(string str) { (int = str.length(); <= 10; i++) str += "*"; return str; } this return string * replaced empty ones. so, eg, if string abcde , on calling newstring() below mytitles[0] = newstring("abcde"); will return abcde***** output.

javascript - Dynamically Change Three.js texture in externally loaded Collada file -

i using three.js collada loader import .dae file texture (.png) image applied. need overwrite .png file new texture, , creating texture using canvas element exports .png format. if clear cache, change texture (i naming exported "new" .png texture same filename original .png texture referenced in .dae file). how can ensure new texture recognized/rendered without having user clear cache? example: user creates new texture, , exported on original texture, , collada file re-renders after user clicks button render box. once have javascript image object in memory, regardless of source, can assign objects' materials' textures via .image attribute. you'll need let thre.js know alter binding. example, if have new image called, say, img , mesh called mesh typical material: mesh.material.map.image = img; mesh.material.map.needsupdate = true; should trick. no need send dom elemetn disk .png, use it.

division - check whether infinitely long binary number is divisible by 3 or not -

a infinitely long stream of 0's , 1's coming ,you have find out whether number formed far divisible 3 or not. i tried finding decimal equivalent of binary number , summing digits , finding if sum divisible 3 or not. know wrong method because number infinitely long after time number out of range. approach this. another approach find out positions set bits , odd positions set bits , if difference of total number of set bits odd , positions divisible 3 number divisible 3. here after sum time number out of range. is there better approach? just keep track of x = current number mod 3. if b next bit, update: x = (2*x + b) % 3 when x = 0 current number divisible 3

javascript - Chutzpah exception and not refreshing test list -

i'm using visual studio 2015 enterprise chutzpah test javascript code. error below continuously. it not matter whether parallel set 1 or 8. error same. as consequence, obviously, test explorer window not list tests described in file. i'm not using references in spec files, in chutzpah.json file. is there needed figure out how fix this? update : works fine references, but, reason why converted project don't want copy-pasting references... ------ discover test started ------ error: system.io.ioexception: process cannot access file '..path...\_chutzpah.f96875093f45a5e0d78d2e58faf97799.test.html' because being used process. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.filestream.init(string path, filemode mode, fileaccess access, int32 rights, boolean userights, fileshare share, int32 buffersize, fileoptions options, security_attributes secattrs, string msgpath, boolean bfromproxy, boolean uselongpath, boolean c