Posts

Showing posts from September, 2012

c# - Access a list data member in a class -

i have class defined like: public class paths //class point definition { public list<point> points; public color color; public paths(list<point> points, color color) { points = points; color = color; } } in source code make list: list<paths> paths = new list<paths>(); then make list of points: list<point> newpath = null; add stuff it: newpath.add(x, y); now want newpath inserted in paths list along color. how do this? then make list of points: list<point> newpath = null; no, created variable reference list - need create list: list<point> newpath = new list<point>(); then can add point object it. now want newpath inserted in paths list along color. how do this? you need create path well: path path = new path(); path.points = newpath; note following suggestions closer c# conventions: use properties instead of fields p...

javascript - Variable scope in dynamic functions? -

i'm new javascript , wrote following jquery code works: function updateitems() { var = math.round((new date()).gettime() / 1000); $(".something").each(function() { $(this).html(now.tostring()); }); } updateitems(); why work? 1 might think now not accessible inside function. guess run tests see happens if try modify now inside function, if run each() right after that, etc. basic understanding of how scope works here , in javascript cases appreciated. also, type of function accurately called "dynamic function" or there better name it? when use function() { ... } , create technically called closure . can capture enclosing scope. if use now in closure, value of now when execute closure , , (potentially) not value had when created it. note enclosing scope here scope of outer function , not of outer block , , may have take care if you're creating closures in loop, instance.

ios - Lock camera in landscape orientation -

