Posts

Showing posts from January, 2010

How to post utf characters in android with getStreamFromURL? -

i send parameters server way in android code: string url = "http://" + ip + formpath + "?" + constparameters + "&username=" + username + "&password=" + password + "&act=" + action; inputstream jsonstream = jsonutil.getstreamfromurl(url, "get"); string jsonstring = jsonutil.streamtostring(jsonstream); but sends of parameters (which persian characters) ? character. what can do? can't change way send parameters(this way can send them). thanks. did try urlencoding username , password using urlencoder ? string encodedusername = urlencoder.encode(username, "utf-8"); string encodedpassword = urlencoder.encode(password, "utf-8"); string url = "http://" + ip + formpath + "?" + constparameters + "&username=" + encodedusername + "&password=" + encodedpassword

templates - Angularjs. Open content in new tab -

i've read similar questions/answers on so, can't resolve problem. here setup: index.html <li ng-repeat="a in article"> <a ng-click="articledetails(a.id)"> {{a.title_en}} </a> </li> js file angular.module('myapp.article', ['ngroute']) .config(['$routeprovider', '$locationprovider', function ($routeprovider, $locationprovider) { $routeprovider.when('/article/:id', { templateurl: 'article/article.html', controller: 'articledetailctrl' }); //$locationprovider.html5mode(true); }]) .controller('articledetailctrl', ['$http', '$routeparams', '$scope', '$window', '$location', function ($http, $routeparams, $scope, $window, $location) { $scope.params = 'blabla'; }]) article.html <div>{{params}}</div> qu

How to read the metadata for the mnemonics produced by disassembled Java Bytecode? -

i've never used javap before. explain "code" means in example? shows threes time. mean in context of mnemonics follow on lines below it? indicate there stack frame or something?: compiled "docfooter.java" public class docfooter extends java.applet.applet { java.lang.string date; java.lang.string email; public docfooter(); code: 0: aload_0 1: invokespecial #1 // method java/applet/applet."<init>":()v 4: return public void init(); code: 0: aload_0 1: sipush 500 4: bipush 100 6: invokevirtual #2 // method resize:(ii)v 9: aload_0 10: aload_0 11: ldc #3 // string last_updated 13: invokevirtual #4 // method getparameter:(ljava/lang/string;)ljava/lang/string; 16: putfield #5 // field date:ljava/lang/str

javascript - How controller components are instantiated in AngularJS? -

Image
this controller. angular.module('homepage').controller('buttonviewctrl', [function() { console.log(this); this.buttondisplay = false; console.log(this); this.nav = function() { console.log(this); //returns object {buttondisplay: false} //console.log(json.stringify(this)); this.buttondisplay = true; }; this.closenav = function() { console.log(this); //returns object {buttondisplay: true} //console.log(json.stringify(this)); this.buttondisplay = false; }; }]) the first console.log method logs empty object. second console.log method logs controller object property buttondisplay added it. the third console.log method (in nav() ) logs controller object methods so: the fourth console.log method logs same object buttondisplay property changed. i have 2 questions. 1) example, per understanding, when angular sees controller definition declares empty object. attaches properti

gruntjs - How do I get Grunt to recompile dependent SASS files? -

i'm trying work way through updates visual studio 2015 including using grunt , on. i can grunt recompile .scss files when change, have problem. use sass theming, , lot of css in central _main.scss . want when edit file, should recompile theme-*.scss files include _main.scss . is there way tell watch or stuff recompile things when dependencies change? if have specify dependencies manually? i don't know if there's way follow dependencies 1 file another, can watch changes in .scss files , run sass task update theme files. so you'll have sass task this: sass : { build: { files : { 'path/to/compiled-foo.css': 'path/to/theme-foo.scss', 'path/to/compiled-bar.css': 'path/to/theme-bar.scss', // or more 'path/to': 'path/to/theme-*.scss', } } }, and watch task this: watch : { themes:

jquery - how to set model value with view element text in javascript (MVC 4) -

i have model set value of view element. , call method in controller model attribute value parameter in javascript. whats best way of doing this? something like: @model.attribute = $(elementid).val(); //<- how can this? '@html.action("getpeople", new { id = @model.attribute})'; i've been investigating , cannot find way of doing this. read , tried binding between view , model. when call @model.attribute value default. if change textbox value , model attribute not change. @html.textboxfor(m => m.code, new { id = "txtattribute"}) i did model attribute binding in controller can see public actionresult index() { var model = new mymodel(); view("default", model); } i've tried multiple things failed var modelattribute = '@model.attribute'; modelattribute = '@viewdata["modelattribute"]'; modelattribute = '@html.raw(model.attribute)' modelattribu

What is wrong with this mapping? Vim starts in -- REPLACE -- mode -

i having weird bug in .vimrc since last updated it. every time start vim starts in -- replace -- mode annoying. i managed find out line in .vimrc causing problem. " disable search highlighting temporally nnoremap <esc> :nohl<cr> the problem goes away when comment line out. i confused wrong mapping. works should causes vim enter -- replace -- mode on startup. i have no plugins enabled @ all. it better avoid mapping esc key, known cause strange behavior: how map < esc > quit vim - vim quits after opening if mapped :q< cr > mapping < esc > in vimrc causes bizzare arrow behaviour i have been using <leader><space> disabling highlighting, suggested "coming home vim" , maybe used too.

web component - Polymer hostAttributes Error -

i have been following along polymer 1.0 developer guide , stumbled when getting specific part hostattributes . when take example code docs: hostattributes: { string-attribute: 'value', boolean-attribute: true tabindex: 0 } and add prototype, browser keeps throwing error: uncaught syntaxerror: unexpected token - on lines there dashes. strangely, when put quotes around string-attribute , boolean-attribute , renders fine. is error on part or error in docs somehow? in way example represented string-attribute , string-attribute refers string attribute should set on label of element declaration. also, may have noticed way declaring string-attribute in example, javascript assumes string-attribute variable, , variables can not declared "my-variable" declared "myvariable", strings together. think that's reason why should declared follows: hostattributes: { "my-var": 'value',// javascript assumes my-bar str

excel - Transfer specific cells from each filtered area -

i have below code transfers visible data "prepsheet" "contract". the code refers each visible section in prepsheet, resizes area in contract , transfers data. i want refer specific columns within filtered area, can transfer column specific data individually. example, may want transfer 1st , 6th columns. please can assist public rnga range sub test() dim wb excel.workbook set wb = activeworkbook dim sourcews excel.worksheet set sourcews = prepsheet dim filtereddatarange excel.range set filtereddatarange = sourcews.autofilter.range.offset(1, 0) set filtereddatarange = filtereddatarange.resize(filtereddatarange.rows.countlarge - 1) set filtereddatarange = filtereddatarange.specialcells(xlcelltypevisible) dim destinationws excel.worksheet dim destinationrow long destinationrow = 1 dim area excel.range each area in filtereddatarange.areas set rnga = area matchse

javascript - Uncaught TypeError: Cannot read property 'HotelInfo' of undefined -

//an ajax call api jquery(document).ready(function() { jquery.ajax({ url:"http://localhost:8080/activitieswithrealdata?location=%22sea%22&startdate=%2205-14-16%22&enddate=%2205-16-16%22&theme=%22food%22", datatype: 'json', type: 'get', success: function (data) var viewmodel; if(data) { viewmodel = new dealspagemodel(data); var idlist = ""; (var = 0; i< data.packagedeal.length; i++) { if (i == data.packagedeal.length -1) { idlist += data.packagedeal[i].hotelid; } else {idlist += data.packagedeal[i].hotelid + ','; } } var searchurl = "http://terminal2.expedia.com/x/hotels?hotelids=" + idlist + "&apikey=6wev4ksgij5eqhd58o2xtdwvo35lzf2s"; //another call api return hotel specific info jquery.get(searchurl, function ( ) { for(var i=0; i<viewmodel.deallist.l

javascript - how to import excel file (XLSX) to mysql using nodejs -

i trying import data in excel file mysql row colon using nodejs there references can learn or module in nodejs work or sample code i have searched in google have seen solutions mongodb , python , a few methods come mind: save excel sheet(s) want import in csv format, , import them mysql : cf. how import csv file mysql table far simplest method, might run trouble quotes , commas , other idiosyncrasies. use javascript excel parser read excel file , perform directly code update in mysql database : cf. https://github.com/sheetjs/js-xlsx option more complex allows automate task should have many files copy.

networking - How to access ASP.NET website hosted in Google cloud windows instance -

i got asp.net infrastructure on google cloud hosting asp.net mvc website . i have hosted website on that virtual machine's iis . so, inside machine, can run website on localhost . the external ip of virtual machine xxx.xxx.xxx.xxx (masked security purpose). wanted can access site on domain publicly. problem: supposed accessed on nerdspal.com . how access website using browser? any highly appreciated! as per edsf's comment: the virtual machine's iis ports needs opened www traffic tinkering networking things . dns records needs updated my domain provider .

c# - WCF Service SOAP Error -

i have wcf service application when run locally on dev machine works fine. hosted on iis following when trying access code: an exception of type 'system.servicemodel.endpointnotfoundexception' occurred in mscorlib.dll not handled in user code additional information: there no endpoint listening @ http://testsvc/service1.svc accept message. caused incorrect address or soap action. see innerexception, if present, more details. svcutil output gives me this: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_iservice1" /> </basichttpbinding> </bindings> <client> <endpoint address="http://testsvc/service1.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_iservic

php - CodeIgniter Auth2 Library for Facebook Graph API : Not getting email address -

i new in facebook integration codeigniter. i have done setup codeigniter oauth(0.3.1) , oauth2(0.3.1) library 'login facebook' functionality. but not getting email address of fb user. i getting name , id facebook. i not able figure problem. i using following code of ci public function oauth2($providername) { $key = $this->config->item('key',$providername); $secret = $this->config->item('secret',$providername); $this->load->helper('url_helper'); $this->load->spark('oauth2/0.3.1'); $provider = $this->oauth2->provider($providername, array( 'id' => $key, 'secret' => $secret, )); //var_dump($provider); if ( ! $this->input->get('code')) { if($providername =='facebook'){ $url = 'http://example.com'.$provider->redirect_uri; redirect($url); } // s

What does the Invalidate Caches/Restart do in Android Studio? -

i have seen many answers suggest 1 should invalid caches/restart in order improve performance of android studio , whether it's memory or cpu . can used set correct themes. wondering though, since seems solution many problems. android studio makes lot of files caches , not delete them. can cause trouble when there need make new files, clearing 'caches will clear old cache` , make android studio faster.

Django timezones examples - why don't I get any time zones? -

i've made use of example shown in django doco of setting active timezone : https://docs.djangoproject.com/en/1.8/topics/i18n/timezones/#selecting-the-current-time-zone . the thing template shown there renders nothing in select box . else seems fine . here's version of it: {% load tz %} {% get_current_timezone time_zone %} <form action="{% url 'set_timezone' %}" method="post"> {% csrf_token %} <label for="timezone">time zone:</label> <select name="timezone"> {% tz in timezones %} <option value="{{ tz }}"{% if tz == time_zone %} selected="selected"{% endif %}>{{ tz }}</option> {% endfor %} </select> <input type="submit" value="set" /> </form> it render

r - convert only some factors into a different factor -

i'm trying build factor column relates 2 other factor columns different factor levels. here's example data. set.seed(1234) a<-sample(letters[1:10],50,replace=true) b<-sample(letters[11:20],50,replace=true) df<-data.frame(a,b) df$a<-as.factor(df$a) df$b<-as.factor(df$b) the rule want make creates new column, c, bases it's factor level value based on value of column a. if row in column ="f", row in column c equal whatever entry column b. code i'm trying: dfn<-dim(df)[1] (i in 1:dfn){ df$c[i]<-ifelse(df$a[i]=="f",df$b[i],df$a[i]) } df only spits out numbered index of factor level column b , not actual entry. have done wrong? i think you'll need little finagling of character values. seems it. w <- df$a == "f" df$c <- factor(replace(as.character(df$a), w, as.character(df$b)[w])) here quick @ new column, factor(replace(as.character(df$a), w, as.character(df$b)[w])) # [1] b g g g g c

node.js - Connection attempt failed when connecting to MongoDB deployment from mongo shell -

first question , complete beginner apologies in advanced silly mistakes. i have created server on amazon web services , linked through mongodb cloud manager made replica set. i have been following tutorial on mongodb cloud documentation have become stuck on final part - "connect mongodb process". it says "cloud manager provides mongo shell command can use connect mongodb process if connecting system deployment runs" - can not because deployment running on amazon server? when enter mongo shell command reads: mongodb shell version: 3.0.4 connecting to: am-0.amigodb.0813.mongodbdns.com:27001/amigomain_1 2015-08-07t18:41:56.806+0100 w network failed connect 52.18.23.14:27001 after 5000 milliseconds, giving up. 2015-08-07t18:41:56.809+0100 e query error: couldn't connect server am-0.amigodb.0813.mongodbdns.com:27001 (52.18.23.14), connection attempt failed @ connect (src/mongo/shell/mongo.js:181:14) @ (connect):1:6 @ src/mongo/shell/mongo.js

django - Inline Formset Foreign Key as text Field -

i need similar following question; how create inline formset reverse foreign key relationship although there solution on not work me. when implement solution relatedobjectdoesnotexist error , save method runs infinite loop. here code; https://dpaste.de/gkcy#l65,78,79,86,94 i have highlighted code receive errors. can please, has been bothering me many days , yes, new :(

Version Info in Delphi 7 not working -

i assigned make small modification in delphi project. register mod, boss told me increment build number in project options > version info. i did that, after compiling , building, when @ file properties, file version not updated. exe file indeed compiled (i checked modification date , matches time of build). version number in final exe unchanged, , not equal number set in version info tab. when search google this, results find tutorials use version feature , people problems enabling it. i tried reopening project, deleting generated exe , rebuilding, removed .res file (the build fails because there's no res file) , commented out {$r *.res} directive (no version info included @ all). i'm not original developer of project, , original 1 not available anymore. i think related this post , delphi version, , couldn't find dproj file in project. so, knows whats wrong? kind of bug or missing something? there option should change option takes effect? use b

java - Create Enumeration of objects -

i need create java.util.enumeration of fruit objects can pass method during test. it's legacy code , cannot change method signature. public void get(enumeration<fruit> fruits){} my fruit class: public class fruit{ string name; //getters , setters } how can create enumeration of fruit objects? you can use collections.enumeration(collection<t>) method convert collection, such list<fruit> , enumeration<fruit> : list<fruit> fruits = new arraylist<>(); fruits.add(new fruit()); enumeration<fruit> fruitenumeration = collections.enumeration(fruits);

Rails streaming and uploading at the same page -

i have page users see uploaded videos. above videos, there "update" form ability upload videos collection. form uses realtime uploading (upload starts user chooses file). , when upload progress 100%. user hits "update" button update video collection. the problem occurs when user wants upload file when watching video. upload not progress. there no messages or errors in server development log or client javascript console. hangs (the video continues playing though). upload hangs @ start (5%, 20% depending on video file size). by way; use refile gem managing realtime uploads, storage, file serving, etc. should known that, use same rails application server (thin 1.6.3) serve files , accept uploads. (maybe server gets busy , can not accept uploads? because if don't start playing video, upload progresses smoothly , completes without problem.) could point me in right direction? look? there parameters should set somewhere?

vbscript - Login in to a web-based application using the "click" on VBS -

our company uses browser-based program business operations. goal able log system automatically. problem in front of me able click on 1 button using vbsript, this code have far take me point i'm positioned on button: set wshshell = wscript.createobject("wscript.shell") call wshshell.run("http://timeclock/portal/welcome.htm", 1, false) wscript.sleep 1000 wshshell.sendkeys "{enter}" wscript.sleep 2000 wshshell.sendkeys "username" wscript.sleep 1000 wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "password" wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "{enter}" wscript.sleep 2000 wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "{tab}" wscript.sleep 1000 wshshell.sendkeys "{tab}" wscript.slee

android - GridLayoutManager spanSizeLookup bug -

i having issue gridlayoutmanger setspansizelookup , when orientation of activity changes, changing span count while checking if specific position sort of type, works on orientation change, problem is, i'm using zxing library barcode scanning, whenever button clicked i'm opening zxing default intent , retrieve date it, when zxing opening goes landscape , current activity orientation portrait gives me illegalargumentexception layout manage throws when opening xzing intent, crash log this java.lang.illegalargumentexception: item @ position 0 requires 2 spans gridlayoutmanager has 1 spans. problem doesn't occur if rotate phone, happens when launch xzing intent, couldn't figure out how how solve issue bugging me. here spansizelookup - manager.setspansizelookup(new gridlayoutmanager.spansizelookup() { @override public int getspansize(int position) { return adapter.getholders().get(position).getlabelholder() != null ? getresources().getint

java - How can I make multiple instances of the same panel and change attributes in each one individually? -

is possible make jpanel, put variables inside of it, , add same panel content pane multiples times( number of times based on number of variable outside of gui). , edit content inside of each instance individually? here why need things mentioned above: i'm writing program several different clinics can use minimum setup on user side. specify how many bedrooms have , program creates visual representation of each bedroom automatically. example: clinic has 13 rooms program adds 13 bedroom jpanels content pane , displays them in numerical order using fullscreen view. no, can't this. each jcomponent (which includes jpanel can have 1 , 1 parent). you "fake" using jtable , having panel cell renderer table, works if have no interactive controls inside panel though. what need either create factory generates these jpanel s you need them , create number need or create new subclass of jpanel has set , add new instances of that.

textview - Android text styling error - Resource is not a ColorStateList -

i have simple textview: <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/app_name" android:textsize="20sp" android:textcolor="@style/basic_text_color" android:layout_gravity="center" android:id="@+id/toolbar_title" /> which @style/basic_text_color color wanted reuse lot of time in app, make app_colors.xml under values folder: <?xml version="1.0" encoding="utf-8"?> <resources> <!-- text colors style--> <style name="basic_text_color" parent="@android:style/textappearance"> <item name="android:textcolor">#ff932e</item> </style> <!-- other color styles--> </resources> the app compile successfully, whenever executed hang , following error prompted in logcat: fatal exception: main java.lang.runtimeexception: unable st

c++ - Why isn't std::function working with perfect forwarding? -

note: i apologize in advance unable reduce/simplify code further (i.e., smaller tests couldn't reproduce issue) version 1 of code compiles does not execute properly using visual studio 2010 premium version 2 & 3 of code compiles , executes successfully using visual studio 2010 premium all versions of code compiles , executes successfully using ideone.com (c++14) version 1 output (visual studio 2010) signal1<a1>::raise(7) slot::operator()(7) slot1<a1>::operator()(7) handling new value: 3931764 // value changes on each execution version 2 output (visual studio 2010) signal1<a1>::raise(7) slot::operator()(7) slot1<a1>::operator()(7) handling new value: 7 version 3 output (visual studio 2010) signal1<a1>::raise(7) slot::operator()(7) slot1<a1>::operator()(7) handling new value: 7 code #include <functional> #include <iostream> #include <vector> // version 1: uses perfect forwarding std::function<

c# - Find the closest higher number that has a given divisor -

i have allocate items customers. in allocation algorithm customers should have specific minimum, before allocate remaining items. some of these items pre-picked. these pre-picked items @ least 1 container quantity given. two. i need efficient algorithm find minimum value above given minimum value per customer , can divided @ least 1 container quantity without remainder. here minimalistic code better understanding: int containerqty1; int? containerqty2; // can null int customerminimum; int minimumtoget; in example, minimumtoget should have higher value customerminimum , has divided without remainder containerqty1 or containerqty2 . given 2 numbers, m , d , can construct smallest number x above m such d divides x first adding d m , , subtracting remainder of division of sum d , i.e. int x = (m+d) - ((m+d) % d); example: m = 200 , d = 13 . looking smallest multiple of 13 above 200. int x = (200+13) - ((200+13) % 13) = 213 - 5 = 208;

Uncaught ReferenceError: projection is not defined -

i trying load geojson file .html giving me "uncaught referenceerror: projection not defined" my code: <!doctype html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script> <style type="text/css"> </style> </head> <body> <script> var canvas=d3.select("body").append("svg") .attr("width", 760) .attr("height", 700) d3.json("sweden20.geojson", function(data) { var group= canvas.selectall("g") .data(data.features) .enter() .append("g") var pojection = d3.geo.mercator(); var path = d3.geo.path().projection(projection); var areas= group.append("path") .attr("d", path) .attr("class", "area&q

python - Regex text between two strings -

i trying extract data fields pdf texts using regex. the text is: "sample experian customer\n2288150 - experian sample reports\ndata dictionary report\nfiltered by:\ncustom selection\nmarketing element:\npage 1 of 284\n2014-11-11 21:52:01 pm\nexperian , marks used herein service marks or registered trademarks of experian.\n© experian 2014 rights reserved. confidential , proprietary.\n**data dictionary**\ndate of birth acquired public , proprietary files. these sources provide, @ minimum, year of birth; month provided available. exact date of birth @ various levels of detail available \n\n\n\n\n\nnote: records coded dob exclusive of estimated age (101e)\n**element number**\n0100\ndescription\ndate of birth / exact age\n**data dictionary**\n\n\n\n\n\n\n\n\n\n\nfiller, 3 bytes\n**element number**\n0000\n**description**\nenhancement mandatory append\n**data dictionary**\n\n\nwhen there insufficient data match customer's record our enrichment master estimated age, median

android - Why is my cardview getting clipped -

Image
i using cardview parent in list row layout follows: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="125dp" android:orientation="vertical" android:padding="15dp"> <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="match_parent" card_view:cardelevation="4dp" card_view:cardcornerradius="4dp"> <relativelayout android:id="@+id/relative_left" android:layout_width="wrap_content" android:layout_height="wrap_content"> <relativelayout

hibernate - Shiro Authentication failed -

i use shiro 1.2.3 in jsf2+hibernate project. no luck user authenticated. can't figure out i'm doing wrong. shiro.ini [main] cachemanager = org.apache.shiro.cache.ehcache.ehcachemanager securitymanager.cachemanager = $cachemanager hashservice = org.apache.shiro.crypto.hash.defaulthashservice hashservice.hashiterations = 100000 hashservice.hashalgorithmname = sha-256 hashservice.generatepublicsalt = true passwordservice = org.apache.shiro.authc.credential.defaultpasswordservice passwordservice.hashservice = $hashservice passwordmatcher = org.apache.shiro.authc.credential.passwordmatcher passwordmatcher.passwordservice = $passwordservice customsecurityrealm = com.sapienzo.common.customsecurityrealm customsecurityrealm.credentialsmatcher = $passwordmatcher securitymanager.realms = $customsecurityrealm shiroutils class (helper class create salted hash) public class shiroutils { private static int hash_iterations = 100000; public static string createsaltedhash(string

.net - C# : how to include .sdf database file and Crystal Reports while creating .exe in setup project? -

i've created desktop application using c# language , in i've used .sdf (sql server ce database file) local database , exporting results crystal reports. problem(requirement) want include .sdf file , crystal reports files .exe can include automatic installation of crystal reports setup .exe itself? if how? i've developed whole application needed while making .exe. does have idea this? please me in this. thanks! https://www.sap.com/cmp/ft/crm-xm15-dwn-an009/typ.html find downloads. have cr_vr_20 installation file runtime 64 , 32 bit versions.

uDeploy where is the location of the audit log -

i'm trying find audit log in udeploy can find changes. can point me can find audit log? have looked audit tab or link generate audit log haven't been able find information. thanks i found audit logs need have enough privileges see settings tab. audit logs go settings there system section has link audit logs. thanks

python - How convert 'tuple' object to str -

i'm trying make search field in app. first want load results, if user request search, show answer. def get_queryset(self): pista = self.request.get.get('pesquisar_por') sql = ( "select t1.codigo, t1.nome, t1.quantidade, t1.preco_venda, t2.nome nome_grupo "+ "from produto t1 "+ "left join grupo t2 on (t1.grupo = t2.codigo) "+ "where t1.status= 'a' ") if pista not none: sql = sql + ("and t1.nome %s", ['%'+pista+'%']) sql = sql + "order t1.nome limit 300" produtos = produto.objects.using('horus').raw(sql) return produtos but showed error: can't convert 'tuple' object str implicitly . the error in line: sql = sql + ("and t1.nome %s", ['%'+pista+'%']) i believe sql concatenation , excution should instead: sql = sql + "and t1.nome %%s%" and pass parameters in .raw() meth

java - Attribute value is null while trying to parse XML using dom4j -

i trying parse xml string using dom4j. when try attribute value of node(element) return null value only. this file contains xml: <event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'> <system> <provider name='outlook'/> <eventid qualifiers='16384'>63</eventid> <level>4</level> <task>0</task> <keywords>0x80000000000000</keywords> <timecreated systemtime='2015-07-23t13:45:26.000000000z'/> <eventrecordid>27487</eventrecordid> <channel>application</channel> <computer>eglap0011-pc</computer> </system> <eventdata> <data>the exchange web service request getappmanifests succeeded. </data> </eventdata> </event> see below code: bufferedreader br = null; try { file inputfile = new file("d:\\eventlog\\xml_op.txt");

javascript - phantomjs - Error code: 99, description: Error creating ssl context () -

i'm getting onresourceerror related ssl phantomjs on centos 6.5, phantomjs version 1.9.1: error code: 99, description: error creating ssl context () my script works fine on windows dev environment, stops on production server running centos. i've tried both popular answers on this stackoverflow question setting --ignore-ssl-errors=true , --ssl-protocol=any (i've tried both of these options separately , combined). i've tried setting --web-security=false (i'm using script access 1 page, trust much). i've tried combinations of combining these options, no luck. i've gone far follow recommended solution bgever@ on this page (apr 29, 2015)to create sha256 security certificate following these directions (which worked surprisingly smoothly) , use --ssl-certificate-path=<path> option, i'm still getting same error here. i've exhausted resources , knowledge here, , i've made no progress. appreciated.

creating an adjacency List for Graphs in Scala -

i have list of edges, undirected graph, saved in var edges: list[edge] . of them are. a, b, 6 b, a, 6 a, d, 4 d, a, 4 b, c, 10 c, b, 10 b, d, 7 d, b, 7 b, e, 7 e, b, 7 c, d, 8 d, c, 8 c, e, 5 e, c, 5 c, f, 6 f, c, 6 d, e, 12 e, d, 12 e, f, 7 f, e, 7 i trying put them in adjacency list, in way: val adjlist: list[(vertex, list[vertex])] = (graph.edges.groupby(_.source).map { case (k,v) => (k, v.map {_.destination}) }).tolist but, it's not functional. doing wrong? :( edit: it not wrong (my mistake, read comment below)! my given solution right. simply, wrong testing side. everybody's help.

javascript - How can I disabled select option(s) base on the JSON data got from AJAX? -

Image
i have dropdown-menu couple options. want loop through them , prop disabled attribute on of them base result ajax call. this i'm trying achieve. sample reportable data s-00591 | true s-00592 | false s-00593 | false s-00594 | false s-00595 | false html <select class="rn-dropdown" id="rn-dd"> <option value="class-view">class view</option> <!-- students populate here --> <option value="s-00591">student s00591</option> <option value="s-00592">student s00592</option> <option value="s-00593">student s00593</option> <option value="s-00594">student s00594</option> <option value="s-00595">student s00595</option> </select> js success: function(reportable) { $.each(reportable , function(i, v) { var userid = v.userid; var reportable = v.reporta

scripting - Split own filename and assign specific parts to variables in a batch script -

thanks in advance offered. i have batch file name want use parts , assign them variables. using /f delims able have rename file different scheme need. se here have: -current filename: whid-prt-mfp-3, north east office.bat set getname=%~n0 /f "tokens=1 delims=-" %%g in ("%getname%") (set siteid=%%g) /f "tokens=1 delims=," %%e in ("%getname%") (set name=%%e) set printername=%name% set servername=server-%siteid%-01 ok, seems work ok , im able parts need file name , assign them variable %name%=whid-prt-mfp-3 , %siteid%=whid now dilema need file name be: north east office, whid-prt-mfp-3.bat i've been trying entire line behind comma( whid-prt-mfp-3 ) variable , first item in dashes( whid ) variable, same example above, cant figure out. used several names not example shown have shorter or longer names both parts, say: whid-prt-1, office 1 any ideas welcome. thanks north east office, whid-prt-mfp-3.bat: set g

c - time taken by for loop with (2^32-1) or (2^64-1) or more is same -

i calculated time taken loop for (i=0; i<4294967295;i++) in c language. surprising, short (80-88 ns) on node (speed 1600mhz). later, tried run 2 loop 1 above other (i.e. for(j=0; j<4294967295;j++) for(i=0; i<4294967295;i++) . surprisingly, time short , same (i.e., 80ns). explain me, why time low while running many i++ in loop. additionally, when run 2 or 3 loops, why time taken these many i++ same. many in advance reply! if loop without side-effects, compiler optimizing away completely. trick compiler generating loop anyway common trick insert asm nop inside loop (compilers don't mess hand-inserted assembly, , cost negligible).

c++ - Using the noexcept operator to chain noexcept declarations -

why noexcept operator take expression rather function signature/declaration? consider following dummy example: #include <string> void strprocessor(const std::string& str) noexcept(true) { }; struct type{ void method1() noexcept(strprocessor("")) { //error: call nonconstexpr function strprocessor(""); } }; it won't compile because method1 has non-constexpr expression in noexcept, why need put expression in there in first place? all want tell compiler method1 noexcept iff invocation of strprocessor succesfully constructed string noexcept (which is). so why not noexcept(void strprocessor(const std::string&)) ? another similar dummy example: struct type{ type(bool shouldthrow=false) noexcept(false) { if(shouldthrow) throw "error"; }; void method1() noexcept(true) {}; void method2() noexcept(noexcept(type().method1())) { method1(); }; } here i'd method2 noexcept iff invoking method1 on succesf

c++ - How to properly include Header and Implementation Files? -

i novice programmer in c++, , getting compiling error undefined symbols architecture x86_64 supposedly originates how header files , implementation files included/coded. below code generates compiling error receiving main //main.cpp #include <iostream> #include <string> #include "animal.hpp" using namespace std; int main(){ animal mypet; mypet.shout(); return 0; } header //animal.hpp #ifndef h_animal #define h_animal using namespace std; #include <string> class animal{ public: animal(); void shout(); private: string roar; }; #endif implementation //animal.cpp #include "animal.hpp" #include <string> animal::animal(){ roar = "..."; } void animal::shout(){ roar = "roar"; cout << roar; } this code generates compiling issue. how issue resolved? thanks time edit undefined symbols architecture x86_64: "animal::shout()", referenced f

javascript - How can I display different versions of my website to the visitors randomly with the same probability? -

i have 3 different versions of website show them visitors randomly. example when first user visited webpage show version-1 of website, when second user visited webpage, show version-2, third user displays version-3 , next user version-1 again , on… could tell me please right approach problem, javascript code put in main webpage take control of action? using php , json file: <?php $arr = json_decode(file_get_contents('array.json'), true); if(count($arr) >= 3) $arr = array(); $searching = true; while($searching){ $page = rand(0,3); if(!array_search($page,$arr)){ $searching = false; array_push($arr,$page); } } file_put_contents("array.json",json_encode($arr)); // page number $page ?>

google apps script - How can i load an image in to a template doc based on information submitted in to a sheet from a form? -

basically trying accomplish create contact , image card each of students. have them fill in survey created google forms. when form submitted app script grabs doc template, fills in of information sheet correct place creates doc , pdf , emails them me. still need pull image drive folder (or other location if drive issue , have read in other posts) labeled student id's (ex. 588305.jpg) , insert doc. provide student id's in survey available in sheet t match. attached links sheet, template,and code. sheet template var doctemplate = "1kuvjc68grazp_8msj_evj8uaylmyt0vu2eu44mbn3fa"; var docname = "student profile template"; function onformsubmit(e) { var email1 = "sbrumbaugh@piperschools.us"; var last = e.values[3]; var first = e.values[4]; var nick = e.values[5]; var grade = e.values[17]; var gender = e.values[10]; var birthday = e.values[9]; var student_email = e.values[6]; var student_phone = e.values[7]; var student_i