Posts

Showing posts from February, 2014

sql - Oracle - Convert a String (containing a date) into a String (another date's format) -

i have oracle database contains table have column (string) contains dates (in java code, tostring() of date inserted string column) , format example : fri feb 28 00:00:00 cet 2014 so need fix have standard format => instead of "fri feb 28 00:00:00 cet 2014" i'll have "2014-02-28 00:00:00.0" for future insertions in database, problem fixed => usage of dataformat instead of tostring() on date. but ! problem how convert entries in database ! i'd add not possible change type of column date must remain string. any ideas ?? you need first convert timezone , reconvert string of required format. here query. select to_char(to_timestamp_tz('fri feb 28 00:00:00 cet 2014', 'dy mon dd hh24:mi:ss tzd yyyy'), 'yyyy-mm-dd hh24:mi:ss') || '.0' dual; to_char(to_timestamp_ --------------------- 2014-02-28 00:00:00.0

ios - Set integer 'variable' using result of NSString -

this question has answer here: swift: converting string variable name 1 answer i'm using single action handle 10 uiswitches sending tag value it. have number of integers initialised when launched thus; int switch_1 = 0; int switch_2 = 0; etc when particular switch switched on, want set integer corresponding integer 'variable' 1 so, if switch 2 tag 2 turned on, puts '1' in corresponding int 'switch_2' integer. i getting string right name via 'stringwithformat' appending tag value don't know how write 1 corresponding integer variable it. any appreciated. essentially, want write integer 'variable' name same name generated string value. thanks you can use array each index represents switch, following: int swticharray[10] = {0}; // if have 10 switches while in action handling action of multiple butto...

c# - Sending email through asp.net -

this design page : <%@ page language="c#" autoeventwireup="true" codefile="register.aspx.cs" inherits="register" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table style="border:1px solid" align="center"> <tr><td>username:</td><td><asp:textbox runat="server" id="txtusername"></td></tr> <tr><td>password:</td><td><asp:textbox runat="server" id="txtpassword" textmode="password"></td></tr> <tr><td valign="top...

c# - Code runs but doesn't update database -

this code supposed save values in textboxes specific row. code runs fine no hiccups, refuses update database no matter do. try { using (var con = new oledbconnection()) { con.connectionstring = @"provider=microsoft.ace.oledb.12.0;data source=c:\users\user\desktop\esoft\gym\gym\bin\debug\clients.accdb;"; con.open(); using (var com = new oledbcommand()) { com.connection = con; com.commandtext = "update gym set bmi = @bmi , health = @health , weight_change_to_healthy_bmi = @weight id = @id"; com.parameters.addwithvalue("@bmi", bmi.text); com.parameters.addwithvalue("@health", health.text); com.parameters.addwithvalue("@weight", change.text); com.parameters.addwithvalue("@id", id.text); com.executenonquery(); } } messagebox.show("saved"); } catch (exception ex) ...

python - django static files - don't work -

i have django project , i'm using static files, didn't work , can not include css file or image html file here <link rel="icon" href={% static "img/favicon.png" %}> or <link href={% static "css/mine.css" %} rel="stylesheet"> i checked direction , ok cant understand why code didn't work i add static section in settings.py follows static_url = '/static/' just change this <link rel="icon" href="{% static "img/favicon.png" %}"> and <link href="{% static "css/mine.css" %}" rel="stylesheet">

python - Running spark-submit from pycharm -

i trying figure out how develop apache-spark program in pycharm. have followed article in link . define spark_home , add pyspark python path well. there no error in importing pyspark modules , autocomplete works fine. however error on defining sparkcontext when run program in pycharm. error: must specify primary resource (jar or python or r file) run --help usage or --verbose debug output ... ... exception: java gateway process exited before sending driver port number i managed run program on terminal submit-spark. need change configuration on pycharm or there anyway run submit-spark instead of python in pycharm? if fine terminal submit-spark can add run configuration you. otherwise can see configuration in edit run/debug configurations window well. this post in particular can there.

Permissions when iterating over files in directory Unix TCSH scripting -

i'm writing script print file names of every file in subdirectory of home directory. code is: foreach file (`~/.garbage`) echo "$file" end when try run script, following error: home/.garbage: permission denied. i've tried setting permissions 755 .garbage directory , script, can't on error. there i'm doing incorrectly? it's tcsh script. why not use ls ~/.garbage or if want each file on separate line, ls -1 ~/.garbage

ImportError: cannot import name exceptions FLASK - Python -

i'm working sqlite , flask in python. problem i'm trying create database error "importerror: cannot import name exceptions" . python db_create.py db_create.py #!flask/bin/python migrate.versioning import api config import sqlalchemy_database_uri config import sqlalchemy_migrate_repo app import db import os.path db.create_all() if not os.path.exists(sqlalchemy_migrate_repo): api.create(sqlalchemy_migrate_repo, 'database repository') api.version_control(sqlalchemy_database_uri, sqlalchemy_migrate_repo) else: api.version_control(sqlalchemy_database_uri, sqlalchemy_migrate_repo, api.version(sqlalchemy_migrate_repo)) error traceback (most recent call last): file "db_create.py", line 2, in <module> migrate.versioning import api file "/home/desarrollo3/.local/lib/python2.7/site-packages/migrate/versioning/api.py", line 33, in <module> migrate.versioning import (repository, schema, version, file ...

javascript - Determining when a radio button selection has changed with YUI3 -

i using yui3 , internet explorer 8 , firefox. trying determine when radio button has changed selection. my html: <div id="test"> <input name="test1" value="a" type="radio"> <input name="test1" value="b" type="radio"> <input name="test1" value="c" type="radio"> </div> my javascript: yui().use('event', 'node', function (y) { y.one('input[name=test1]').on('change', function (e) { alert('changed'); }); }); this doesn't work because page loads nothing selected in radio button group. when select first item nothing happens, no alert pops up. when click second button pops up. how determine when radio button selection has changed? also how value of selected radio button, think there ie issues? bombs out: var value = y.one('input[name=test1]:checked').get(...

logging - WebSphere how to log timing traces to separate log? -

we lot of trace logging in our websphere application , separate timing information in separate log file. usually import: import java.util.logging.level; import java.util.logging.logger; and declare: private static final logger logger = logger.getlogger(myclass.class.getname()); and log: logger.info("now logging..."); what simplest way of doing that? you can use apache logging services create logs outside websphere application server. download log4j jar here . stable version of jar have used. add jar application build path/class path/libraries. add log4j.properties file under src folder (empty package). log4j.properties contain following lines: log4j.rootlogger = debug, fileout log4j.appender.fileout = com.logging.newlogforeachrunfileappender log4j.appender.fileout.layout.conversionpattern = %d{dd-mm-yyyy} %d{absolute} %5p %c:%l - %m%n log4j.appender.fileout.layout = org.apache.log4j.patternlayout log4j.appender.fileout.file = e:/logs/myapplic...

WinJS CSS styling for .win-toolbar-overflowareabutton not working -

i'm trying set color on view more button , labels on winjs toolbar following documentation here. link winjs.ui.toolbar object documentation. here link styling appbars , toolbars (html). i using winjs 4.4.0. release. this css styling code using(it in default css file): .win-toolbar .win-toolbar-overflowareabutton{ color:blue; } have tried these: .win-toolbar win-toolbar-overflowareabutton{ color:blue; } .win-toolbar .win-toolbar-overflowbutton{ color:blue; } .win-toolbar win-toolbar-overflowbutton{ color:blue; } i note other styling toolbar working. update would work, in case want use other colors besides defaults found in: <link href="winjs/css/ui-dark.css" rel="stylesheet" /> <link href="winjs/css/ui-light.css" rel="stylesheet" /> any thoughts? thank checking out. - rob0 following advice here . one need dig through 1 of winjs css files find appropriate code used style ...

sorting - ArrayList sort issue -

i having issue code trying compare not working getting no suitable method found sort(int) first class caru class contains method , second method in class import java.io.*; public class caru extends car implements serializable { private string number; private int price; private string phone; public caru() { number = ""; price = 0; phone = ""; } public caru(string n1,int p,string pp,string ma,string mo,string br,int yo,string en) { super(ma,mo,br,yo,en); number = n1; price = p; phone = pp; } public void setnum(string n1) { number = n1; } public string getnum() { return number; } public void setprice(int p) { price = p; } public int getprice() { return price; } public void setphone(string pp) { phone = pp; } ...

In Primefaces, uploaded files which are stored in a temp directory are not automatically deleted, once they have been read -

in xhtml use p:fileupload tag. in session scoped bean keep reference uploadedfile. basically doing this: private uploadedfile uploadedfile; public void fileupload(fileuploadevent event) throws ioexception { uploadedfile = event.getfile(); } with separate button, action in session bean invoked copies uploaded file location. doing this: file fileto =new file(“/xyz/abc.def”); files.copy(uploadedfile.getinputstream(), fileto.topath(), standardcopyoption.replace_existing); now situation follows: with every upload invocation, temporary file created in temp directory. ok. with every upload invocation, variable uploadedfile overwritten event.getfile(). therefore previous instance of uploadedfile @ time later garbage collected. primefaces uses under cover apache’s fileupload, deletes temporary file if uploadedfile garbage collected. can see works, okay too. scenario upload 1 file after other. can see in temp directory each upload new temp file created , after while (1 ...

bytecode - How do I build an concrete implementation of a Java Class from an interface using Byte-Buddy? -

i have interface, lets looks this. public interface testobject { string getstring(); long getlong(); } i want build concrete implementation of object using bytebuddy. here's tried. public class runme { public static void main(string[] args) { bytebuddy bb = new bytebuddy(); class<?> clz = bb .subclass(testobject.class) .method(any()).intercept(methoddelegation.to(interceptor.class)) .make() .load(object.class.getclassloader(), classloadingstrategy.default.wrapper) .getloaded(); try { object test = clz.newinstance(); } catch (instantiationexception e) { e.printstacktrace(); } catch (illegalaccessexception e) { e.printstacktrace(); } } public class interceptor { public object intercept(@origin string method, @allarguments object[] args) throws throwable { system.out.println("i have intercepted call"); re...

Parsing dota2.gamepedia.com - Android -

i information dota2 items can get. essential ones prices, names, thumbnail picture urls, other information welcome, way buy them (for instance, buy moon shard buying 2 hyperstone s). there dota2 wiki page , there way parse wiki pages, didn't work. apparently wiki's apis doesn't work on http://dota2.gamepedia.com . i need information on android platform. any help? i have been actively researching same thing. scraping wiki far brittle (layout/website updates), why not data straight valve's mouth? have online item viewer consumes json item data, able track down gets published , plan on using in future android app well. the json data can retreived via this link . once have retrofit parse data directly objects. personally however, consume through other method , store in own database app isn't dictated structure of data push. hope helps!

javascript - Display Content After Google+1 Button Clicked -

i thought special content share content in social media great , started working on thing. i managed working facebook likes , twitter tweets, stuck in google+1. the information here didn't helped much: http://support.google.com/analytics/bin/answer.py?hl=en&answer=1366830 can tell me how register +1 , display content (hidden div) after +1? here codes using: html <div class="g-plusone" data-size="medium" callback="cpg1callback"></div> javascript function cpg1callback(data){ if (data.state == 'on') { $('.gpsuccessmsg').show("blind", { direction: "vertical" }, 500); } } i have placed js code in js file linked @ header , not working, tried placing js code before closing body tag no success. guidance here helpful. regards i got working @ last, after spending couple of hours. sharing might looking answers on same issue. you need have callback (functi...

android - I can not run the app after I update Xamarin.Forms -

ok, here thing: i using xamarin.form build app targets both ios , android. using xamarin studio mac i create app , solution creates app, app.droid, app.ios project. in every project there indication show packages need updated. i run droid project in samsung s5 api 21, without doing update, , app installed in device. i update of packages, update xamarin.form in 20.0.+ version base on feedback of question: https://forums.xamarin.com/discussion/57283/unable-to-find-a-version-of-xf-compatible-with update xamarin.form package. i run again in samsung s5 21 there errors : /users/crs/projects/time.al/droid: error xa5209: unzipping failed. please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip , extract /users/crs/.local/share/xamarin/android.support.v4/23.0.1.3/content directory. (xa5209) (time.al.droid) what can do, because need update xamarin.forms latest version, stuck long time. you should: 1-download https://dl-ssl.google.com/and...

javascript - Element Keeps Leaving Div When Resized -

i've been searching around , haven't found answers particular case. want have search form aligned right of page aligned div located in. have resorted absolute positioning rather find cleaner way out me having change value of style " top: ; " here link code: https://jsfiddle.net/nz4u376r/ and here snippet: css: /*----- toggle button -----*/ .toggle-nav { display: none; } .toggle-nav-button { color: #fff; padding: 12px; transition: color 0.3s ease; max-width: 45px; cursor: default; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .toggle-nav-button:hover { color: #0d2c87; background-color: #909f8e; -webkit-transition: background .4s ease; -moz-transition: background .4s ease; -ms-transition: background .4s ease; -o-transition: background .4s ease; transition: background .4s ease; } @media s...

javascript - using ng-repeat with directives causes child directives not to update -

so if found interesting bug in angular.js. if have custom directive inside ng-repeat actively changing variables in directive don't update. meaning if have 3 elements in array ng-repeat initializes fine if delete element 1 array variables element 1 had passed child directive somehow end in element 2's child directive here example code. <div ng-app='testing'> <div ng-controller='testing test'> <div ng-repeat='item in test.example track $index'> {{item.title}} <child scope='item.data'></child> <button ng-click="test.delete($index)"> delete </button> </div> </div> </div> then in js file console.log('hello world'); var app=angular.module('testing',['testingchild']); app.controller('testing',[function(){ this.example=[{ title:"this first t...

r - remove zeros from data frame -

i want remove zeros data frame. prices sales purchases marginal residual ampdch mw.pumped_b 1: 81 1391.830 2061.830 ccgt 1918 81 140.00000 2: 81 1315.405 1985.405 ccgt 1858 81 140.00000 3: 81 1192.031 1862.031 ccgt 1746 0 0.00000 4: 81 1138.187 1747.216 ccgt 1622 0 0.00000 5: 81 1138.868 1666.639 ccgt 1534 81 49.41176 6: 81 1140.571 1628.348 ccgt 1503 0 0.00000 i tried with df[ !rowsums(df[,colnames(df)[(3:ncol(df))]]==0)==ncol(df)-2, ] but zeroes still in data frame. knows suitable solution. the expected output looks prices sales purchases marginal residual ampdch mw.pumped_b 1 81 1391.830 2061.830 ccgt 1918 81 140.00000 2 81 1315.405 1985.405 ccgt 1858 81 140.00000 3 81 1138.868 1666.639 ccgt 1534 81 49.41176 # same basic idea using "any" df[!apply(df[,6:7] == 0, ...

ios - Pass touches through a UIViewController -

i have view controller overlay on top of view controller. need top view controller can overlay temporary pop notification, , having overlayed vc allows me present on uitableviewcontroller can't add subviews tableview controllers directly. is possible interact bottom view controller while has view controller covering it. if view or window achieve setting user interaction false or using hittest neither of these approaches works view controller. as you've correctly deduced, when present 1 view controller on another, presenting view controller's view not in responder chain. touches in presented view controller's view therefore cannot "fall through" it. have route message presented view controller's view in other way.

ember.js - Not able to load the hasMany attribute in ember -

i getting error assertion failed: passing classes store methods has been removed. please pass dasherized string instead of undefined. my model (likes) url: attr('string'), detail_url: attr('string'), gallery_name: attr('string'), description: attr('string'), time: attr('string'), thumbnail_url: attr('string'), num_photos: attr('number'), num_photos_hifive: attr('number'), is_following:attr('number'), karma:attr('number'), photothumbs_hifive:ds.hasmany('thumb'), model (thumb) photo: attr('string'), photo_url: attr('string'), serializer (same both ) export default ds.jsonserializer.extend(ds.embeddedrecordsmixin,{ isnewserializerapi: true, primarykey:'pk', normalize: function(typeclass, hash) { var fields = ember.get(typeclass, 'fields'); fields.foreach(function(field) { var payloadfield = ember.string.underscore(field); if (field === payloadf...

javascript - How to insert spring form tag in jquery mRender -

i have table in spring form , first column checkbox each line of table. want insert spring form:checkbox, variable not replaced value. there example: "aocolumns" : [ { "mrender": function ( data, type, full ) { if(full.estatus!="removed"){ var identifier=full.identifier; return '<form:checkbox path="useridstodelete" value="' + identifier + '" onchange="togglecheckbox()"/>'; } return ''; }}, { "mdataprop" : "firstname" }, { "mdataprop" : "lastname" }, { "mdataprop" : "email" ...

Combobox issue in ZK Framework -

when click on combo box options opening below combo box when scrolling window of mouse scroller window scrolling down combo box option present @ same place. below of combo box option value showing below middle name look here details click here fiddle example here this seems known issue ( see tracker ), need sync position yourself. e.g., <zk> <script><![cdata[ function addsyncscroll (wgtid, parentid, add) { var wgt = zk.widget.$('#'+wgtid), parentwgt = zk.widget.$('#'+parentid); if (wgt && parentwgt) { var cbxtosync = parentwgt._cbxtosync, idx; if (!cbxtosync) { initsyncscroll(parentwgt); } cbxtosync = parentwgt._cbxtosync; if (cbxtosync) { if (!wgt._syncpopupscroll) { wgt._syncpopupscroll = function () { ...

elixir - Ecto "left IN right" query using a fragment -

i query jsonb field using postgres in operator (with ecto library) this code work simple = operator: from in query, where: fragment("?->>'format' = ?", a.properties, "foo") but cannot make of these attempts work: from in query, where: fragment("?->>'format' in ?", a.properties, ["foo", "bar"]) in query, where: fragment("?->>'format' in (?)", a.properties, ["foo", "bar"]) in query, where: fragment("?->>'format' in ?", a.properties, "('foo', 'bar')"]) any idea? besides patrick's excellent response, keep in mind can put part of query in fragment too. example, can rewrite to: from in query, where: fragment("?->>'format', a.properties) in ["foo", "bar"] if put fragment in macro, can readable syntax: defmacro jsonb_get(left, right) quote fragment...

Does PyQt5 support Qt3D? -

i'm pretty new pyqt, upgraded version 5 expecting use qt3d (that available qt5), when i've tried import module says "unresolved reference qt3d". i've searched in pyqt documentation , there no reference of qt3d module, because of want know: is possible use qt3d pyqt5? if so, how can it? if not, wich other libraries can use make 3d visualization of 3d model imported program blender. (i tought vpython, couldn't figure out how import file) update: ekhumoro pointed out, there in fact support it. see https://www.riverbankcomputing.com/software/pyqt3d/intro doesn't seem case, @ least not yet. on 23 mar 2016, @ 11:47 pm, miguel alejandro fernandez wrote: in next version 5.6 include support 3d libraries? it won't in pyqt v5.6. might in pyqt v5.6.1 if documentation has improved. phil from https://riverbankcomputing.com/pipermail/pyqt/2016-march/037147.html you try using vtk

mysql - inserting default value along with other columns -

hi in case need insert 2 columns in table 1 column has default value 'other'(please don't suggest put other default value) , other column should inserted different table. sample code please suggest necessary change: insert table1 (`id`,`specialty`) select `id`,`here need put default value other` table2 id not null do mean this? insert table1 (id,specialty) select id, 'other' table2 id not null

c# - Is MessageBox usable in TestClasses/TestMethods? -

i have created testclass multiple testmethod s. in 1 of test methods, trying display information popup box using messagebox.show . intellisense not pick messagebox here (manually typing won't resolve symbol). able use elsewhere throughout project wondering if there test methods preventing use. short answer since can use messagebox in rest of project, miss using system.windows.forms long answer i don't think it's idea use messagebox in testmethod blocks further test execution. consider using testcontext instead: [testclass] public class mytestclass { // declare property , test framework set public testcontext testcontext {get; set;} [testmethod] public void mytestmethod() { //... test code testcontext.writeline("hey, got information you"); // more of test code } } see testcontext.writeline() more information.

javascript - Slick slider replace dots with numbers -

i'm trying replace slick slider / carousel pagination numbers instead of dots. have project setup in js fiddle , have have custom function displays current slide count of total of 6. have '1' replacing dots have numbers represent total number of slides. js fiddle demo html <section class="slider"> <div>slide1</div> <div>slide2</div> <div>slide3</div> <div>slide4</div> <div>slide5</div> <div>slide6</div> </section> <span class="paginginfo"></span> javascript $(".slider").slick({ autoplay: true, dots: true, custompaging : function(slider, i) { var thumb = $(slider.$slides[i]).data(); return '<a>1</a>'; }, responsive: [{ breakpoint: 500, settings: { dots: false, arrows: false, infinite: false, slidestoshow: 2, slidestoscroll: 2 } }] }); if catch meani...

logstash - Sort custom field in Kibana -

i using elasticsearch, logstash 2.1, kibana 4 logging platform. in logstash's config add field (for example field people) : filter{ muate{ add_field => { "people" => "some unique name variable"} } } i can see column people in kibana discover tab, that's ok. cannot sort kibana's table of logs field "people". should set in logstash's config sort people in kibana? thanks.

c - I want to determine the cause of a sigsegv -

i'm writing applicaiton gentoo linux , redhat linux, 1 of funciton crashes on redhat machine usleep(100000); display *display; display = xopendisplay(null); window w; int x,y,i; unsigned m; window root = xdefaultrootwindow(display); xquerypointer(display,root,&root,&w,&x,&y,&i,&i,&m); ximage *image; sleep(1); image = xgetimage(display,root,0,0,1366,768,allplanes,xypixmap); int pixel = xgetpixel(image,x,y); printf("\\clr(%i,%i,%i){}\n",x,y,pixel); xclosedisplay(display); this function crashes segmentation fault on rhel machine running progrma in gdb: program received signal sigsegv, segmentation fault. 0x000000369942cb48 in ?? () /usr/lib64/libx11.so.6 missing separate debuginfos, use: debuginfo-install atk-1.30.0-1.el6.x86_64 cairo-1.8.8-6.el6_6.x86_64 expat-2.0.1-11.el6_2.x86_64 fontconfig-2.8.0-5.el6.x86_64 freetype-2.3.11-15.el6_6.1.x86_64 gdk-pixbuf2-2.24.1-6.el6_7.x86_64 glib2-2...

r - Join data frames where 'by' is an expression to get column name -

i writing loop join data frames in r , using merge function. here's code have: for (j in 1:5){ if(j == 1){ iteration <- merge(iteration, paste0("var", j), by.x = eval(as.name(paste0("x", j))), by.y = "code", all.x = true) } } iteration data frame have in global environment , have data frames titled var1, var2, var3 etc. trying merge iteration dataframe each var data frame in loop. using code have now, error in fix.by(by.y, y) : 'by' must specify uniquely valid column i understand by.x needs column name specified same way have by.y. however, have variables x1, x2, x3 defined previous functions in global environment correspond column names in datasets var1, var2, use these names by.x part. there way call names x1, x2 defined in global environment by.x in loop? or there alternative merge allow me better?

swift - Bundle not found in iOS Framework -

Image
at moment working on framework want use in different projects. framework contains couple of swift classes resources xibs , images. further using cocoapods integration in other projects. to handle resources tried 2 different approaches. first easy 1 creating resource-bundle using resource_bundles cocoapods . in beginning, xib files , images appeared in "resources" folder of "development pods", tried use them app crashed because could't found in bundle. debugging nsbundle.mainbundle() shows resourcebundle.bundle not loaded, if appeared in "products" folder. in second approach created bundle-target in framework , copied resources bundle. attached created bundle using cocoapods resource_bundle again. s.resource_bundle = { 'resourcebundle' => [ '.myprojectbundle.bundle'] } the bundle attached , appeared in "resources" directory of "development pods", again xibs couldn't loaded, neither find myprojectbun...

YAML syntax for Salt and Python -

what diference between this: dic1: - subdict1.1: value11.1 - subdict1.2: value1.2 - cubdict1.3: value1.3 and this: dict2: subdict2.1: value2.2 subdict2.1: value2.2 subdict2.3: value2.3 i know first 1 evaluates list of dictionaries. second one? isn't list of dictionaries? no, nested dictionary. example yaml code: first_level_dict_key: second_level_dict_key: value_in_second_level_dict results in python : { 'first_level_dict_key': { 'second_level_dict_key': 'value_in_second_level_dict' } } explanation salt docs . rule two: colons python dictionaries are, of course, key-value pairs. users other languages may recognize data type hashes or associative arrays. dictionary keys represented in yaml strings terminated trailing colon. values represented either string following colon, separated space

Project Euler #34: Digit factorials - review code : Java -

a digital factorial need found out. no. divisible sum of factorials of digits of no. trying on hackerrank : https://www.hackerrank.com/contests/projecteuler/challenges/euler034/ my code passing 1 test case i.e. if n < 20.other test cases not passing. code below. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class solution { public static void main(string[] args) { scanner sc = new scanner(system.in); int n = sc.nextint(); int len,newt=0,pos = 0,ans=0; long fac,sum; for(int i=10;i<=n;i++){ newt = i; sum =0; len = string.valueof(newt).length(); while(len>0){ fac=1; pos = newt % 10; newt = newt/10; for(int k=1;k<=pos;k++){ fac = fac*k; } sum+=fac; len--; } // system.out.print(sum+" ...

c++ - convert unicodestring to string in xrad studio -

i have problem in "rad studio 10 seattle" trying text input tedit object , errormessage saying e2034 cannot convert 'unicodestring' 'string' my code follows: this->shopvar->adddog(edname->text, strtoint(edage->text), "male", "dogspecial"); this function adddog takes (string, int, string, string) when try send text tedit object edname->text errormessage mentioned earlier. my question follows, can make convertion on edname unicodestring string or have change datatype of parameterlist? if so, how do it? have been searching issue have not found similar problem. you need convert unicodestring data ansi first, pass instead. easiest way assign unicodestring ansistring (or derivative) first, , use c_str() method char* pointer, std::string accept: this->shopvar->adddog(ansistring(edname->text).c_str(), ...); if possible , maybe consider rewriting shopvar class use std::wstrin...

node.js - Use redis to build a real time chat with socket.io and NodeJs -

i want built real time chat system project have problems redis because want data stored better possible. my problem: i'd use socket io real time chatting in closed group (of 2 people), how store messages? redis key value store , means if want store need add unique key data before getting stored. if same user posts more 1 messages keys use inside redis? i'm thinking unique ids unique keys since want able fetch comments when user log chat page, if need write database relate chat ids user posted message am forgetting anything? there best method this? sorry bad english. redis more key-value store. so want following: chat messages, two-person discussions, you did not mention time constraints, lets assume archive messages after while, you don't if want separate "threads" between 2 people, forums or continuous messages, facebook. i'm assuming continuous. for each user, have store messages sends. let's app_namespace:messages:...

ios - Setting tableHeaderView height dynamically -

Image
my application creates uitableviewcontroller contains custom tableheaderview may have arbitrary height. i've been struggling way set header dynamically, seems suggested ways have been cutting header short. uitableviewcontroller's relevant code: import uikit import safariservices class redditpostviewcontroller: uitableviewcontroller, networkcommunication, subviewlaunchlinkmanager { //mark: uitableviewdatasource var post: postdata? var tree: commenttree? weak var session: session! = session.sharedinstance override func viewdidload() { super.viewdidload() // post info api guard let postdata = post else { return } //configure comment table self.tableview.registerclass(redditpostcommenttableviewcell.self, forcellreuseidentifier: "commentcell") let tableheader = postview(withpost: postdata, inviewcontroller: self) let size = tableheader.systemlayoutsizefittingsize(uilayoutfittingexpandeds...

How do I reset the simulator used by an Xcode bot? -

the simulator instance i'm using left in inconsistent state after continuous integration run, how reset it? it not seem resetting simulator runs in normal user account on build server reset simulator used bots (which run under restricted _xcsbuild user.) inspired this gist , run script "before integration" trigger on bot: /usr/bin/osascript -e 'tell application "ios simulator" quit' /usr/bin/osascript -e 'tell application "simulator" quit' /usr/bin/xcrun simctl erase ... , dupe radar 24091918 add "all" valid argument xcrun simctl shutdown .

lodash - Javascript, check if current part object is inside other part object -

i trying loop on object , check if property inside other parts of object. trying see if first level.parentsearch inside of other firstlevel.filters array (of objects). so object looks example : var currentfilters = [{ "id": "topics", "name": "topics", "filters": [{ "id": "issubtopic", "label": "issubtopic", "search": "issubtopic", "num": 15 }] }, { "id": "issubtopic", "name": "issubtopic", "parentsearch": "issubtopic", "filters": [{ "id": "subtopicfilter", "label": "subtopicfilter", "search": "subtopicfilter", "num": 2 }, { "id": "subtopicfilter1", "label": "subtopicfilt...

javascript - Does it Make Sense to Insert the Google Content Experiements Tag after <meta> tags? -

google instructs put content-experiments javascript after <head> tag. does make sense insert little later that, such after key compatibility <meta> tags, like: <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge;" /> <!-- other important tags? --> <!-- google analytics content experiment code --> ... ... or totally , absolutely best put javascript above else? this should fine, long it's not nested within other tags. it's same case gtm snippet - ideally should come after <body> , there other meta tags come before (and may loaded dynamically). make sure validate code after you've pasted in on site.

How rename a .rc file in made Visual Studio 2012? -

Image
i have been doing fixes in project made in mfc/c++ ; want know how rename .rc file. explain more in picture: "dbceditor.rc" name want changed the other question, once program running , compiled, main form has main title, how edit it? want change text in form, not name object, explain better following picture: "the current main form" text want change: those questions, appreciate if guys me it. you need "properties" windows, see image below. it's different solution explorer. when editing dialog, click on dialog's title, click f4 button. should show "properties". can change dialog's caption , other properties. or can click on dialog's controls, , edit properties of each control.

ios - Progress block with GET and AFNetworking 3.0 is not called -

i have created subclass of afhttpsessionmanager : class tbnetworkclient: afhttpsessionmanager { func wordswithcompletionblock(completionblock: tberrorhandler) { querytype = .words get("words", parameters: nil, progress: { progress in print("----------") //this not called @ all, why? }, success: { sessiondatatask, response in completionblock(nil) //success called }) { sessiondatatask, error in completionblock(error) } } } marked line not called @ all, why? this definition above method in source code: public func get(urlstring: string, parameters: anyobject?, progress downloadprogress: ((nsprogress) -> void)?, success: ((nsurlsessiondatatask, anyobject?) -> void)?, failure: ((nsurlsessiondatatask?, nserror) -> void)?) -> nsurlsessiondatatask? there note: @param progress block object executed when download progress updated. note block...

python - how do i find the word position of a word that appears more than once in a string using a for loop -

loop = true while loop yes no maybe sentence : ", mylist.index(wordchosen) + 1) sorry had :( your question confusing because contained code wasn't styled code. should include plain english description of problem. tried guess :) your code has indentation issues, doesn't run such. you use input() function, fails when sentence entered: write sentence tre sdf fre dfg traceback (most recent call last): file "bin/tst.py", line 14, in <module> sentence = input() file "<string>", line 1 tre sdf fre dfg ^ syntaxerror: invalid syntax from input() documentation : consider using raw_input() function general input users. after switching input() raw_input() issue pops up: code doesn't appear work. that's because you're using is identity operator check equality, won't produce result you're expecting. see: why comparing strings ...

multithreading - Does lua command line support threads? -

is there way create threads in default lua command line utility? no, "stock" build of lua doesn't have support threads @ all. can use operating system forks spawn more scripts, or stick coroutines.