i have app lets user take picture camera. allow user take landscape photos, not portrait. there way me lock camera orientation? below code using: func takephoto() { //if camera available on device, go camera. if not, present error message. if uiimagepickercontroller.issourcetypeavailable(uiimagepickercontrollersourcetype.camera){ //create image picker controller imagepicker = uiimagepickercontroller() imagepicker.delegate = self imagepicker.sourcetype = .camera //present camera view presentviewcontroller(imagepicker, animated: true, completion: nil) } else { let alert = uialertcontroller(title: "error", message: "there no camera available", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: .default, handler: {(alertaction) in alert.dismissviewcontrolleranimated(true, completion: nil)})) self.presentviewcontroller...

javascript - Manipulating Images in Array to fadein and out on hover via Jquery -

i trying reference array of images , everytime user hovers on image in array, image fades in. image fades out when user's mouse leaves image. the code have written below not seem work. please var imagearray=[document.getelementbyid("one"),document.getelementbyid("two"),document.getelementbyid("three")] $.each(imagrarray,function(){ $.hover(function(){ $.fadein("slow");},function(){ $.fadeout(); }); }); html below: <div id="faces" style=" overflow-y:hidden; height:120px; display:inline-block; left: 20px ; position:relative; opacity:0.5" > <div id="base" class="hidden" > <li class=set1" style="display:inline;"> <img id="one" style="float:left" src="attachments/36508133/one.png?api=v2" height="100"width="52" /> <img id="two" style="float:left" src="attachments/36508133/two...

JavaScript - Adding an object into an object -

i realise has been asked before cannot find exact answer question. i'm trying recreate object in javascript. original object looks this: stock { id: 'a0236000374782', product { name: 'gum', price: 2.49 } } when attempt recreate stock object have first value id in , trying somehow push product object in well. here's have attempted: var product = {}; stock.product.name = 'gum'; this returns cannot set property name of undefined. tried: var product = {}; stock = {product.name : 'gum'}; this returns "uncaught syntaxerror: unexpected token ".". cannot figure out not doing right. you can create objects in javascript. assuming have stock defined looking this: var stock = { id: '1234' }; you can assign product follows: stock.product = { name: 'gum', price: 2.49 }; that's same doing this: var product = { name: 'gum', price: 2.49 }; stock.product...

java - I'm having a hard time implementing my linked list class -

my goal make linked list each link char. want take string in argument, take first letter , turn char, , pass rest of string onto next link until whole string stored. have far, although i'm not sure parts of correct or incorrect. looked bunch of examples , seemed default setup. public class linkedchar{ char data; linkedchar head; linkedchar next; //this empty link constructor public linkedchar(){ next = null; } //this constructor takes string public linkedchar(string input){ if(input.length() > 0){ data = input.charat(0); next = new linkedchar(input.substring(1)); } } } this code compiles it's not working other manipulation methods. example, length method. public int length(){ int length = 0; linkedchar curr = head; while(curr != null){ curr = curr.next; length++; } return length; } when used, length returned 0. i'm not sure section of code...

c# - Print a Form at higher dpi than screen resolution -

problem: we need how use winforms' ability auto-scale different dpi’s allow print our forms @ 600dpi, rather @ screen dpi. for what-you-see-is-what-you-get printing, have been taking our nicely laid out window , printing (turning off scrollbars , buttons , such). works great except 1 thing: comes out @ 96dpi or 120dpi (whatever screen resolution)… either of grainy , unprofessional (our customers complaining). , although readable on screen, expect printed documents more readable on-screen… expect able see additional details, able read smaller text, etc. alternatives considered: given have auto-scaling working great, such our window looks in 96dpi, 120dpi, 144 dpi, etc., hoping draw our window @ 600dpi , print that. or, looked @ drawing window off-screen 5-6x larger normal such have same number of pixels 600dpi, @ 96 or 120 dpi… drawing giant window printed page @ 300 or 600 dpi (whatever printer is). if can tell how either of alternatives, or if can give different...

how can i put sidebar menu in right side using yii2 -

iam developing online application using yii2 . want use side bar menu in application. how can create ? have navigation bar menu. want sidebar menu in right side.` navbar::begin([ 'brandlabel' => 'civil department', 'brandurl' => yii::$app->homeurl, 'options' => [ 'class' => 'navbar-inverse navbar-fixed-top', ], ]); echo nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => [ ['label' => 'home', 'url' => ['/site/index']], ['label' => 'about', 'url' => ['/site/about']], ['label' => 'contact', 'url' => ['/site/contact']], ['label' => 'applicationsforms', 'url' => ['/site/index'], 'items' => [ ['label' => 'c...

android - How to Hide view of a button in Adapter? -

Image
i need use same listview & item 2 different fragment modification. here (screenshot), (need use in different fragment) i need show add wishlist & remove in 1st layout & 1st fragment i need hide add wishlist & remove in 2nd layout & 2nd fragment i need use same adapter. how this? update cart_list_item.xml <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:descendantfocusability="blocksdescendants" android:orientation="vertical"> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/cardlist_item" android:layout_width="match...

java - File Not found exception on different Machine -

i trying access file opt/app/db/vat/form_data_30.xls. works fine on machine shows exception on other machine on application installed. here code string filename="opt/app/db/vat/form_dvat_30.xls"; file selectedfile=new file(filename); physically .xls file exist inside opt/app/db/vat directory.and users have permission of read write well. mine runnable jar app.jar stored @ /opt/app/app.jar if use string filename="opt/app/db/vat/form_dvat_30.xls"; relative execution folder. for example if programe executed /home/user/ file should in /home/user/opt/app/db/vat/form_dvat_30.xls if want access /opt/app/db/vat/form_dvat_30.xls use string filename="/opt/app/db/vat/form_dvat_30.xls";

actionscript 3 - Problems with compiling multiple AS3 packages w/ant and mxmlc -

i'm trying extend bigbluebutton client proprietary classes. phone module, added file own code. when write own package name (org.mydomain.module.test ...) within file, compiler fails because can't find class mxml file. when use original package name (org.bigbluebutton.module.phone ...) compiles fine. when use different package name, file not included in compilation. how can change this? this fails: package org.mydomain.module.test { public class mytestclass { // code here } } but works: package org.bigbluebutton.modules.phone.test { public class mytestclass { // code here } } fyi: bigbluebutton uses ant compile client. you didn't put files on disk, package name should match file's path in project. case in both examples? so when package name is: org.mydomain.module.test the class file should saved in path: my_project_path/src/org/mydomain/module/test

android - Get view in GridView by text -

i have simple question, can see in title. there opportunity find element in gridview knowing text of view? there method in view class called: public void findviewswithtext (arraylist<view> outviews, charsequence searched, int flags) see docs here... this want, however, not "tight" because there might several views same text why returns arraylist of views match required text. i suggest using public final view findviewwithtag (object tag) see docs here... and use int tag represents day number.

git - Gitignore update and updating index -

per instructions on github , i've added global gitignore (including config part) visual studio/asp.net development. remote , local repositories in place. how can i: 1) update index such forthcoming updates considers new updates based on global. 2) remove items committed remote repository. keeping them locally, (believe saw guide online remove local files well). i'm guessing accidentally committed local project files (such user preferences), , don't want pull other users' local files copy. 1) can't select updates pull remote. .gitignore file meant commit filter, not fetch filter. however, won't need after correctly execute step 2. 2) add files don't want in remote repository .gitignore , run git rm filename , commit , push change. may want commit new .gitignore file, other users same behavior.

weblogic - how does delivery failure affect JMS message ordering -

i using weblogic 11g question applies jms messaging in general. lets assume have messages in queue in order 5-4-3-2-1 if message#1 fails deliver , there re-delivery delay of 30 secs on jms queue. messages behind 1 delivered during 30 secs or have wait 30 secs on case ? i found answer .. leaving reference future. following article http://middlewaremagic.com/weblogic/?p=6334 lists following in poison messages section - "note messages redelivery delay not prevent other messages being delivered"

String slices/substrings/ranges in Python -

i'm newbie in python , know found curious. let's have this: s = "hello" then: s[1:4] prints "ell" makes sense... , s[3:-1] prints 'l' makes sense too.. but! s[-1:3] same range backwards returns empty string ''... , s[1:10] or s[1:-20] not throwing error @ all.. which.. point of view, should produce error right? typical out-of-bounds error.. :s my conclusion range left right, confirm community if i'm saying or not. thanks! s[-1:3] returns empty string because there nothing in range. requesting range last character, third character, moving right, last character past third character. ranges default left right. there extended slices can reverse step, or change it's size. s[-1:3:-1] give 'o'. last -1 in slice telling slice should move right left. slices won't throw errors if request range isn't in string, return empty string positions.

Running external command on file save in Visual Studio -

i'm reading article on integrating cppcheck vs: http://www.codeproject.com/tips/472065/poor-man-s-visual-studio-cppcheck-integration i want running check upon saving file, covered in article. but, article refers macros ide, which, apparently, taken out of vs2012. there other way it? using mark hall's answer , installed , used visual commander similar. extension, runs first external tool when files in project ("my-project") saved: using envdte; using envdte80; public class e : visualcommanderext.iextension { public void setsite(envdte80.dte2 dte_, microsoft.visualstudio.shell.package package) { dte = dte_; events = dte.events; documentevents = events.documentevents; documentevents.documentsaved += ondocumentsaved; } public void close() { documentevents.documentsaved -= ondocumentsaved; } private void ondocumentsaved(envdte.document doc) { if(doc.path.tolower().c...

c# - Send to remote MSMQ silently fails -

i'm trying send message remote message queue in c#. this path i'm using: formatname:direct=tcp:192.168.0.10\private$\test_in the .send method passed without exception no message appears in remote queue. oddly, can receive same queue without problems. the queue on remote machine non-transactional, code on local machine. has 'full access' 'everyone'. i've read few responses people having similar problems, none of solutions seem apply me. i've checked outgoing queues section on local machine, , show 'connected' remote queue, indicate no messages have been sent. looks hasn't tried. any ideas issue might be? thanks. edit: bit more information - local machine windows 8. remote machine windows server 2012. edit: hugh's answer led me actual cause. needed add permissions anonymous logon remote queue ('everyone' wasn't sufficient). hope helps someone. the fact outgoing queue has been created on sending machi...

django - Only processing specific directories with os.walk() in python script -

i have python script concatenates classpath variable. concatenates directories of files endwith ".properties" extension ".jar" extension. however, ".jar" files ".properties" files repeated in different directories. have decided search through 2 folders. named lib , named properties . i'm using python 2.4 #! /usr/bin/env python import os import sys import glob java_command = "/myapps/java/home/bin/java -classpath " def any(s): v in s: if v: return true return false def run(project_dir, main_class, specific_args): classpath = [] root, dirs, files in os.walk(project_dir): classpath.extend(os.path.join(root, f) f in files if f.endswith('.jar')) if any(f.endswith('.properties') f in files): classpath.append(root) classpath_augment = ':'.join(classpath) args_passed_in = '%s %s %s %s' % (java_command, classpath_augment, ...

javascript - 'fn' is null or not an object in require-jquery.js Line:2813 -

we have wired error not reproduciable rondomly happening. throw error on line/function in jquery: proxy: function( fn, context ) { here code trigger problem. used screen rotation, throw error in settimeout($.proxy(function... : _showpanel: function(index) { // go first panel, index out of range var index = (index > this._panels.length - 1) ? 0 : index, // calculate next panel index nextindex = (index + 1) % this._panels.length, panel = this._panels[index], oldpanelelement = this._currentpanelelement; // set timer when switch next panel this._panelrotationtimeout = **settimeout($.proxy**(function () { if (this && this._showpanel) { this._showpanel(nextindex); } }, this), panel.time); // hide old panel if (oldpanelelement) { oldpanelelement .hide() .detach(); } ...

java - Do Device.getSystemColors() need to be disposed in SWT? -

i understand colors creating using new color() need disposed manually. colors obtained via device.getsystemcolor( swt.color_... ) ? need disposed well? no, must not dispose of these colors.

Is there a lint tool to check the code against the Dart style guide? -

i write code conforms dart style guide. therefore curios, whether there automatic way check coding style dart. do know way this? since dart 1.13 (currently release candidate) can enable lint checks, strong mode , other features adding .analysis_options file dart project (the folder pubspec.yaml file) analyzer: strong-mode: true exclude: - test/data/** language: enablesupermixins: true linter: rules: # see http://dart-lang.github.io/linter/lints/ - always_declare_return_types - always_specify_types - camel_case_types - constant_identifier_names - empty_constructor_bodies - implementation_imports - library_names - library_prefixes - non_constant_identifier_names - one_member_abstracts - package_api_docs - package_prefixed_library_names - slash_for_doc_comments - super_goes_last - type_init_formals # - unnecessary_brace_in_string_interp - unnecessary_getters_setters - package_names ...

ModX getResources startId error -

i'm having trouble getresources call. should start @ top of menu, , display each direct child. here's call: [[!getresources? &parents=`1` &depth=`depth` &limit=`0` &tpl=`home` &tpl_2=`section2` &tpl_3=`section3` &tpl_4=`section4` &tpl_5=`section5` &tpl_6=`section6` &tpl_7=`section7` &includetvs=`1` &processtvs=`1` &includecontent=`1` ]] it displays every resource other first correctly, first resource uses right template pulls wrong resource (resource 6, first child has children. update: appears displaying array of info resource 1 last. still don't know why it's doing @ all. very strange behavior.. might try: &tplfirst= home &depth should integer, unlikely, cause problems check make sure first resource published , not hidden by default believe getresources sorts on menuindex - check indexes [or specify sort order explicitly - can't trust order resources appear in resourc...

In R, how to replace values in multiple columns with a vector of values equal to the same width? -

i trying replace every row's values in 2 columns vector of length 2. easier show you. first here data. set.seed(1234) x<-data.frame(x=sample(c(0:3), 10, replace=t)) x$ab<-0 #column replaced x$cd<-0 #column replaced the data looks this: x ab cd 1 0 0 0 2 2 0 0 3 2 0 0 4 2 0 0 5 3 0 0 6 2 0 0 7 0 0 0 8 0 0 0 9 2 0 0 10 2 0 0 every time x=2 or x=3, want ab=0 , cd=1. my attempt this: x[with(x, which(x==2|x==3)), c(2:3)] <- c(0,1) which not have intended results: x ab cd 1 0 0 0 2 2 0 1 3 2 1 0 4 2 0 1 5 3 1 0 6 2 0 1 7 0 0 0 8 0 0 0 9 2 1 0 10 2 0 1 can me? the reason doesn't work want because r stores matrices , arrays in column-major layout. , when assign shorter array longer array, r cycles through shorter array. example if have x<-rep(0,20) x[1:10]<-c(2,3) then end [1] 2 3 2 3 2 3 2 3 2 3 0 0 0 0 0 0 0 0 0 0 what happening in case sub-array x equal 2...

java - Summing ArrayList values -

ok, far program allows user input, recognizes how many numbers stored in array list , outputs numbers stored. how can sum numbers entered user? import java.util.scanner; import java.util.arraylist; public class lab5 { public static void main (string[]args) { scanner userinput = new scanner(system.in); arraylist<integer> list = new arraylist<>(); //creates initial value nextint variable int nextint = -1; //create loop store user input array list until 0 entered while((nextint = userinput.nextint()) != 0) { list.add(nextint); } //calculate average once 0 inputted if (nextint == 0) { system.out.println("there " + list.size() + " numbers in array list"); system.out.println("the numbers " + list); system.out.println("the sum of number ") } } } you're close! num...

c# 4.0 - MVC Route not being used when it should -

i working on application url user\1\class\create map class controller , create action, when apply it, doesn't pick up. below how have route registered (it @ top of list): routes.maproute( name: "userclass", url: "user/{userid}/class/create", defaults: new { controller = "class", action = "create", userid= "" }, constraints: new { userid= @"\d+" } ); (i have tried omitting userid="" default) this paired code: public class classcontroller : basecontroller { public actionresult create(int userid) { var vm = new classeditorviewmodel { class = new class { userid = userid }, classenrollmentstatuses = new selectlist(db.classenrollmentstatuses.tolist(), "id", "name") }; return view(vm); } } but doesn't work. when use route debugger (by phil haack) does...

c# - DeleteAsync MobileServices Timed out -

i have following code. the c# code on device, windows phone 8: imobileservicetable<subscription> subsciptionstable = app.mobileservice.gettable<subscription>(); subscriptionitemserveritem = await subsciptionstable.where(subs => subs.userid == app.userinfromationid && subs.contentid == holdelement.newmessages).tolistasync();//only want items await subsciptionstable.deleteasync(subscriptionitemserveritem[0]); where send delete request azure mobileservice. here have following script: function del(id, user, request) { var tablea_table = tables.gettable('subscription'); //console.log("about delete subscription:", id); tablea_table.where({ userid: user.userid, id: id}) .read ({ success: deleteitem }); function deleteitem(results) { if(results > 0){ console.log("reached here", id); request.execute(); } } } i using script verify user allowed dele...

c# - EF: mapping class properties to Rows not Columns -

do have idea how map properties of class rows in table? let's have table [id, key, value]. i have predefined key values (on attributes example) mapped properties in class, values taken value column. example: table --------------------------------- | id | key | value | --------------------------------- | 1 | name | jon | --------------------------------- | 2 | surname | doe | --------------------------------- class public class bar { public string name { get; set; } public string suname { get; set; } } is there in ef achieve or have write own custom code? br you can't map values column properties. have key-value table, suggest read table content dictionary. first, should have entity properties correspond table column names: public class foo { public string key { get; set; } public string value { get; set; } } after map entity table, can read table content dictionary: var values =...

wxpython - What does wxMessageBox return in python? -

i'm looking simple wx.messagebox return value example. i've seen basic examples , lot this. far have: dlg = wx.messagebox( 'what choose?, 'test dialog', wx.yes_no | wx.no_default | wx.icon_question ) if dlg == wx.id_yes: print 'you picked yes' dlg seems return 8 no , 2 yes. wx.id_yes = 2503 , wx.id_no = 5104 thanks time. wx.messagebox returns 1 of wx.yes , wx.no , wx.ok , wx.cancel . use wx.yes instead of wx.id_yes , wx.no instead of wx.id_no : >>> import wx >>> wx.yes 2 >>> wx.no 8 see ::wxmessagebox

java - Spring RequestMapping: differentiate PathVariable with different types -

is there way tell spring map request different method type of path variable, if in same place of uri? example, @requestmapping("/path/{foo}") @requestmapping("/path/{id}") if foo supposed string, id int, possible map correctly instead of looking request uri? according spring docs possible use regex path variables, here's example docs: @requestmapping("/spring-web/{symbolicname:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}") public void handle(@pathvariable string version, @pathvariable string extension) { // ... } } (example taken http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-patterns ) judging that, should possible write situation: @requestmapping("/path/{foo:[a-z]+}") @requestmapping("/path/{id:[0-9]+}")

Batch Script - Parameter Nested Inside Variable? -

here's scenario: i have parent script calls dozen child scripts, 1 of complex folder/file syncing operation. each of child scripts writes variable batch file (e.g. variable.bat), loaded parent script @ next execution. the folder syncing script chooses large list of folders based upon parameter passed via parent script. the child script's set command looks this: echo set pair-folder-%1=yes>>c:\variable.bat this produces variable @ next run loaded parent script. herein lies rub: how script action (via if trap) calls variable next time child script comes around? imagine if trap this: if %pair-folder-%1%=yes goto nopair the problem can't seem batch interpret correctly - have tried nesting variable few different ways, using delayed expansion, etc. necessary map parameter local variable first? basically, once parent scripts calls variable.bat @ next execution, how reference newly set variable within child script? since appending set pair-folder-...

Why jquery with ajax run perfectly on localhost but not while run as local file -

while developing image gallery using javascript,jquery & ajax , code not run in loacally(eg:path:"file:///c:/wamp/www/photogallery/index.html") if run in localhost as(path:"localhost/photogallery/") run , got output. my officer said there problem code. because jquery run without using localhost. please me solve problem. please notify mistakes me.. code given below. 1) display images folder (can read images having different names 1.jpg,asd.jpg,ertt.jpg) var dir=album_name; var fileextension=".jpg"; $.ajax({ url: dir, async:false, success: function (data) {// function read image files $(data).find("a:contains(" + fileextension + ")").each(function () { var filename = this.href.replace(window.location.host, "").replace("http:///photogallery",""); data1[j++]=dir+filename; }); } }); 2) count n...

android - How to query file path from mediastore?or how can i query for artist image from mediastore? -

i new mediastore.i making android app,and wanted know how can fetch file path mediastore?or artist image? using mediametadataretriever earlier instead of mediastore,and making own database,it worked fine,but used lag 3 secs,and no 1 wants that. below code irrelevant question have asked,but posting because people in habit here of down voting if no code has been posted... package sourcecode.jazzplayer; import java.io.file; import java.io.filefilter; import java.io.fileoutputstream; import java.io.objectoutputstream; import java.io.serializable; import java.util.arraylist; import com.nostra13.universalimageloader.core.imageloader; import com.nostra13.universalimageloader.core.imageloaderconfiguration; import sourcecode.jazzplayer.r; import android.app.activity; import android.content.context; import android.content.intent; import android.content.pm.activityinfo; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.media.mediametadataretriever; i...

regex - Replace Non-letters except apostrophe in java -

i have few strings contain non-letters. string = "it's. (fish)[]//;!" i want return string says: it's fish i have used string.replace() method it's bit tedious. tried using a.replaceall("\\w", "") but removes apostrophe. there simple way of removing non-letters while keeping apostrophe? you can use java specific construct here: a.replaceall("[\\w&&[^']]", "") the specific construct here character class: x&&[y] , meaning: match x , y . y can valid within character class. available since java 5 if recall correctly.

ruby - Rails: translation file not working -

i have translate majority of application working on dutch. created du.yml file , formatting in same way en.yml file formatted (to sure): en: hello: "hello world" when outputting en.yml application populates text properly. when load du.yml gives me translation not found span wrap around desired translated material. the steps have taken set follows - added application_controller.rb : before_filter :set_locale def set_locale i18n.locale = params[:lang] if params[:lang].present? end this allows me pass param in query-string determine language use. i did shown top , added values translated on both en.yml , du.yml files i call values respective files (for example) <%= t :hello %> . when set english param ( ?lang=en ), works great. however, when put ?lang=du , mentioned before - dreaded span tag of missing translation. any ideas on may have done wrong? thanks! oh yeah..and both files in same directory (config/locales) learned that, although...

javascript - Bootstrap Numeric Slider - wrong value on clicking -

so i'm using eyecon.ro/bootstrap-slider numeric slider in app, it's buggy. on sliding it, no issues in value being returned. when click first time (at point), i'm getting random value. when click again, getting right value. <input type="text" class="span2 spiders" value="" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="55.5" id="<%= 'sld'+details["id"] %>" data-slider-selection="after" data-slider-tooltip="hide"> $(function(){ $("input[id^='sld']").slider({ formater: function(value) { value=math.round(value*10)/10; return 'current value: '+value; } }); }); any way resolve this? also, on here no issue faced. http://jsfiddle.net/vmlpf/1/ this bug caused event firing before input value being modified. bug fixed in followi...

java - Getting Null pointer Exception while String comparision -

i have written simple login module in jsp (a lot of scriplets there :) ). but, continuously getting nullpointer exception error. not able find, tried lot. jsp login code <form action="loginaction.jsp" method="post" name="config-form"> <table align="center"> <tr> <td> username:</td> <td><input type="text" name="username" required parameter=*"></td> </tr> <tr> <td> password:</td> <td><input type="password" name="username" required parameter=*"></td> </tr> <tr><td><input type="submit" value="login"></td></tr> </table> loginaction.jsp <body> <% string username=request.getparameter("username"); string password=request.getparameter("password"); l...

mysql - How to do select encrypt in workbench -

i using workbench mac when trying select encrypt, have no result in field. if copy field obtain tree dots "..." i try same thing query browser , have result. how display in workbench ? select encrypt("mypassword") encrypt() returns binary string. by default, mysql workbench not display binary strings (to avoid accidental misinterpretation); possible display binary string values in output grids: view > edit > preferences > sql editor > treat binary/varbinary nonbinary character string. alternatively, transcode result non-binary string: select convert(encrypt('test') using utf8) or encode in suitable fashion: select hex(encrypt('test'))

How to make ext.net RadioGroup a required field? -

we using ext.net . know how make textbox required field, having trouble force our user make selection on radio group or check box group. know assign default value 1 of radio button, our customer wants leave them unchecked in beginning forces web users make choice, understandable. it appears indicatortext , allowblank properties not effective though listed in intellisense. <ext:radiogroup id="rdgrpgender" runat="server" itemcls="x-check-group-base" fieldlabel="gender" columnswidths="60,60" indicatortext="*" indicatorcls="cssindicator" allowblank="false"> <items> <ext:radio id="rdomale" runat="server" boxlabel="m" /> <ext:radio id="rdofemale" runat="server" boxlabel="f" /> </items> </ext:radiogroup> can expert me out? lot. you can validate thi...

bash - Postgres backup script on Ubuntu + cron -

i try auto backup script running. the script works perfectly, if run typing "bash backup.su" terminal. every query , operation have input password (database user), works fine. but don't use terminal (eg via cron), doesn't. prints out logfile without information. i think has user rights terminal output: making backup directory in /scripts/2013-09-26-daily performing schema-only backups ------------------------------------------ password user backupuser: <- query getting databases string in name following databases matched schema-only backup: performing full backups ------------------------------------------ password user backupuser: <- query getting databases plain backup of db1 password: plain backup of db2 password: plain backup of andsoon password: database backups complete! cron log: making backup directory in /scripts/2013-09-26-daily/ performing schema-only backups ------------------------------------------ following databases matched ...

ios - How to implement navigation between UIViewControllers with forward and back transition in IOS7? -

Image
let's have list of articles want navigate through. ios 6 there 2 simple solutions: using uipageviewcontroller using custom solution uiscrollview, maybe nested one that's pretty straight forward lacks of flexibility regarding custom transitions. uipageviewcontroller have 2 (page curl , scroll), uiscrollview there scroll. the transition effect looking 1 introduced apple ios 7. 1 pushing new controller stack, see screenshot: that comes nice user experience in opinion, works way back, not forward. safari browser supports navigating in both directions, wondering how implemented there and, eventually, how implement list of articles. thanks hints! i looked @ exact same problem , built working demo uses uiviewcontroller containment , subclass of uipangesturerecognizer . supports: gesture-based paging in both directions (tracks touch rather triggers animation on swipe) ability enable/disable wrapping (moving page 0 lastindex , back) ability enable/disa...

c# - System.NullReferenceException creating viewModel -

so, i'm trying find umbraco node (as ipublishedcontent), , pass viewmodel (as Ш've hijacked route). put in controller: private addcouponcodesviewmodel viewmodel; public addcouponcodescontroller(){ //get ipublished content ipublishedcontent content = umbraco.typedcontent(1225); //pass viewmodel viewmodel = new addcouponcodesviewmodel(content); routedata.datatokens["umbraco"] = content; } public actionresult index() { //return view etc } but i'm getting exception details: system.nullreferenceexception: object reference not set instance of object. here: source error(addcouponcodesviewmodel.cs): line 20: line 21: } line 22: public addcouponcodesviewmodel(ipublishedcontent content) line 23: : base(content) line 24: { addcouponcoderendermodel.cs: public class addcouponcodesviewmodel : rendermodel { public string test { get; set; } public list<string> tables { get; se...

javascript - setting attributes of appended HTML to a variable in jquery? -

so, i'm working on backend create/edit/delete page blog - shows list of articles edit , delete button each. when edit button article 'foo' clicked, these things happen: the div expands , raw html of edit form appended inside jquery append(). the dom has array of objects, each object containing information 1 article. specific object id 'foo' fetched , cast array 'bar'. now, i'm trying set values of appended form values within 'bar'. i've tried using .attr(), .val(), nothing seems work. i think problem might i'm doing in same scope. right after .append() call, try access elements appended id. tripping me up? within function, how tried it: $(this).parent().children('#thisone').append("<input id="articletitle">"); $(this).parent().children('#thisone').children('#articletitle').val("my title"); try building complete element before append it: var $inpu...

asp.net - Click Event for ImageButton Inside RadGrid -

i have asp.net imagebutton inside radgrid (in column) when clicked opens popup window. can expand same radgrid reveal nested grid. have button inside here need assign click event such opens same popup. how fire off imagebutton click that's housed inside radgrid? here aspx , "imgedit" need fire off: <mastertableview datakeynames="suggestionid"> <editformsettings captionformatstring="edit suggestion: {0}" captiondatafield="title" insertcaption="add suggestion" editformtype="webusercontrol" popupsettings-width="655px" usercontrolname="~/commonusercontrols/suggestioncontrol.ascx"> </editformsettings> <columns> <telerik:gridtemplatecolumn uniquename="editaction" headerstyle-width="32px" itemstyle-wrap="false" resizable="false"> <itemtemplate> <asp...

c# - Very large XML file generation -

i have requirement generate xml file. easy-peasy in c#. problem (aside slow database query [separate problem]) output file reaches 2gb easily. on top of that, output xml not in format can done in sql. each parent element aggregates elements in children and maintains sequential unique identifier spans file. example: <level1element> <recordidentifier>1</recordidentifier> <aggregateoflevel2children>11</aggregateofl2children> <level2children> <level2element> <recordidentifier>2</recordidentifier> <aggregateoflevel3children>92929</aggregateoflevel3children> <level3children> <level3element> <recordidentifier>3</recordidentifier> <level3data>a</level3data> </level3element> <level3element> <recordidentifier>4...

java - Bring Ball To A Stop -

i have following methods in program keep ball continuously bouncing. have tried modifying can't seem ball stop @ bottom of gui. main goal have methods simulate if bouncing real ball. private void updatedelta() { final int minimummovement = 5; final int maxextra = 10; deltay = minimummovement + (int) (math.random() * maxextra); } public void verticalbounce(container container) { // controls vertical ball motion if (updown) { y += deltay; if (y >= getheight()) { updown = false; updatedelta(); } } else { y += -deltay; if (y <= 0) { updown = true; updatedelta(); } } } update: ball bounces , stops @ bottom of gui. public void verticalbounce(container container) { deltay = deltay - gravity; y = y + deltay; if (y > getheight()) { y = getheigh...

javascript - This scope lost with inheritance -

here example code, 2 files , "classes". crud class defined methods, problem occurs this.modelname, set routes context changes code: the question how, same scope under crud have defined modelname ? server.get('/users/:id', userroutes.find); code: var db = require('../models'); function crud(modelname) { this.modelname = modelname; this.db = db; } crud.prototype = { ping: function (req, res, next) { res.json(200, { works: 1 }); }, list: function (req, res, next) { // fails because modelname undefined console.log(this); db[this.modelname].findall() .success(function (object) { res.json(200, object); }) .fail(function (error) { res.json(500, { msg: error }); }); } }; module.exports = crud; userroutes class: var crud = require('../utils/crud'), util = require('util'); var usermodel = functi...

Profit Calculator in Java -

i trying build program calculate profit made 4 items.this code have far. im not doing calculation part yet, im trying allow user choose items want purchase , how store values. public static void main(string[]args) { int item=0; double price=0; string itemname=""; string yes =""; string no=""; string answer=""; string response; scanner list=new scanner(system.in); system.out.println( "these current items availabe:" ); system.out.println( "item number\t item name" ); system.out.println( "1)\t\t flour\n2)\t\t juice\n3)\t\t crix\n4)\t\t cereal" ); system.out.println("enter item number wish purchase"); item=list.nextint(); if( item == 1 ) { price = 25; itemname = "flour"; system.out.println( "you selected flour" ); } else if( item == 2 ) { price = 15; itemname =...