Posts

Showing posts from March, 2013

c# - I need to create a list of numbers in text file -

hello please have program create numbers in text file based on textboxes value there 3 textboxes first typing not changed number textbox2 typing first number , textbox3 typing last number in output program give me 015 100 015 101 015 102 015 103 015 104 015 105 015 106 015 107 015 108 but int text box i'm typed first :0000100 last 0000108 , 015 fixed number , me need in text file 015 0000100 015 0000101 015 0000102 015 0000103 015 0000104 015 0000105 015 0000106 015 0000107 015 0000108 and code of button int a, b; = convert.toint32(textbox2.text); b = convert.toint32(textbox3.text); system.io.streamwriter objwriter; string fm = @"c:\users\hp pavilion\desktop\text.txt"; objwriter = new system.io.streamwriter(fm); int i; (i = convert.toint32(textbox2.text); <= convert.toint32(textbox3.text); i++) { objwriter.write(textbox1.text + " " + + "\r\n"); progressbar1.value = (100 / (b - a)) * i; } objwri

ios - Facebook OAuthException when calling taggable_friends using Social Framework -

i using social framework fetch taggable_friends of user. when call api first time using below url working fine. [nsstring stringwithformat:@"https://graph.facebook.com/%@/taggable_friends", userid]; and response in format { "data": [ ... endpoint data here ], paging = { cursors = { after = qwfkq0llndf0s05vzaxbcswqxndm1mtfpbfbhzaxlyv2f5x2uxb1bpwdvtuu82lufyamzaywupfqtrfwxplskrzru9byxnuswvts2zaft21tdlnycxfcwxnpcuxor01snkd3uxzaymldyv1rutw9qcgczd; before = qwfjs2e3tgjdelflni04bldxrg4zcnvuexvyy2l0vgvvtk84u1vwdv9zaufjrb08ztf90d3zarxzjsb2tabfza6x2lmnuvqqxfsugh6nvjrbzfgrm9teldwzatdqak5cum9gm0vhtmvrzakrszafazzalezd; }; next = "https://graph.facebook.com/v2.3/996970000322616/taggable_friends?access_token=caaxvxrj0gjebafxammhzw4qotmq1uzbourwlyp1jfswoupptullrkihgoxlu0lqvyf6hoqumhb9pvuis9vekp6qlzch9sizdv1xteqsvr7rtjzxifpjzcdxztamdzcwvasmmibgidusuyofcl8sajbqlwlk57q1hwtpyjkb9wuxay2oo9zcujmuzcsmeufesvslopraraufbvfws

javascript - Progress bar for Leaflet map -

how can show centered on map progress bar (with %) while waiting layer rendered on map? here code: <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> <script type='text/javascript' src="http://makinacorpus.github.io/leaflet.spin/leaflet.spin.js"></script> <script type='text/javascript' src="http://makinacorpus.github.io/leaflet.spin/spin.js/dist/spin.min.js"></script> </head> <body> <a href="#" onclick="showmap('http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png')">tf.landscape</a>&nbsp;|<a href="#" onclick="showmap('http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png')">tf.outdoors</a> <div id="map" style="width: 640px; height: 480px"></div> <progress value="0" max="100"></progress> <

python 2.7 - How to remove the duplicate lines retaining first occurences -

let's input text file "input_msg.txt" file contains follwing records.. jan 1 02:32:40 hello welcome python world jan 1 02:32:40 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:55 learn python smart mar 31 23:31:56 python scripting language jan 1 00:00:01 hello welcome python world jan 1 00:00:02 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:56 python scripting language the expected output file ( let's outputfile.txt ) should contain below records... jan 1 02:32:40 hello welcome python world jan 1 02:32:40 hello welcome python world mar 31 23:31:55 learn python mar 31 23:31:55 learn python smart mar 31 23:31:56 python scripting language jan 1 00:00:01 hello welcome python world jan 1 00:00:02 hello welcome python world note: need records (including duplicate) starting "jan 1( )" , don't need duplicate records not starting "jan 1( )" i have tried following program duplicat

java - Change if-else statement into switch statement -

i having trouble on how can handle condition. have 5 items filtered , planning add more, add items increases possible combination such 1*2*3*4*5 combinations 5 when have 10 items , 3 million combinations. on current thread recommend me use switch no idea how perform reduce possible combination. can change if-statement switch or there other way can handle these combinations. here's program // filter selected for(int subloop=0; subloop<sspecialty[loop].length; subloop++) { if (sreg[loop].equalsignorecase(thisfilter[0]) && sadmin[loop].equalsignorecase(thisfilter[1]) && sambience[loop].equalsignorecase(thisfilter[3]) && amounttf >= thetuitionfee && sspecialty[loop][subloop].equalsignorecase(thisfilter[4])) { list.add(slist[loop]); // regaffil } else if (sreg[loop].equalsignorecase(thisfilter[0]) && t

ember.js - Debugging Rails 3.2 failing to precompile ember-rails 0.19 -

looking way determine in code or in ember-rails/ember-rails-source error coming from. using rails 3.2 , latest ember-rails 0.19. when precompile assets failure: unexpected token: operator (!) (line: 16, col: 178179, pos: 178546) error @ new js_parse_error (<eval>:3096:22) @ js_error (<eval>:3104:15) @ croak (<eval>:3557:17) @ token_error (<eval>:3564:17) @ unexpected (<eval>:3570:17) @ object.semicolon [as 1] (<eval>:3590:51) @ prog1 (<eval>:4133:29) @ simple_statement (<eval>:3726:35) @ <eval>:3634:35 @ block_ (<eval>:3822:32) (in /users/sjustin/development/my-app/app/assets/javascripts/application.js.coffee) i've been able destructively assets precompile removing ember sprockets reference, #= require ember in application.js.coffee : #= require jquery #= require jquery_ujs #= require ember #= require ember-data #= require_self #= require my-app window.myapp = ember.ap

ios - Remove -Objc flag from Cocoapods install -

my project won't build if keep -objc flag in other linker flags , inherit flag cocoapods. can delete pods.debug.xcconfig , works, however, every time run pod update comes , have delete again. is there podfile script add automate removing -objc flag? i'm using cocoapods v0.37.2. i'd remove -objc following snippet taken pods.release.xcconfig , pods.debug.xcconfig. other_ldflags = $(inherited) -objc -l"c++" -l"sqlite3" -framework "avfoundation" -framework "alamofire" btw need remove -objc flag caused parse , facebook sdks. i don't know if still need this, able post_install script on podfile. have different targets , works well: post_install |installer| installer.pods_project.targets.each |target| target.build_configurations.each |config| xcconfig_path = config.base_configuration_reference.real_path xcconfig = file.read(xcconfig_path) new_xcconfig = xcconfig.sub('other_ldflags

Custom value change listener in android? -

need or advice. aim continuous updates method android.telephony.cellsignalstrengthwcdma.getdbm() (get mobile network signal strength dbm) , make update of correspondent text view when value provided method changes. the first approach of solution request value in do-while cycle predefined time interval, 1 second, check difference between common , previous values , make decision of textview update. so question maybe there other better way this, using kind of system listener etc? br, you need add phonestatelistener telephonymanager using proper method listen(). need pass sub class of phonestatelistener , event want get. example can listen phonestatelistener.listen_cell_info; in case method oncellinfochanged (list cellinfo) of phonestatelistener called, providing info need, avoiding loop.

How can I place a folder in a specific location using javafx-ant with Maven? -

i have upgraded build plain ant maven manage dependencies. 1 of third party jars needs supporting file placed in specific location. i have managed create simple pom.xml compile application , generate exe installer. unable place file in specific folder location. when application build & deployed should placed in location: ${project.build.directory}/deploy/bundles/myapplication/app/{custom-folder}/*.properties this want correctly bundled in installer - unable find way specify specific location specific file. following pattern (only showing relative pieces of pom): <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-antrun-plugin</artifactid> <version>1.6</version> <executions> <execution> <phase>package</phase> <configuration> <target> <taskdef name="jfxdeploy" classname="com.sun.javafx.tools.ant.deployfxtask" classpathref="maven.plugin.classpath" />

html - asp.net apply same style to textboxes within div -

i have 3 div's on 20 textboxes in each div. based on rules, each div enabled or disabled. i use following code via vb disable or enable of fields in each div, , works great: div_full1_details.attributes.add("disabled", "") div_full1_details.attributes.remove("disabled") now when enable div, apply style each box within div, , 1 hit, code above. so apply this: div_full1_details.attributes.remove("disabled")` div_full1_details.style.add("border-bottom", "thin dotted #ad9f9f") so last line of code apply style textboxes within div div_full1_details can done ? update: following comments below , search on web regarding child style, etc, have done follows, wrong: css .div_details_dotted * {border-bottom: thin dotted #ad9f9f} .div_details_dotted_white * {border-bottom: thin dotted white} vb page ' set 3 divs white dotted border-bottom div_1_details.attributes.add("class", "div_d

ruby on rails - Is RoR 'routes' file an alternative for Apache 'mod_rewrite' module? -

i'm starting web developer , following question sake of connecting several new things in brain: ror 'routes' file alternative apache 'mod_rewrite' module? thanks in advance participating. it's similar in list of url patterns, each pattern having rules associated it. the main difference routes internal rails: mod_rewrite come decision route, , serve file, or pass request on proxy handle, can thought of standalone process in request pipeline. routes.rb on other hand can thought of runs inside rails , decides object (where objects controllers) should have method called on it, passing through request object. maybe isn't happens it's this. rails black box request comes in , response comes out, , routes inside box. so, guess it's alternative mod_rewrite, because instead of using mod_rewrite apache pass requests rails , let rails (using routes.rb code) figure out. it's kind of different thing. edit: re-read , realised it'

c++ - Size of a class with only one function which do not have body -

this question has answer here: sizeof class int , function, virtual function in c++? 4 answers i have been asked question size of below give class: class { void abc(); } and if make function virtual size now class { virtual void abc(); } note: question in respect visual studio compiler. i told first have 1 byte , second have 5 bytes compiler adds v pointer second. i check on visual studio 2010 in 64 bit machine:- the size of class in first case 1 byte , in second case 4 byte.i play around , found below results putting in questions: i found if class have functions in it(with body or without) , no data members, size of class 1 byte , object created have size 1 byte below example: class myclass { void abc(){int x=0;} int getdouble(int y){return y*2;} }; int main() { myclass obj;; std::cout<<sizeof(myclass )<<"\n&qu

c++ - Is multiple inheritance needed? -

i have situation below: class { virtual void f() { /*some default impl here*/} virtual void g() { /*some default impl here*/} }; class b : public { virtual void f() { /* specific stuff , call parent's f()*/} virtual void g() { /* specific stuff , call parent's g()*/} }; class c : public { virtual void f() { /* specific stuff , call parent's f()*/} virtual void g() { /* specific stuff , call parent's g()*/} }; class mixed /* don't know how derive*/ { virtual void f() { /* call b::f()*/} virtual void g() { /* call c::g()*/} }; i'm thinking multiple inheritance here. i.e., make mixed derived b , c . there known problems (for example, diamond problem ). another solution composition. but correct solution, please advise :) thanks in advance! the fact each method has "do stuff" before calling parent causes problem. one solution have a , b members in mixed class. can control need them in mixed::f

