Posts

Showing posts from March, 2012

c# - create an instance of a manager class -

let's have class customermanager lot of methods interact dal.customermanager. there lot's of mehods not interact dal.customermanager class. should instantiate _dalcustomermanager class code below? public class customermanager { private dal.customermanager _dalcustomermanager = new dal.customermanager(); public void deletecustomer(int customerid) { // .. logic here ... _dalcustomermanager.deletecustomer(customerid); } } or better solution because don't instance of _dalcustomermanger , when access dalcustomermanager property creates new instance of when it's null ? public class customermanager { private dal.customermanager _dalcustomermanager; private dal.customermanager dalcustomermanager { { return _dalcustomermanager ?? (_dalcustomermanager = new dal.customermanager()); } } public void deletecustomer(int customerid) { // .. logic here ... dalcus

javascript - How to print a hidden div content using jquery? -

i have anchor button , hidden div. write code print content of div. time shows content in print file , time blank. please me <div class="row-fluid printdiv" id="printdiv" style="display:none;"> <div class="col-md-8 indexleft"> <div class="blog"> <!-- blog details --> <div class="blogdetail row-fluid"> <div class="col-md-5"> <figure><img src="images/24hr-gym-logo-2014-698x198.jpg" alt="" /></figure> </div> <div class="col-md-7"> <div class="title"> <h2><a href="#">relief chronic pain 1</a></h2> </div> <div class="writer"> <label>writtern :- </label> bev matushewski</div>

Optimize nutch performance on hadoop cluster -

i'm trying optimize nutch performance crawling sites. test performance on small hadoop cluster, 2 nodes 32gb ram, cpu intel xeon e3 1245v2 4c/8t. config nutch http://pastebin.com/bbrhpfuq so, problem: fetching jobs works not optimal. reduce task has 4k pages fetching, 1kk pages. example see screenshot https://docs.google.com/file/d/0b98dgnxoqkmvt1doovvpuu1pnxm/edit reduce task finished in 10 minutes, 1 task work 11 hours , still continue working, it's bottle neck when have 24 reduce task, works one. may can give usefull advices or links can read problem. it problem in nutch, takes 50 000 000 1 site , 500 000 other. when creating queue host see 1 extremely big queue , other small.

android - Display large text from BufferedReader into viewPager fragments (text reader type implementation) -

im trying make reader app wherein data static. have saved data in text files in assets folder. want read data using bufferedreader , display in viewpager . user goes on swiping right, pages should added viewpager along data bufferedreader if there data display. this getitem function inside viewpageradapter. public fragment getitem(int i) { fragment pagefragment = new pagefragment(); stringbuilder sb = new stringbuilder(); bufferedreader reader = null; try { inputstream file = context.getassets().open("chap1.txt"); reader = new bufferedreader(new inputstreamreader(file)); // reading, loop until end of file reading string mline = reader.readline(); while (mline != null) { //process line sb.append(mline); sb.append("\n"); mline = reader.readline(); } } catch (ioexception e) {

Jar file in an Android Studio project with multiple modules -

i have single android studio project 4 modules: two app modules; one android library module; a fourth module common shared among 2 app modules. all modules depend on jar file developed other people. if add jar file in libs folder of each submodule (app, library, common ) fine. if add fifth module project import .jar or .aar package module , put dependency on in each submodule, no module finds classes in jar file. if @ build.gradle commands 1 of 2 apps, read this: ... dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' compile project(':library.myproject.com') compile 'com.squareup.okhttp:okhttp:2.2.0' compile 'com.squareup.okio:okio:1.2.0' compile project(':commonclasses') compile project(':servicesjar') } the dependencies on :library.myproject.com , :commonclasses ok. dependency on jar file :servicesjar n

matlab - Adjust levels for ezcontourf() -

i'm have difficulties should easy. i'm plotting several contours ezcontourf() function. color scale identical each plot easy compare results. i have done contourf() in same document using 'levellist',custom_levels custom_levels vector level data. however, ezcontourf() doesn't , can't seem use h = ezcontourf() either. appreciated! wcr = fun(x,y) figure ezcontourf(wcr,[0, 250, 0, 250]); so solution use caxis([min max])! future reference.

Displaying a pop up message in javascript for my rails application -

question in rails application have method in user controller auto populate. fills in form new user when signing .when fill in emp_id text box looks @ employee table pulling data if id matches emp_id typed auto populate thier emp_first_name , emp_last_name. able have pop message when data returns has data but, im stuck on how make show message if no data exist perticular emp_id... this controller class usercontroller < applicationcontroller def populate_form @visual = visual.find_by_id(params[:emp_id]) if @visual.nil? respond_to |format| format.json { render json: @user, status: :unprocessable_entity, flash[:error] => "error no id found." } #this didn't work no message displays.. end else @emp_first_name = @visual.first_name @emp_last_name = @visual.last_name render :json => { :emp_first_name => @emp_first_name, :emp_last_name => @emp_last_name

testing - How do I calculate the number of concurrent users to use in a load test? -

we’ve come across question @ load impact, thought i’d add stack overflow community make easier find. how calculate number of concurrent users (vus) need simulate during load test, in order stress system same kind of traffic see in course of month, week or day? running load test requires specify how many concurrent users should simulated during testing. in other words, how many simulated users active, loading things or interacting site/app @ same time. unfortunately, when looking @ google analytics example, see how many visits website has per day or per month. site can have million visits per month, still ever experience max 100 concurrent visitors. to convert "visits per x" metric google analytics, or other analytics system, "concurrent users" metric can use load testing, can use following method. first, find out 2 things: you need total number of visits short time period when site/app @ peak traffic levels. can found via e.g. google analytics

batch file - Reading registry value's data with spaces -

i making program. when installed, run batch file needs know application folder is. the installation wizard software using creates registry key represents program's path, "program files" has space in it, batch output "c:\program" my current script is: @echo off setlocal enableextensions set key_name="hkey_local_machine\software\marksrtz\av" set value_name=datapath /f "usebackq skip=2 tokens=1-3" %%a in (`reg query %key_name% /v %value_name% 2^>nul`) ( set valuename=%%a set valuetype=%%b set valuevalue=%%c ) if defined valuename ( echo data "%valuevalue%" echo name "%valuename%" echo type "%valuetype%" ) else ( echo not found ) the datapath value set [appdir]\data on installation, [appdir] being location user selected. but said, script output c:\program if [appdir] set c:\program files (x86)\marksrtz\av\ in installer (which default) how can fix this? i note; b

c# - How to unload unsued COM objects/libraries after a complete restart? -

here thing. i'm connecting via com devices @ knx/eib. - , want ready worst-case anyways - application crashes leaving objects , libraries exposed somewhere, somehow. noticed when restart app have trouble connection again. error connection procedure working normally. connect procedure working not, randomly. bad! after time (several minutes) seems work again after series of complete fails. think see pattern now. doesn't work after crash no clean disconnect. guess there objects hold connection device why can't new connection. why ask question. question: how unload unused objects kill undead connections? how make windows check unused libraries unloaded? i want tell windows, "i messed badly , need continue work. please clean mess me, can start fresh! deserve 2nd chance?" edit: scenario app has crashed , closed. have no references anymore. no clause or anything. app can started again. can clean mess has been made before, programmatically? edit 2: hans

c# - Error: "Padding is invalid and cannot be removed" using asymmetric algorithm -

i want encrypt , decrypt string using asymmetric cryptographic algorithm want pass different key in encrypt , decrypt function. my code follows: public actionresult encrypt(string cleartext) { string encryptionkey = "abkv2spbni99212"; byte[] clearbytes = encoding.unicode.getbytes(cleartext); using (aes encryptor = aes.create()) { rfc2898derivebytes pdb = new rfc2898derivebytes(encryptionkey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); encryptor.key = pdb.getbytes(32); encryptor.iv = pdb.getbytes(16); using (memorystream ms = new memorystream()) { using (cryptostream cs = new cryptostream(ms, encryptor.createencryptor(), cryptostreammode.write)) { cs.write(clearbytes, 0, clearbytes.length); cs.close(); } cleartext = convert.tobase64string(ms.toarray()); } } decrypt(clea

css - Two media queries, same stylesheet, both work on Chrome, only on Firefox -

i have started designing media queries responsive design of page. have written 2 media queries follows: @media screen , (min-device-width : 320px)and (max-device-width : 480px) { #logintable { margin-left: 27%; } .slider-wrapper { margin-left: 23%; margin-top: 5%; width: 52%; } .descriptiontext1 { margin-left: 12%; font-size: 59%; margin-top: 13%; } .header { margin-bottom: 4%; } .descriptiontext2 { margin: 5% 0px 15% 12%; font-size: 61%; } } @media screen , (min-device-width : 768px) , (max-device-width : 1024px) { #logintable { border-color: rgb(204, 24, 24); margin-top:2%; margin-left: 2%; } .slider-wrapper { margin-left: 47%; margin-top: -31%; } .descriptiontext1 {

performance - What would be the best size for a full-width website slider image? -

i have client needs slider full-width, without containers or wrappers. think it's bad practice(you may correct me otherwise), couldn't convince otherwise. i'm concerned image sizes. images lazy-loaded, still. 1 image can take long time download if set large. airbnb quite here: https://www.airbnb.com/rooms/50724?s=jmld what should maximum width of images be?

c# - Entity Framework Relationship Error -

i following error when using entity framework: unable determine principal end of association between types 'xxx.domain.entities.usersettings' , 'xxx.domain.entities.user'. principal end of association must explicitly configured using either relationship fluent api or data annotations. here 2 entity classes: public class user { [key, column("un")] public string username { get; set; } public int level { get; set; } public virtual usersettings usersettings { get; set; } } public class usersettings { [key] public string username { get; set; } public int activerefresh { get; set; } [foreignkey("username")] public virtual user user { get; set; } } i not sure how resolve error. stuck database design can't update fix issue. there way using fluent api these associations working? a user can have usersettings object. relationship desired. it looks need 1 zero-or-one relationship // configure

Add Azure WebJob to mobile service hosted in App Service -

with new azure mobile app services in azure mobile services apparently gains same webjob support websites have had while. following article deploy webjobs using visual studio according section 'enable automatic webjobs deployment web project' should able add web job right click on project. none of these options show mobile service project in vs. i can add webjob project solution manually, not add webjobs-list.json file mobile service project article suggests. does know why add web job context menu doesn't show when right-clicking on mobile service project? or manual steps required configure project , appropriate webjobs-list.json file? update: have manually added webjobs-list.json file main project copying format initial template project , adjusted web job project path in it. deploying mobile service azure web app doesn't pick web job. it should work. created new mobile app, downloaded quickstart, right-clicked web project ( appname-code ), , able

Android Studio gradle takes too long to build -

Image
my android studio project used build faster takes long time build. ideas causing delays? have tried https://stackoverflow.com/a/27171878/391401 no effect. dont have anti virus running interrupt builds. app not big in size (around 5mb ) , used build within few seconds not sure has changed. 10:03:51 gradle build finished in 4 min 0 sec 10:04:03 session 'app': running 10:10:11 gradle build finished in 3 min 29 sec 10:10:12 session 'app': running 10:20:24 gradle build finished in 3 min 42 sec 10:28:18 gradle build finished in 3 min 40 sec 10:28:19 session 'app': running 10:31:14 gradle build finished in 2 min 56 sec 10:31:14 session 'app': running 10:38:37 gradle build finished in 3 min 30 sec 10:42:17 gradle build finished in 3 min 40 sec 10:45:18 gradle build finished in 3 min 1 sec 10:48:49 gradle build finished in 3 min 30 sec 10:53:05 gradle build finished in 3 min 22 sec 10:57:10 gradle build finished in 3 min 19 s

autorun - Can node webkit build in a single windows .exe file -

i have project need run in pen drive, content updated daily, , need automated way generate single file (.exe) downloaded users. i use tool https://github.com/mllrsohn/node-webkit-builder , when build windows, build generate multiple files ( dlls, dat ,exe ). this break automation because content need downloaded (single file). any help? as far know, can't. try making 7zip sfx archive , running own program instead of installer. this needs create temporal files when run (which deleted when program quits) , don't think can remove initial prompt. if you're okay that, might need. edit: can the necessary sfx modules here .

javascript - Mute button for my canvas animation -

i have sound playing in canvas animation @ specified time in animation sequence. the code using is: var snd = new audio("sounds/explosion.mp3"); snd.play(); the sound works perfectly. want include mute button mute sound on page @ 1 time, accessibility reasons. i not sure how go appreciated. an example using javascript audio object muted property both test mute state , set mute. <button id="mute">mute</button> <script> var snd = new audio("sounds/explosion.mp3"); snd.play(); document.getelementbyid('mute').addeventlistener('click', function (evt) { if ( snd.muted ) { snd.muted = false evt.target.innerhtml = 'mute' } else { snd.muted = true evt.target.innerhtml = 'unmute' } }) </script>

html - substring in python 3 given line number and offset -

i'm trying parsing html page htmlparser library in python 3. function htmlparser. getpos () return line number , offset of last tag parsed. for example know "string" want starts in line number 10 offset 5 , ends in line number 30 offset 10 how can substring line 10 offset 5 line 30 offset 10 ? thanks. html = 'this holds entire html code' myparser.feed(html) #now parser works magic start = (10,5) #this returned htmlparser.getpos(), 10 line number , 5 offset of line end = (30,10) #same here #i want (i know invalid python code) substring = html.substring(start,end) #return html code string line 10 offset 5 line 30 offset 10 better explanation: i'm trying substring string. i understand in python 3 it's called slice: string[a:b] if wanted substring 'jonny' form string 'hello jonny smith' this: substring = 'hello jonny smith'[6:11] problem htmlparser.getpos() returns tuple (line number, offset of line) can't do: sub

What happens in Inno Setup when you list the same file twice? -

what happens when setup inno setup .iss file install same file same location twice? inno setup realize doing, , include , install file once, or collect file install multiple times, , overwrite each instance? inno setup smart enough identify identical source file , include once installer. there's legitimate reason having duplicate source files; may want install same file different locations on target system. what inno setup won't identify identical target location (i cannot think of legitimate reason having identical target location). install file twice. installs twice identical location, second installation not happen (with executable files default flags, version match) or barely noticeable (as overwrite identical data file). [files] source: "myprog.exe"; destdir: "{app}" source: "myprog.exe"; destdir: "{app}" source: "requirements.txt"; destdir: "{app}" source: "requirements.txt"; destdir:

php - Make permanent changes to a webpage, through the webpage -

right has been asked before in similar context answer not given.. need know how change contents of "homepage.php" (example) permanently filling out form on webpage itself, know have store data in mysql database how should go doing (which way). know how store , retrieve data particular problem has me baffled. do save single css values database (e.g. blue, green, margin-left, margin-right) or can store whole css block of code variable save in database || body { //content of body } .navbar{ //navbar content here }? || end result need edit page without altering code can see not using cookies. (please not tell me needing server etc know..) i using procedural method of php programming no framework seeking give example. thanks in advance =d! i post comment don't have enough points comment. able utilize jquery webpage? have had exact same thing php/mysql, , using jquery .css() , .html() provides working solution.

c# - The RegularExpression data annotation is not being recongnized by the Validator -

i believe code pretty self-explanatory. why isn't regularexpression attribute being used validator ? license.cs: public class license { [required] [regularexpression("([0-9a-f]{4}\\-){4}[0-9a-f]{4}")] public string code { get; set; } } licensetest.cs [testmethod] public void testvalidationofcodeproperty() { // these tests pass know regex not issue assert.istrue(regex.ismatch("abcd-ef01-2345-6789-ffff", "([0-9a-f]{4}\\-){4}[0-9a-f]{4}")); assert.isfalse(regex.ismatch("abcd-ef01-2345-6789-ff00", "([0-9a-f]{4}\\-){4}[0-9a-f]{4}")); assert.isfalse(regex.ismatch("3331313336323034313135302020202020212121", "([0-9a-f]{4}\\-){4}[0-9a-f]{4}")); // setup validator license lic = new license(); var ctx = new validationcontext(lic); var results = new list<validationresult>(); // passes - tryvalidateobject returns false because required field empty lic.code =

javascript - Using Dalekjs test tool, how to select Option in Dropdown(Select element) when there is no "value" attribute in Option tag? -

lets consider below "select" example "value" attribute, <select onchange="fruitselected();" id=""> <option value=""></option> <option value="apple">apple</option> <option value="mango">mango</option> <option value="banana">banana</option> </select> using dalekjs i'm able select option using below code, .click('#moduletype option[value="apple"]') but, when above example don't have "value" attribute show below, <select onchange="fruitselected();" id="fruitid"> <option></option> <option>apple</option> <option>mango</option> <option>banana</option> </select>; how select option dropdown? i tried using .execute below, .execute(function () { document.getelementbyid("fruitid").selectedindex = "1"

java - getOutputStream() has already been called ,but i just use getOutputStream one time in my SpringMVC code -

the process controller(jump) -> jsp(grid) ->controller(verification code) code controller(jump): /** * jump login in jsp * @return */ @requestmapping("/tologin") public string tologin( ) { log.debug("to sign in!---------------------------------------<userinfocontroller>"); return "sign-in"; } jsp(there no tag "<% ... %>"): <div class="form-group"> <label for="code">验证码</label> <input id="code" type="text" name="code" class="span3 form-control "> <a> <img alt="刷新验证码" src="${pagecontext.request.contextpath }/code"> </a> </div> controller(verification code): outputstream os = resp.getoutputstream(); imageio.wr

epl - End of File detection in ESPER -

i using esper read events csv file. how can make query output when reading csv file finished. for example want output every 30 min or @ end of file select id stream output every 30 min or [ eof reached ] thanks in advance regards the "adapter.start()" finishes when csv file done , code can send eof event engine. declare context ends on eof event , there "output every 30 minutes , when terminated" option.

ios - How do i save an image that was selected by a user with swift? -

in app making, user select photo, appear in imageview. how save image selected in image.xcassets folder, when relaunch app, image still there? here code using... import uikit class viewcontroller: uiviewcontroller, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate { @iboutlet weak var imageview: uiimageview! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func action(sender: anyobject) { if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.camera) { let imagepicker:uiimagepickercontroller = uiimagepickercontroller() imagepicker.delegate = self imagepicker.sourcetype = uiimagepickercontrollersourcetype.camera imagepicker.allowsediting = fa

Error with JQuery DataTables oCol is undefined dialog -

i using jquery datatables populate data in 2 separate tables in same page. however, getting following error: ocol undefined ..in dialog box. please me solve this.this code: <table class="assignment"> <tr> <th>available product license types</th> <th></th> <th>assigned product license types</th> </tr> <tr> <td class="leftcontent"> select: <a href="#" onclick="return aslm.datatables.selectall ($('#availableproductlicensetypetable'));">all</a>, <a href="#" onclick="return aslm.datatables.selectnone($('#availableproductlicensetypetable'));">none</a> <table id="availableproductlicensetypetable" class="display small noshadow"> <thead> <tr> <th>id</th> <th>name</th> <th>view only</th> </tr>

Best C++ macro for creating a new scope -

i have macro #define scope_guard(guard, name, ...) \ for(bool __once = true; __once; /* nothing */) \ for(guard name (__va_args__); __once; __once = false) using this: scope_guard(std::unique_lock, lock, (some_mutex)) do_some(); or scope_guard(std::unique_ptr<char>, buff, (new char[buffer_size])) { *buff.get() = 0; getsomedescription(buff.get(), buffer_size); log(buff.get); } are there similar(better) implementation of macro, optimized multiple compilers correctly. p.s. macro should one, without macro boost_scope_exit_end (can redefine if (...) ) . edit simple scoupe in using codestyle huge. { std::unique_lock lock (some_mutex); do_some(); } but want using this scope_guard(std::unique_lock, lock, (some_mutex)) do_some(); you can awful lot c++ templates , lambda expressions. might worthwhile explore using them. example, instead of using scope_guard macro, this: template <typename g, typename f, typename... a> inl

hive - Equivalent months_between function for HiveQL -

i'm trying use hive calcuate months between 2 dates years , decades apart. in netezza used: months_between(this_month('date_1'),this_month(date_2)) trying translate hive , don't think there existing date function or udf available. has tried stagger existing hive commands accomplish same goal? this has been fixed in latest version of hive (1.2.0) "months_between" available. https://issues.apache.org/jira/browse/hive-9518

javascript - Generate input field using jQuery's append -

issue: attempting append input field modal window, containing value inserted user, existing panel. far user able create new field modal , add it, however, part of edit page, want input added input field. here working code: bootply example . want newly generated field formatted same existing fields because become part of giant form allowing submitted , update operational page. question: have format within append function declare other formatting constraints? or can somehow set attributes within 'cloudcontainer' div input being appended to? also, should using .html function instead of append? performance not concern here. thanks you have append same formatted input tag have generated in beginning , add form value it $("#clickme").click(function(){ $('.cloudcontainer').append('<div class="cloud"><p><b>'+$('#fieldtitle').val()+': </b><input style="display: inline; width: 325px;

java - Bundle 2 standalone jars into 1 -

i have 2 standalone jars (each own manifest.mf). there easy way bundle them single standalone jar? don't want merge 2 jars uber jar instance (because of incompatibilities). my approach write short piece of java code run both jars calling respective 'main-class' in 2 separate threads. , use one-jar bundle both jars + short piece of code (+ one-jar's stuff). doubt that's right approach. what clean way doing this? when tools osgi come handy?

orbeon - Orbean Server side embedding - CSS issues -

Image
we trying use orbeon form runner server-side embedding. the form renders on form runner, in our java web application form not rendered i.e. css issues. all /orbeon/* resources retrieved orbeon application, css not applied properly. suspect because of div added embedded/portlet. in form runner full size image in java web application full size image also, if use wizard view, works in form runner, not work in embedded java web application. sections shown on same screen. when orbeon forms produces whole page, adds orbeon class on body , , pretty css comes orbeon forms "prefixed" .orbeon … . done minimize risk of orbeon forms' css conflicting own css. i can't sure problem, if css doesn't apply when embedding, might need add class="orbeon" on element contains content you're embedding.

python - Enabling cookies with urllib -

i parse website urllib python library. wrote import urllib web source_rep.urlopen(url_rep).read() print source_rep the website returns me message saying should enable cookie. how can python? by using cookiejar , of course! and urllib2 . import cookielib import urllib2 cookiejar= cookielib.lwpcookiejar() opener= urllib2.build_opener( urllib2.httpcookieprocessor(cookiejar) ) opener.urlopen(...) as aside: in experience, site want parse telling enable cookies indicator going unpleasant experience, , you'll asking how enable javascript in urllib2 next (which not answerable, way). if think you'll benefit higher-level approach, should evaluate mechanize , selenium .

properties - Is there a way to override "property" setters and getters in Swift? -

after reading @property/@synthesize equivalent in swift , became curious how functionality objective c retained. say have following in objective c: @interface myclass @property (readwrite) mytype *myvar; @end this can accessed such dot- , smalltalk-based syntaxes: type *newvar1 = myclassinstance.myvar; type *newvar2 = [myclassinstance myvar]; myclassinstance.myvar = newvar1; [myclassinstance setmyvar: newvar2]; and if want add additional functionality getters/setters, can this: @implementation myclass - (mytype *) myvar { // more stuff return self._myvar; } - (void) setmyvar: (mytype *) newvar { self._myvar = newvar; // more stuff } @end (see custom setter @property? ) however, the accepted answer above linked question says swift doesn't differentiate between properties , instance variable. so, have following in swift: class myclass { var myvar: mytype } as far know, way access myvar such: var newvar1 = myclassinstance.myvar; myc

collections - Setting visiblilty of control using LINQ -

i'm working on refactoring code practice linq. reason can't code cooperate. //actioncontrols controlcollection var actioncontrols = flowlayoutpanel1.filtercontrols(c => c button); //todo: optimize foreach(var control in actioncontrols) { control.visible = workingitemdatatable.asenumerable().any(row => "btn" + row.field<string>("name") == control.name); } what trying now. flowlayoutpanel1.filtercontrols(c => c button && c.name == "btntaskinfo"//btntaskinfo visible || workingitemdatatable.asenumerable().any(row => "btn" + row.field<string>("name") == c.name)).cast<button>() but after casting button, can not figure out how set visible = false. advice? you'd still need iterate controls, can this, assuming filtercontrols isn't more alias where: var actioncontrols = flowlayoutpanel1.oftype<button>(); there "tri

firebase - How to parse a json with talend? -

Image
i need parse file extract comes firebase: { "historics" : { "users" : { "anonymous:-jlvsu77kk6lgv-undzt" : { "age" : "25", "browser" : "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:36.0) gecko/20100101 firefox/36.0", "pseudo" : "foo", "startsession" : 1427554673910, "stopsession" : 1427554695420 }, "anonymous:-jtjdu598k6lgv-undgb" : { "age" : "25", "browser" : "mozilla/5.0 (x11; ubuntu; linux x86_64; rv:36.0) gecko/20100101 firefox/36.0", "pseudo" : "bar", "startsession" : 1427554673910, "stopsession" : 1427554695420 } }, "messsages" : { "-jersu826k6lgv-undgr" : { "value" : &

c# - How to add images in a objectlistview -

i extremely confused on how use control properly, attempts create media library , show cover art of movies in detailed view not understanding how associate particular column particular image. advice/tips? i have model object using contains movie details public class moviedetails { public string moviename { get; set; } public string key { get; set; } public string id { get; set; } public string coverarturi { get; set; } public string movieuri { get; set; } public string downloaduri { get; set; } public int itemcount { get; set; } } //setup columns generator.generatecolumns(objectlistview2, typeof(moviedetails), true); //show movies a-z displayallmovies(); public void displayallmovies() { try { objectlistview2.updateobjects(movies); } catch (exception) { throw; } } and how

javascript - Angular + bootstrap-ui, check if current tab is already active -

i hooking function onto tab click call data server. have firing when click specific tab, rid of instance of being on tab , clicking - , call server firing again (not needed). using angular + angular-bootstrap-ui. so tried hook function on tab check if if active seems once ng-click on fired, has been set active. no matter when click it return active. need kind of way check if on tab. here's tried <tabset> {{tabs.active}} <tab heading="tree" > </tab> <tab heading="xml" active="tabs.active" ng-click="checktab(tabs.active)"> </tab> </tabset> and in controller $scope.checktab = function(check){ console.log(check); } and so, no matter what, return true because seems .active set true before click fires. there way around this? thanks! update : fiddle - https://jsfiddle.net/7ognp2nj/2/ i suggest using select instead of ng-click . this: <tab h

html - Height not adjusted when set to float value? -

i wrote html page css is body{ margin: 0 auto; min-width: 992px; background: #f2f2f2; } .container{ margin: 30px auto; padding:5px; width: 992px; height: auto; border: 1px solid #c6c6c6; border-radius: 15px; background: #fff; } .column{ margin:0px 5px 5px 0px; float:left; height: 50px; width: 486px; background: #0094ff; } and body <div class="container"> <div class="column"></div> <div class="column"></div> <div class="column"></div> <div class="column"></div> </div> when run page removing float:left div class .column , height of .container automatically increase when set float value in div class .column height of div class .container don't increase. please can tel me how fix problem? add overflow:hidden; .containar

python - Matplotlib: Making a line graph's datetime x axis labels look like Excel -

Image
i have simple pandas dataframe yearly values plotting line graph: import matplotlib.pyplot plt import pandas pd >>>df b 2010-01-01 9.7 9.0 2011-01-01 8.8 14.2 2012-01-01 8.4 7.6 2013-01-01 9.6 8.4 2014-01-01 8.2 5.5 the expected format x axis use no margins labels: fig = plt.figure(0) ax = fig.add_subplot(1, 1, 1) df.plot(ax = ax) but force values plot in middle of year range, done in excel: i have tried setting x axis margins: ax.margins(xmargin = 1) but can see no difference. if want move dates, try adding line @ end: ax.set_xlim(ax.get_xlim()[0] - 0.5, ax.get_xlim()[1] + 0.5) if need format dates either modify index or make changes in plotted ticks so: (presuming df.index datetime object) ax.set_xticklabels(df.index.to_series().apply(lambda x: x.strftime('%d/%m/%y'))) this format dates excel example. or change index want , call .plot() : df.index = df.index.to_series().apply(lambda x: x.strftime(

cloudera - YARN Application exited with exitCode: -1000 Not able to initialize user directories -

i getting: application application_1427711869990_0001 failed 2 times due container appattempt_1427711869990_0001_000002 exited exitcode: -1000 due to: not able initialize user directories in of configured local directories user kailash .failing attempt.. failing application. i couldn`t find related exit code , associated reason. using hadoop 2.5.0 (cloudera 5.3.2). actually due permission issues on of yarn local directories. started using linuxcontainerexecutor (in non secure mode nonsecure-mode.local-user kailash) , made corresponding changes. due (unknown) reason nodemanager failed clean local directories users, , there still existed directories previous user (in case yarn). so solve this, first had find value of property yarn.nodemanager.local-dirs (with cloudera use search option find property yarn service, otherwise yarn-site.xml in hadoop conf directory), , delate files/directories under usercache node manager nodes. in case, used: rm -rf /yarn/nm/usercache

mysql - Creating a view with multiple tables? -

i trying create view 5 tables having issues when trying join last 2 tables together. here current mysql query: create view s_view select ac.id, a.id account_id, a.name, a.description, a.industry, a.phone_fax, a.phone_office, a.shipping_address_street, a.shipping_address_city, a.shipping_address_state, a.shipping_address_postalcode, a.shipping_address_country, c.id contact_id, c.first_name, c.last_name, c.title, c.department, c.phone_home, c.phone_mobile, c.phone_work, c.primary_address_street, c.primary_address_city, c.primary_address_state, c.primary_address_postalcode, c.primary_address_country, ea.email_address accounts inner join accounts_contacts ac on a.id = ac.account_id inner join contacts c on c.id = ac.contact_id inner join email_addr_bean_rel er on er.bean_id = a.id inner join email_addresses ea on er.email_address_id = ea.id and tables set in following way: accounts (id, first_name, last_name, etc.) contacts (id, name, etc.) ac

c# - How to insert hyperlink into RTFBODY property of Outlook Appointment? -

this have far: richtextbox rtb = new richtextbox(); rtb.rtf = system.text.encoding.utf8.getstring(item.rtfbody); rtb.select(rtb.textlength, 0); rtb.selectedrtf = @"{\rtf1\ansi{\fonttbl\f0\fswiss helvetica;}\f0\pard {\par} {\field{\*\fldinst hyperlink ""http://www.google.com/""}{\fldrslt click here}}"; item.rtfbody = system.text.encoding.utf8.getbytes(rtb.text); the code runs fine, , adds "click heere" text, there no link attached text. think i'm close, don't know rtf formatting. appreciated! you reading rtb.text (plain text), not rtf: item.rtfbody = system.text.encoding.utf8.getbytes(rtb.rtf);

assembly - How do I count the number of characters entered using MIPS? -

i prompt user enter string of 40 characters. how count how many characters user entered? count each character, need store count of digits, uppercase , lowercase letters, spaces, , other characters. how should recognize difference between these types of characters? .text # beginning of code .globl main # beginning of main main: # main procedure li $v0, 4 # print_string service number la $a0, prompt00 # load address of prompt syscall # print prompt li $v0, 8 # read_string service number la $a0, buffer # load address of buffer la $a1, 40 # max length of 40 syscall # read_string li $v0, 4 # print_string service number la $a0, buffer # load address of buffer syscall # print buffer li $v0, 10 # using service 10, terminate syscall # terminate .data # beginning of data area buffer: # container inp

ios - ERROR ITMS-90329 Your package contains with a name that contains leading or trailing whitespace -

when submit app app store msg error appear error itms-90329 package contains name contains leading or trailing whitespace i trying remove spaces name , not solved , resolve error , thanks you need remove spaces targets, delete deriveddata , make clean

r - preparing data for analysis -

i new here , new r , statistic in general. got simple 1million rows of data in csv format. there 4 columns: col1 - location col2 - someone's name col3 - date visit col4 - time of visit when importing r translated data frame , columns character (i use str() find structure of imported data , class() thats why know data.frame. as see none of them numeric, want able aggregation e.g count number of visits person, day, time location or vice versa. do need manipulate data outside r e.g import sql , aggregation there or can in r? i hope can guide me in right direction... many peddie i suggest getting familiar plyr package. install.packages("plyr") it ask choose place download from, choose closest 1 you. load library library(plyr) ok lets have data frame looks this > df name day location 52 jake wed mi 25 sally tue ny 38 sue fri ny 45 sally tue mi 42 sue mon mi 17 sally fri ca 28 jake tue

mysql - Get different min and max values based on column from three joined tables -

i want figure out earliest year , latest year car manufacturer making cars. have following 3 tables. year associated particular model need join 3 tables associate each year make. want select min , max year of each make. make table make_id make_name 1 acura 2 alfa romeo 3 aston martin model table model_id make_id model_name 10 1 integra 11 1 mdx 12 1 legend 13 2 milano 14 2 quadrifoglio 15 3 rapide year table year_id model_id year 100 10 1996 101 11 2001 102 12 1992 103 13 1989 104 14 1974 105 15 2013 i want following result: make_id make_name lowest_model_year highest_model_year 1 acura 1996 2001 2 alfa romeo 1974 1989 3 aston martin

Can't include a class file in functions file PHP -

i have dbconnect.php file uses class called db db operations. have file contains general functions called functions.php. dbconnect file working in everywhere functions.php. problem? try using include_once instead of includes. also, if c+p error receiving.

php - How to "move" the document root up one level to the public directory? -

i copy rewrite code post zend. rewriteengine on rewriterule ^\.htaccess$ - [f] rewritecond %{request_uri} ="" rewriterule ^.*$ /public/index.php [nc,l] rewritecond %{request_uri} !^/public/.*$ rewriterule ^(.*)$ /public/$1 rewritecond %{request_filename} -f rewriterule ^.*$ - [nc,l] rewriterule ^public/.*$ /public/index.php [nc,l] the idea of move document root 1 level public directory without touching or modifying virtual host file . so tested on dummy project on localhost see if works on local machine. but not . still have click on public folder see web content. this directories, .htaccess public/ .htaccess index.php index.php, <?php // show information, defaults info_all phpinfo(); and tested on live server well. rewrite code not move document root 1 level public directory @ all. any ideas have missed? i tested on zend (zend 2) project , not work too. , still have click on public folder see web content. any ideas? edit: content

sublimetext2 - Sublime color syntax for Ruby variables vs keywords -

Image
is there way sublime text 2 display different colors ruby "variables" vs "keywords"? image below example of ruby code default monokai color scheme. hoping having variables (list, x) different color keywords (each, print). currently, they're tied <key>foreground</key> . did try changing variable color, changed |x| . no, there not way default ruby syntax ships sublime. list , each , print , , x scoped source.ruby , meaning don't have specific scope can targeted color scheme. on other hand, end scoped keyword.control.ruby , , do keyword.control.start-block.ruby (in addition base source.ruby scope applies elements), if have rule in color scheme keyword or keyword.control , can colored differently. |x| punctuation.separator.variable.ruby pipes | , , variable.other.block.ruby x , can adjusted per preferences. essentially, item can colored if has distinct scope, , color scheme contains rule scope (or more generalized version

sql - Getting data in an API from a Stored Procedure in javascript -

so title may not helpful.. using microsoft azure call stored procedure mssql.query("exec allinfo ?", [meetingid], { success: function(results1) { console.log(results1); var endoutput2 = request.body.meetingname; response.send(statuscodes.ok, endoutput2 ); }, error: function(err) { console.log("error is: " + err); response.send(statuscodes.ok, { message : err }); } }); i know line var endoutput2 = request.body.meetingname; is not correct. trying result executing stored procedure allinfo. how can data can parse , use later in project. stored procedure below. begin select * scheduleme.main_meeting meetingid = @meetingid; select * scheduleme.date_time meetingid = @meetingid; end i can output this(below) cannot grab meetingname or other variables. [{"meetingid":"899c-64b7-fa94","meetingname":"test 1&q

linq - Force "TOP 100 PERCENT" in EF "sub-query" queryable -

update: mistaken top 100 percent generating better query plan (the plan still better reasonably sized top n , , has parameter sniffing). while still think focused question has merit, not "a useful solution" problem 2 , , might not yours .. i running queries sql server optimizes poorly. statistics appear correct, , sql server chooses 'worse' plan performs seek on millions of records though estimated , actual values same - question not that 1 . in problematic queries of simplified form: select * x join y on .. join z on .. z.q = .. however (and since know cardinalities better, apparently) following form consistently results in much better query plan: select * x join ( -- result set here 'quite small' select top 100 percent * y on .. join z on .. z.q = ..) t on .. in l2s take function can used limit top n , "problem" have approach requires finite/fixed n such query hypothetically break, instead of running slow forced

mysql - Save dropdown list value to php session -

i have created drop down list populated data mysql db, im trying save selected value in session variable im not sure how write (where *** are)? , need posted server side eve though in php? <?php $servername1 = "localhost"; $username1 = "root"; $password1 = ""; $dbname1 = "gpdb1"; $conn1 = new mysqli($servername1, $username1, $password1, $dbname1); if ($conn1->connect_error) { die("connection failed: " . $conn1->connect_error); } $sql2 = "select doctorid, title, surname doctors"; $result2 = $conn1->query($sql2); echo "<select name='doctor' value=''><option>select doctor</option>"; if ($result2->num_rows > 0) { foreach($result2 $row2) {echo "<option value=".$row2['doctorid'].">".$row2['title']." ".$row2['surname']."</option>"; } }echo "</select>"; $_session['

batch file - Cmd window unexpectedly closes -

i have windows bach program im writing log computer time , down time. im kinda new coding, have found how math time, dates here , @ robvanderwoude.com. there found batch file that, using command line: datediff [date1] [date2] to days past when run program shuts-down after information gathered. how program continue working? @echo off %%a in (%date%) set today=%%a ::test information set lastdayran= 03/25/2015 datediff %today% %lastdayran% pause the script closing because aren't using call run datediff.bat. when run script without using call , flow transfers second script , stays there. if use call , script flow returns original script once second script completes. @echo off %%a in (%date%) set today=%%a ::test information set lastdayran= 03/25/2015 call datediff %today% %lastdayran% pause

javascript - Why is my div not resizing in jQuery? -

i'm trying resize div when click on it, yet it's not resizing. can tell me why? css #navigation{ position: absolute; display: block; float: right; margin: 0; top: 0; right: 0; width: 25px; height: 100%; z-index: 1; background-color: green; } js $("#navigation").on("click", function(){ $("#navigation").css("width", "100px"); }) doing way not work either. $("#navigation").on("click", function(){ $("#navigation").width(100); }) html <div id="navigation"> <ul></ul> </div> the console not showing errors. try instead: $('#navigation').click(function () { $(this).css("width", "100px"); });