How to have a Powershell Function return a table? -

i love using tables in powershell scripts. since lot of repeating code create them if need different tables, decided create function returns functional table me. my try far looks this: function maketable ($btab, $tablename, $columnarray) { $btab = new-object system.data.datatable("$tablename") foreach($col in $columnarray) { $mcol = new-object system.data.datacolumn $col; $btab.columns.add($mcol) } } $acol = @("bob","wob","trop") $atab = $null maketable $atab "test" $acol alternatively tried: function maketable ($tablename, $columnarray) { $btab = new-object system.data.datatable("$tablename") foreach($col in $columnarray) { $mcol = new-object system.data.datacolumn $col; $btab.columns.add($mcol) } return $btab } $acol = @("bob","wob","trop") $atab = maketable "test" $acol i tested both versions same code: $arow = $atab.newrow() $arow["bob&qu

php - Best way to find matches of several substrings in string? -

i have $a=array('1str','2str','3str') , $str ='123 2str 3str 1str' , trying simple thing - find position of each item of $a in $str. it's easy done loops , strpos , i'm curious best (and short, actually) way positions? actually need nearest of found items in string (2str) if need offsets, use preg_match_all function , flag preg_offset_capture if(preg_match_all('/'.implode('|', $a).'/', $str, $out, preg_offset_capture)) print_r($out[0]); useful if need match such \b word boundaries or caseless matching using i flag . as @mike.k commented : if $a contains characters special meaning inside regex pattern , need escape first: array_map(function ($v) { return preg_quote($v, "/"); }, $a) to 1 that's closest start, don't need offsets. preg_match , simple pattern 1str|2str|3str ( see test @ eval.in ). if(preg_match('/'.implode('|', $a).'/', $str, $

python - Numpy zip array for LineCollection -

is there simple way zip numpy columns used input linecollection? current format note array has many more elements used. arr=([(x1, y1, z1, a1, b1, c1), (x2, y2, z2, a2, b2, c2), (x3, y3, z3, a3, b3, c3)]) desired format i lines in following format might able use linecollection: lines = [[(x1, x2), (y1, y2)], [(x2, x3), (y2, y3)] ...] linecollection(lines) i not know direct numpy functions or such trick. but if want first 2 elements each sublist , can try - arr = [(1,2,3,),(2,3,4),(3,4,5),(4,5,6),(5,6,7),(6,7,8)] lines = [] in range(len(arr)-1): lines.append([(arr[i][0],arr[i+1][0]),(arr[i][1],arr[i+1][1])]) lines >>> [[(1, 2), (2, 3)], [(2, 3), (3, 4)], [(3, 4), (4, 5)], [(4, 5), (5, 6)], [(5, 6), (6, 7)]]

c# - Passing MATLAB methods as delegates to .NET Object -

currently have matlab project using .net library. in matlab read in .dll , instantiate .net object developed, , pass data , it: net.addassembly('mylibrary.dll'); mynetobj = mynamespace.myclass(); mynetobj.dowork(somematlabvariable); following matlab documentation (see here ) can pass variables .net functions, have .net code call matlab methods/callbacks. documentation defines how use .net delegates matlab .net delegates (see here ). is possible pass (point to) matlab function .net delegate or action, can call callback .net object? i found how pass matlab function handles delegates in c#. answer buried in matlab .net documentation . in .net/c# code: namespace somenamespace{ // create delegate appropriate input parameters , return types public delegate void somedelegatetype(); public class someclass{ // create delegate matlab assign public somedelegatetype somedelegate; ... } } in matlab: // % instantiate .net object c

.net - Timeout expired during select request using NHibernate -

i use nhibernate in project. diferent request different table fail genericadoexception wraps inside sqlexception: timeout expired. example (there index on objectid) nhibernate.exceptions.genericadoexception: not execute query [ select user_15f5e0_.id col_0_0_, user_15f5e0_.objectid col_1_0_, user_15f5e0_.typename col_2_0_, user_15f5e0_.vulnerabilitylevel col_3_0_, user_15f5e0_.displayname col_4_0_, user_15f5e0_.username col_5_0_ [user] user_15f5e0_ user_15f5e0_.objectid in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 ) ] --> system.data.sqlclient.sqlexception: timeout expired. timeout period elapsed prior completion of operation or server not responding. ---> system.componentmodel.win32exception: wait operation timed out it's 1 request via webapi, without different activitis in other threads. according logs there no opend transactions. thought main reason not commited transaction, these exceptions occure undeterminated whithout "write"

scala - Why is there no >=> semigroup for A => M[A] in Scalaz? -

this followup previous question kleisli defines 2 operators <=< (compose) , >=> (andthen). >=> looks natural me , don't understand how <=< can useful. moreover, looks there no >=> semigroup a => m[a] <=< semigroup exist. what rationale behind ? compose (or <=< ) little more natural when translating between point-free , non point-free styles. example, if have these functions: val f: int => int = _ + 1 val g: int => int = _ * 10 we following equivalences: scala> (f andthen g)(3) == g(f(3)) res0: boolean = true scala> (f compose g)(3) == f(g(3)) res1: boolean = true in compose case f , g in same order on both sides of equation. unfortunately scala's type inference makes andthen (or >=> ) more convenient, , tends more used compose . case mathematical conventions , quirks of scala's type inference system @ odds. scalaz (not surprisingly, given culture of project) chooses mat

c# - Extract data from datatable -

i extract data sheets in workbook using following code : foreach (var sheetname in getexcelsheetnames(connectionstring)) { if (sheetname.contains("_")) { } else { using (oledbconnection con = new oledbconnection(connectionstring)) { var datatable = new datatable(); string query = string.format("select * ,{0} sheetname [{0}]", sheetname); con.open(); oledbdataadapter adapter = new oledbdataadapter(query, con); try { adapter.fill(datatable); ds.tables.add(datatable); } catch { } } } i can't figure how data stocked in datatable : sheetname added

osx - Prevent original files from OS X app's sandbox container to be modified via drag and drop or Share Extensions? -

i have shoebox type (as opposed document based) os x app stores images in app's sandbox container. these images can shared via share extensions (in form of nsurl) or exported via drag , drop. when image shared image editor (e.g. acorn offers share extension), or dropped on image editor, image editor opens file from within sandbox container , can alter, rename or delete file - can lead kinds of inconstancies in app. first, surprised, because thought, files in sandbox can accessed app itself. seems not case, when intentionally share nsurl. so how can prevent can alter files in sandbox container while still offering them drag , drop , share extensions? i tried not sharing nsurls nsimages, many share extensions not work nsimages, not option. is possibility write-protect files in sandbox? should make copy of image temporary location, before offer sharing or drag , drop (could slow big images?) i happy hear suggestions or learn more problem. create bookmark

Files and generating numbers ,c programming -

task next: after generate 20 random numbers , read informations file tombula.txt contains names of users , 9 numbers,print first user (his/her name) has 3 numbers own array equal generated numbers. this part of code generate numbers , read file don't know how find first person has 3 numbers array equal generated numbers,if know how write please help: #define _crt_secure_no_warnings #include<stdio.h> #include<stdlib.h> #include <time.h> typedef struct { char name[50]; int num[8]; }someone; void generating(int[]); int check(int[], int); int main(void) { *pk = null; int i, j, count = 0, tip; file *f; int generated[30]; int brojac[5]; srand(time(null)); generating(generated); (int j = 0; j < 20; j++) printf("%d ", generated[j]); printf("\n\n\n"); f = fopen("tombula.txt", "r"); if (f == null) { printf("error!");

haskell - Data family instance binding illegally to built in syntax: () -

i'm trying define data type family , 1 of parameters results in type of empty tuple () , doesn't compile. here minimal working example: {-# language typefamilies #-} data family f data instance f int = () the compiler error thrown says "illegal binding of built-in syntax: () ". why getting error, though i'm not trying change definition of () , rather set output of computation (evaluation of type family)? for it's worth, program compiled when () changed bool instead. with data families, you're supposed provide adt or gadt definition on right side of equation. () not valid definition of constructor. data instance f int = bool declares single constructor name bool , works, doesn't have type bool . it's bool available constructor name. what you're trying can realized type families instead: type family f type instance f int = () -- or in closed form type family f f int = () or can give right hand side data instanc

keycode - How to detect three pressed keys on keybord by jquery and javascript -

this question has answer here: how implement shortcut key combination of ctrl or shift + <letter> through javascript? 4 answers i need detect keys pressed in keyboard action upon that wrote script $(document).keyup(function(e){ var map = {18: false, 17: false, 65: false}; if (e.keycode in map) { map[e.keycode] = true; if (map[18] && map[17] && map[65]) { alert("pressed alt+ctrl+a"); } } }); but script doesn't work can on me in please the e object provide e.ctrlkey aswell e.altkey , e.shiftkey you need test this: e.ctrlkey && e.altkey && e.which == 65

SQL SERVER: Count data with the same group using Partition -

Image
based on picture above, need come countremarks column in count number of similar data in remarks column per location. so, tenant 1 , 2 have total of 2 in location "em" , total of 1 tenant 3 in same location. same counting location "cw". unfortunately, have come output, counting same remnarks , disregarding location. this portion in code used case when [remarks] >= 4 remarks else count(remarks) over(partition [remarks] ) end 'countremark' try using window function , partition location , remarks: select location, tenant, remarks, countremarks = count(*) on (partition location, remarks) your_table order tenant given sample data results in: location tenant remarks countremarks em tenant1 1 2 em tenant2 1 2 em tenant3 2 1 cw tenant4 1 2 cw tenant5 1 2 cw tenant6 2 1

python - Handling parsed variables stored in dictionary -

is there better, more pythonic way parse , set value variable (stored in var_dict dictionary) , value same? the code below working, setting , getting parts complicated. from pyparsing import word, nums, forward, zeroormore, alphas, alphanums, group, combine def test_grammar(): number = word(nums) itemlist = forward() items = (number | itemlist) itemlist << ('[' + items + zeroormore(',' + items) + ']') variable = word(alphas, alphanums+"_")("variable") data = itemlist("data") assignment = group(variable + '=' + data)("assignment") indexes = zeroormore('[' + number + ']')("index") query = combine(variable + indexes)("query") action = assignment | query return action var_dict = {} test_input1 = "nl = [1, [2, 3]]" test_input2 = "nl[1][1]" tokens1 = test_grammar().parsestring(test_input1) variable

c# - How to return object from list in constructor -

i have retrieved static table database in list. if calls constructor of class id, constructor finds object in list , copies values. public class myclass { public int id { get; set; } public string text { get; set; } public myclass(int instanzid) { myclass myclass = cachedlist().find(t => t.id == instanzid); id = myclass.id; text = myclass.text; } } this create new instance of object. possible return object list directly? this: public class myclass { public int id { get; set; } public string text { get; set; } public myclass(int instanzid) { = cachedlist().find(t => t.id == instanzid); } } i know it's easy in static method, how can done in constructor? well no, not via constructor. can via method. example factory: public myclass findorcreate(int instanceid) { myclass obj = cachedlist().find(t => t.id == instanzid); //create obj when not exist return obj; }

java - @JsonDeserialize converter use StdDelegatingDeserializer by default -

i'm trying use @jsondeserialize annotation converter @jsondeserialize(converter = pgjsonconverter.class) i'm using spring data rest project , when sending put request there calling deserialize method super class jsondeserializer of stddelegatingdeserializer public t deserialize(jsonparser p, deserializationcontext ctxt, t intovalue) throws ioexception, jsonprocessingexception { throw new unsupportedoperationexception("can not update object of type " +intovalue.getclass().getname()+" (by deserializer of type "+getclass().getname()+")"); } i'f don't use @jsondeserialize have beandeserializer instead of stddelegatingdeserializer. in deserializecache:356 found condition converter<object,object> conv = beandesc.finddeserializationconverter(); if (conv == null) { // nope, construct in normal way return (jsondeserializer<object>) _createdeserializer2(ctxt, fa

c - Has Vala memory leak when building shared library? -

will vala code memory leak when built shared library (.so)? vala: namespace test { public static string info(string name){ return "hello " + name; } } source code ( valac -c ) gchar* test_info (const gchar* name) { gchar* result = null; const gchar* _tmp0_ = null; gchar* _tmp1_ = null; g_return_val_if_fail (name != null, null); _tmp0_ = name; _tmp1_ = g_strconcat ("hello ", _tmp0_, null); result = _tmp1_; return result; } compilation: valac --library=test -h test.h "test.vala" -x -fpic -x -shared -o test.so i surprised no memory deallocation in test_info . will g_strconcat store allocated memory in global variable (possible thread-local)? will memory leak if call test_info external programm miltiple times without deallocation? i sorry possible simple question, new in vala (my primary experience in area of go, python, c++ , etc) your code return owned string, caller responsi

python - I've created a GUI using wxPython and the functions aren't executed when I run my app -

i'm using python 2.7 , i'm creating gui specific text editor using wxpython .. i've created these 2 scripts run program: gui.py , app1.py , i've put both of them in single folder. the problem once run app1.py, opens gui perfectly.. when press buttons, commands i've inserted app1.py aren't executed.. not in terminal simple print ().. i'm using python "2.7.9" i can run import wx and wx.__version__ "3.0.2.0" so, what's problem code? is inheritance concept problem? should use super() fix that? if so, how supposed use it? the gui.py code: # -*- coding: utf-8 -*- ########################################################################### ## python code generated wxformbuilder (version jun 17 2015) ## http://www.wxformbuilder.org/ ## please "not" edit file! ########################################################################### import wx import wx.xrc ######################################

java - Android - combine multiple images into one ImageView -

Image
i'm looking developing (or library) can allow me merge multiple images 1 imageview. my application grouping interactions between users, instead of displaying them singularly, , therefore merge of avatars, 1 adapter cell visualizes "group". a fantastic example of done on facebook.com's chat such: my question is, how can provide functionality in android / java? presumably, number of images between 1 , 4. please let me know of advice can give :) you can use multiimageview. add dependency in app.gradle : compile 'com.github.stfalcon:multiimageview:0.1' add multiimageview layout xml file <com.stfalcon.multiimageview.multiimageview android:id="@+id/iv" android:layout_width="100dp" android:layout_height="100dp"/> in java class find view id: final multiimageview multiimageview = (multiimageview) findviewbyid(r.id.iv); for adding image multiimageview use method addimage(bitmap bitmap).

c# - ASP.NET Web API 2 XML Post request ignore XML namespace attribute -

for webapi xml request can xml namespace can ignored while model binding. i want below requests bind correctly orderheader object: <orderheader xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <orderdate>2015-07-20t15:00:00</orderdate> <customeraccountnumber>test1</customeraccountnumber> <customerponumber>test2</customerponumber> <customerreferencenumber /> </orderheader> <orderheader> <orderdate>2015-07-20t15:00:00</orderdate> <customeraccountnumber>test1</customeraccountnumber> <customerponumber>test2</customerponumber> <customerreferencenumber /> </orderheader> <orderheader xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="http://schemas.datacontract.org/2004/07/test.models.api"> <orderdate>2015-07-20t15:00:00</orderdate> <cust

cakephp - Validation doesn't working in cakephp2.x -

i new in cakephp . wrote validation ctp file in cakephp 2.6.7 viewing login , logout word validation doesn't work. my code is:- <?php if (!$authuser) { echo $this->element('logout-header'); } else { echo $this->element('login-header'); } ?> how can write validation in ctp file viewing login , logout word in page header? why wrote validation ctp? put validation rules in model http://book.cakephp.org/2.0/en/models/data-validation.html

java - Zombie connections after hosting -

i have application developed java using mysql , c3p0 connection pooling. application works fine in localhost, connection management superb. however, uploaded application daily razor "private jvm", , here go, there lot of mysql connections application ever make! application make max 10 connections, when hosted there can see 30 or more. apart that, had number of mysql processors running in localhost, when uploaded online server can see 2. upside down. application works fine there number of times had restart server due slow connection issue. what making kind of thing? anyway pls don't ask code, because don't know issue is

xcode - How to initialize a ALAssetsGroupType constant in Swift? -

Image
i'm trying initialize alassetsgrouptype constant in swift (xcode 6.4.): let grouptypes: alassetsgrouptype = alassetsgrouptype(alassetsgroupall) but doesn't compile 32bit devices(ex, iphone 5) , error: there's better way, direct approach use constructor int32 create signed int32 uint32 : let grouptypes: alassetsgrouptype = alassetsgrouptype(int32(bitpattern: alassetsgroupall)) explanation if option-click on alassetsgrouptype see typealias int : typealias alassetsgrouptype = int but, if click on assetslibrary next declared in see in header file typedef nsuinteger : alassetslibrary.h typedef nsuinteger alassetsgrouptype; so, what's going on here? why doesn't swift treat nsuinteger uint ? swift typed language, means can't assign int uint without conversion. keep our lives simpler , remove many of conversions, swift engineers decided treat nsuinteger int saves lot of hassle in cases . the next piece of mystery definiti

python - pandas - get values from multindex columns -

i have following dataframe df: h,nu,city,code,code2 0.965392,15,madrid,es,es 0.920614,15,madrid,it,es 0.726219,16,madrid,tn,es 0.739119,17,madrid,fr,es 0.789923,55,dublin,mt,en 0.699239,57,dublin,en,en 0.890462,68,dublin,ar,en 0.746863,68,dublin,pt,en 0.789923,55,milano,it,it 0.699239,57,milano,es,it 0.890462,68,milano,ar,it 0.746863,68,milano,pt,it i add new column hcode , each city , h value corresponding code mapped code2 string, resulting dataframe appears as: h,nu,city,code,code2,hcode 0.965392,15,madrid,es,es,0.965392 0.920614,15,madrid,it,es,0.965392 0.726219,16,madrid,tn,es,0.965392 0.739119,17,madrid,fr,es,0.965392 0.789923,55,dublin,mt,en,0.699239 0.699239,57,dublin,en,en,0.699239 0.890462,68,dublin,ar,en,0.699239 0.746863,68,dublin,pt,en,0.699239 0.789923,55,milano,it,it,0.789923 0.699239,57,milano,es,it,0.789923 0.890462,68,milano,ar,it,0.789923 0.746863,68,milano,pt,it,0.789923 so far tried groupby city , code2, no results. you can groupby on '

c - How to generate a lot of session IDs in PHP? -

i troubleshooting recent session id collision , want purpose exercise function php_session_create , compute empirical probability function generate colliding session ids in standardised (labor) conditions. however function not directly bound in php, seems indirectly accessible. easiest strategy generate lot of session ids? use burp suite's sequencer make multiple cookieless requests site, , capture session id generated each one. burp can analyze captured sessions ids display estimated entropy.

java - Define SpoutConfig parameter -

i have storm topology in using kafkaspout . brokerhosts zk = new zkhosts("localhost:2181"); spoutconfig spoutconf = new spoutconfig(zk, "topic", "/topic", "discovery"); i want know 3rd , 4th parameter passed in spoutconfig . is 3rd parameter, zookeeper root path zookeeper install or datadir path? the 4th parameter id, don't know why used , should have give? zkroot , id used construct zookeeper path under storm stores kafka offset. can read here . the spout stores state of offsets consumed in zookeeper. spout parameterized root path store offsets , id particular spout. offsets partitions stored in these paths, "0", "1" ids partitions: {root path}/{id}/0 {root path}/{id}/1 {root path}/{id}/2 {root path}/{id}/3 ...

Python logging module: duplicated console output [IPython Notebook/Qtconsole] -

i trying play python logging module bit confused here. below standard script create logger first, , create , add file handler , console handler logger . import logging logger = logging.getlogger('logging_test') logger.setlevel(logging.debug) print(len(logger.handlers)) # output: 0 # create file handler logs debug messages fh = logging.filehandler('/home/jian/downloads/spam.log', mode='w') fh.setlevel(logging.debug) # create console handler higher log level ch = logging.streamhandler() ch.setlevel(logging.debug) # create formatter , add handlers formatter = logging.formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setformatter(formatter) fh.setformatter(formatter) # add handlers logger logger.addhandler(ch) logger.addhandler(fh) print(len(logger.handlers)) # output: 2 # write log messages logger.debug('debug message') logger.info('info message') logger.warn('warn message') logger.error('er

objective c - OS X Customised Quick Look plugin -

i need write customised ql plugin file type (let .xyz) used in application. , .xyz contains associated video name , video stored in same folder. what need is: fully customised ui view shows video , information calculated .xyz file. need button "edit" modify file name, content , associated video name. is possible? have gone through ql tutorial, seems show information(read-only) cannot modify content. cheers

Cocos2d JS HTML5 -

Image
i want rotate image in cocos2d java-script html5. upper , lower circles 2 different sprites. using code: var rotationamount=0; top=cc.sprite.create("assets/top.png"); top.setposition(midx,midy+100); top.schedule(function(){ if(rotationamount>360) rotationamount=0; }); this.addchild(top); here's how sprites look: the above causes sprite starts rotate around itself. want make rotate around point, going wrong? you can next: var top = cc.sprite.create("assets/top.png"); var rotateaction = cc.rotateby.create(0, 1); top.attr({ x: midx, y: midy, anchorx: 0.5, anchory: 0.5 }); top.schedule(function() { top.runaction(rotateaction); }); this.addchild(top);

Asp.net C# cant see input text type using jquery -

i made login/signup dialog box using jquery c# code cant see text box input fields , need value text box fields using c# code please thank ! asp.net / c# / jquery html : <header role="banner"> <div id="cd-logo"><a href="#0"><img src="http://codyhouse.co/demo/login-signup-modal-window/img/cd-logo.svg" alt="logo"></a></div> <nav class="main-nav"> <ul> <!-- inser more links here --> <li><a class="cd-signin" href="#0">sign in</a></li> <li><a class="cd-signup" href="#0">sign up</a></li> </ul> </nav> </header> <div class="cd-user-modal"> <!-- entire modal form, including background --> <div class="cd-user-modal-container&qu