Posts

Showing posts from 2011

angularjs - $httpBackend mock responds with more than what I tell it to? -

i have jasmine test 1 of angular services fetches data server , makes publicly accessible. server returns json, array of objects [{...}, {...}, ...] . now tried writing test mocked out http backend: var mocklibrary = [{}, {}]; beforeeach(inject(function(librarysvc) { libsvc = librarysvc; })); it('should fetch library', function(done) { inject(function($httpbackend) { $httpbackend.expectget('/library').respond(200, mocklibrary); libsvc.getlibrary() .then(function(response) { expect(_.isequal(response, mocklibrary)).tobetruthy(); }) .finally(done); $httpbackend.flush(); }); }); the code in service follows: var library; var deferred = $q.defer(); $http.get('/library') .then(function(data) { library = data; deferred.resolve(library); }, function(err) { deferred.reject(err); }); so, service assigns json response body of server in

how does this batch script works? -

i got script site have problems how script works the script @setlocal enableextensions enabledelayedexpansion @echo off title movement color 0a set length= set height=a :controls cls echo use wasd move character ([]). echo. %%a in ( %height% ) echo. echo %length%[] choice /c wasd /n if %errorlevel% equ 1 call:up if %errorlevel% equ 2 call:left if %errorlevel% equ 3 call:down if %errorlevel% equ 4 call:right :left set length=!length:~0,-1! goto controls :right set length=%length% goto controls :up set height=!height:~0,-2! goto controls :down set height=%height% goto controls ok can explain first line? serached web , think give value variables when command reached also dont know means set height=!height:~0,-2! , set length=!length:~0,-1! for enabledelayedexpansion see this blog post . (in short makes variables work in sane fashion.) enableextensions seems safety feature in case command extensions have been disabled (though appear on default). isn't cle

webview - Android - Justify alignment and custom font for Texts in Arabic and Persian languages -

i developing android application , need use justify text alignment , should use custom font texts. application in persian language. if use textview showing texts cant set text alignment justify . if use webview , load html cant use font (i know can set font using html , css not work languages persian , arabic , tested it, on android 4.4.2 see custom font on other versions of android webview show android default font) i tried converting font svg nothings changed. also searched in github custom webview or textview , fount 1 custom textview , both font , text alignment ok direction left right need right left (i tried changing gravity , other things cant fix problem). so suggestion ? thank helping. regards. take @ this forum .i used this library following attrs , works perfectly: ext:documentview_reverse="true" ext:documentview_textalignment="justified" ext:documentview_textformat="formatted"

c# - Console App error An object reference is required for the non-static field, method, or property -

This summary is not available. Please click here to view the post.

ios - In App Purchase - No purchase to restore -

i'm trying figure out if message when user tries restore in app purchase there no purchase ever made. right now, user taps restorebutton , disable restorebutton . - (ibaction)purchaserestore:(id)sender { nslog(@"4 ibaction purchase restore method: start"); [[skpaymentqueue defaultqueue] addtransactionobserver:self]; [[skpaymentqueue defaultqueue]restorecompletedtransactions]; nslog(@"4 purchase restore: skpayment queue 2 lines... log in user"); restorebutton.enabled = no; nslog(@"4 restore button enabled: no"); } so if click restorebutton , , have nothing restore restorebutton stays grayed out. i uialert or change restorebutton text if happens "you don't have items restore", assume need message apple saying "no items restore" can fire off code. here's updatedtransactions code if needed: case skpaymenttransactionstaterestored: [[skpaymentqueue defaultqueue] finish

opencart 1.5.6.4 Can't login fresh install -

i installed opencart 1.5.6.4. install went smooth when try login right user , password refreshes page , and can see token in url. tried google solution went empty hands. i'm asking guys, have idea how can solve issue? please check urls in config file remove www delete .htaccess file make backup of file in case before delete . server should recreate new .htaccess

Java calendar not working correctly -

my task make calendar based on user's input first day. if year eg. 2 = tuesday , year can figure out if leap year. managed working except following case: when input 2013 2(meaning january 1st should tuesday), places first of january on saturday. can check if dates showing correctly going calendar on computer , comparing. have looked through code cannot figure out how 2 entered in start results in dates starting on saturday. where going wrong? package javaapplication6; import java.util.scanner; import javax.swing.joptionpane; public class javaapplication6 { public static void main(string args[]){ scanner input = new scanner(system.in); system.out.println("enter year , day number eg. 2034 2: "); int year = input.nextint(); int day = input.nextint(); day -= 1; boolean leap = year % 4 == 0 && year % 100 != 0 || year % 400 == 0; for(int = 1; <= 12; i++){ string wday = "";

should i create a new db for every new wordpress site i develop? -

hi, let im creating wordpress site, , ofcourse have database, database populated current site, , have migrate site , database host, im develop new wordpress site, should create new database it? or create using available database? im assuming should have new database new website want hear experts point of view. thanks this depends on these sites for. example, create custom wp sites , templates. lots of them. , need show clients how work before installing, have dev server. in particular case, use same db , change $table_prefix = 'wp_'; to else but of course, if you're doing sites have traffic , plan work with, it's way better use different db each site unless host limits you. if ever have move site, won't face dreaded "50 mb db limit", you'll have cleaner , faster db, , many more advantages 0 disadvantages

django - Python - if, elif, elif, else Statement Not Working as Expected -

i'm using django web site , needed build context processor provide referrer (variable named referer ) information. i have simple if, elif, elif, else statement: [ . . . ] host = get_current_site(request) local_url = site_urls['local'] dev_url = site_urls['dev'] prod_url = site_urls['prod'] # print referer debugging purposes - remove when done... print("current host: {0}".format(host)) print("current urls: {0} {1} {2}".format(local_url, dev_url, prod_url)) # determine default referer - eg, set host/site name if host == prod_url: referer = prod_url elif host == dev_url: referer = dev_url elif host == local_url: referer = local_url else: # set referer current request try: referer = request.meta['http_referer'] except keyerror e: print('error: key error - referer doesn\'t exist: {0}'.format(str(e))); [ . . . ] what's weird print statements above yield host bei

java - My Barnsley Fern is Too Skinny -

i'm new java programming, , i've decided pick topic of fractals school essay. however, first step of writing essay requires me recreate barnsley fern using java code. when tried this, barnsley fern looked skinny compared other ones i've seen on web. checked wikipedia make sure numbers , probabilities of affine transformations correct, same, skinny fern produced. can me? dove realm of bufferedimage, hearing that better way of rendering pixels, i'm still unsure of how works. graphics style of painting unreliable or something? code: import java.awt.graphics; import java.awt.color; import java.awt.canvas; public class fern extends canvas{ private static final long serialversionuid = 1l; public static final int iteration = 100000; public fern() { setbackground(color.white); } public void paint(graphics window) { double x = .5; double y = 0; window.setcolor(color.green); window.drawrect(200,600,1,1);

angularjs - ui-router does not run a parent state's resolve promise when using $state.go() -

i have abstract parent state resolve promise returns information current user. information injected controllers of child states. however when use $state.go('parent.child') resolve promise function not being executed. if browse url representing state though, executes fine. do need specify resolve object on each child state , omit parent? a parent state resolve resolve once given set of $stateparams values. if parent state not rely on $stateparams or not use any, dependencies resolved once, regardless of child state changes. the difference in behaviour seeing child state change not result in parent resources being reloaded, whereas location change full parent , child states reloaded. you can observe behaviour in plunk . the example has $stateparams value in parent state on children dependent. changing state via $state.go or ui-sref (both methods provided) result in refresh of parent resource. however, changing state child state without change $statepa

javascript - backbone-stikit binding to disabled element -

i using backbone , stikit model binding, on business cases model sent server may set flag disable html element value bound model attribute the problem if malicious user used console enable element , change value, model updated stikit binding. the question here best practice stop behavior, keeping in mind business use element data should rendered show data

sql server - Variables in T-SQL -

Image
i have 1 column in table, in table there inputs 990x70, 980x50. need values left , right of 'x' calculate inches of these 2 values. code take last registered entry database. how can entries? (note: have use variables in project.) declare @value1 numeric(18,1) declare @value2 numeric(18,1) select @value2 = substring( [values], charindex('x', [values]) + 1, len([values])) , @value1 = substring( [values], 1, charindex('x', [values]) - 1) mytable select @value1=@value1/(2.54) select @value2=@value2/(2.54) select @value1,@value2 mytable edit: there 4 different sizes in table , same result 4 times. want results not 1. now, admittedly, i'm not totally clear on you're asking. sounds should work: select convert(numeric(18,1), substring([values], charindex('x', [values]) + 1, len([values]))) / 2.54, convert(numeric(18,1), substring([values], 1, charin

android - Emulator error - Open HAX device failed -

my android emulator not launching app. emulator launches doesn't launch app. got following bunch of errors while launching emulator. how can solve these issues? failed create context 0x3005 emulator: warning: not initialize opengles emulation, using software renderer. data partition in use. changes not persist! cache partition in use. changes not persist! not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb not wglgetextensionsstringarb hax not working , emulator runs in emulation mode emulator: failed open hax device! failed allocate memory: 1455 emulator: open hax device failed application has requested runtime terminate in unusual way. please contact application's support team more information. my emulator settings: device: 3.7 wvga target: android 4.2.2 (api 17) cpu: intel atom(x86) ram: 512 vm he

angularjs - Rectangular addResponseInterceptor data object undefined while has it in response object -

using restangular, method/promise resolves result handed .then() empty...with console.log(data); showing undefined. checked network tab in chromium debug , xhr request 200 success...there full json response in body. using addresponseinterceptor , have found data argument undefined, response argument shows object containing data property payload/body. so, left scratching head.....why data argument undefined while response object contains json payload/response in response.data? i need resolve result passed .then() on resolve. createnode: function(node) { var account = "9936"; var eventid = "0fd6afd9-4aa0-a5c9-ff0b3e60cdcf"; restangular.addresponseinterceptor(function(data, operation, what, url, response, deferred) { console.log("````````````````"); console.log(data); console.log(operation); console.log(what); console.log(url); console.log(response); console.lo

MySQL PHP Database and String Comparison -

Image
in php comparing file name file on database keeps coming false , unsure why. here code. idea why may happening or how can redo code? edit: in picture have filename @ top array of files outputting db , can see both filename , array index match up. conversion error of sort? $cols = array ("filename"); $audiofiles= $db->get ("audiofiles", null, $cols); $dbfile = ""; echo $filename; if ($db->count > 0) { foreach ($audiofiles $audiofile) { echo "<pre>"; var_dump ($audiofile); echo "</pre>"; if ($audiofile == $filename) { echo "yes"; } else { echo "nope!"; } } } you cannot compare array string try this: if (

sorting - Order a List in f # -

first of im noob in f# sorry if question stupid i have list 1700 strings. of these strings repeated. want create list in each position there list unique string (but if string repeated want both of strings inside list). so example if have list [are; hi; how; you; hi; hi; are; how] i want this [[hi; hi; hi];[how; how];[are;are];[you]] thanks help!!! the msdn documentation page seq.groupby function has sample showing how use function. sample uses sequence input, work lists too: let sequence = [ 1 .. 100 ] let grouped = sequence |> seq.groupby (fun value -> if (value % 2 = 0) 0 else 1) grouped |> printfn "%a" so, need make work scenario change function returns key (here 1 or 0) each value list (in example, key value itself).

calling a function using defined header in C++ -

i relatively new c++. trying call function using defined header. have following 2 files(in addition enter.h file): // 1. main.cpp #include "enter.h" #include<iostream> using namespace std; int main() { int intdemo=enter(); cout << "the result is: " << intdemo<< endl; } // 2. enter.cpp #include <iostream> using namespace std; int enter() { int thisisanumber; cout<<"please enter number: "; cin>>thisisanumber; return thisisanumber; } i getting following error message "void value not ignored ought be". , pointed second line of main function value of variable "intdemo" assigned can suggest how fix error? have searched of similar posts here cannot able understand problem. since beginner, appreciated. your header file declares function enter() return void (this confirmed in comments). changing match function definition solve problem, un

Powershell and path environment variable -

i powershell use environment variable "path" resolve executables. i'm sure should able this, here get. ps c:\> $psversiontable.psversion major minor build revision ----- ----- ----- -------- 4 0 -1 -1 ps c:\> ${env:path} = "c:\windows\system32\" ps c:\> ls ${env:path}\cmd.exe directory: c:\windows\system32 mode lastwritetime length name ---- ------------- ------ ---- -a--- 22/08/2013 8:03 pm 355840 cmd.exe ps c:\> & cmd.exe & : term 'cmd.exe' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ line:1 char:3 + & cmd.exe + ~~~~~~~ + categoryinfo : objectnotfound: (cmd.exe:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception run get-command -type application see powershell seeing valid executabl

Can't figure it out: Have eclipse use single window -

Image
i haven't used eclipse in while, , in opening today somehow set windows float separately. want them docked in same instance/whatever. haven't used magic word google or eclipse figure out how things under same roof, , assume ditzy missing - version 23.0.2.1259578 - adtproduct. have tried going menu bar : window -> reset perspective ? mac : windows : http://youtu.be/1onyf0hcmbw?t=27s hope helps!

vb.net - How to Hash/checksum of string -

so have generator creates 26 hexadecimal character string has balance of ones , zeros when converted binary. 26.5.the first half of 27th characters binary value stored in buf. , last half used make first 106 bits nice , even. or should @ least. how use binary remnants in buf generate 27th char , make last 22 bits hash/checksum first 106? below generator. dim rnd new random() dim bin new stringbuilder() dim buf integer = 0, buflen integer = 0, left integer = 53 integer = 106 0 step -1 buf <<= 1 if rnd.[next](i) < left buf += 1 left -= 1 end if if system.threading.interlocked.increment(buflen) = 4 bin.append("0123456789abcdef"(buf)) buflen = 0 buf = 0 end if next dim b string = bin.tostring() textbox1.text = (b) how add on completing process? you've got 106 0 step -1, means 107 iterations creating 26 hex digits three furth

relational - three tables relations SQL select -

i'm learning sql, appreciated. i have 3 tables: league , player , team league , player many many (as player can in more 1 league) team , player many many (as player can on team in multiple leagues) league , team 1 many. i have following table ids: league.id ----. league_has_player (league_id, player_id) .------ player.id team.id ----. team_has_player (team_id, player_id) .----- player.id league ----. team.id (team.league_id) i want players in league not on team in league. here's broken attempt. select * player p, join team t on t.league_id = l.id join league l on league.id = 2 p.id = league_has_player.player_id , not in (select team_has_player.player_id team_has_player) i think you're trying more this. couple comments have pointed out, table schema isn't clear. impression attempt. decalre @leagueid... select * player player.id in (select player_id league_has_player

Android WebView don't show html document -

i have html document, i've tested on html editor online website ( http://htmledit.squarefree.com ), worked fine. however, webview on android don't show document, show text plain. have little experience html, can me? make sure androidmanifest.xml file includes <uses-permission android:name="android.permission.internet"/> just after the <uses-sdk /> tag. without this, app won't able access internet , therefore webview won't load anything. hth

php - Yii framework : Load css & js in layout defined by controllers? -

my target include difference css (or js )for difference page. , code link css locate @ layout file. my first idea pass variable layout, way pass variable view, found "can not design" yii framework forum . so how putting <link rel="stylesheet" ... > in header (which inside layout file) ? please correct me if concept wrong. you want go actions, , register css file them. example: function actionindex() { $cs = yii::app()->getclientscript(); $cs->registercssfile(yii::app()->getbaseurl() . '/css/mystyle.css'); $cs->registerscriptfile(yii::app()->getbaseurl() . '/js/myscript.js'); // more stuff } you can pass script loader (not css) parameter decide goes, so: // load on document ready $cs->registerscriptfile(yii::app()->getbaseurl() . '/js/myscript.js', cclient::pos_ready); see documentation further help.

javascript - change ckeditor toolbar from attribute in textarea? -

i using ckeditor jquery adapter plugin , im wondering how can simplify process , select different toolbar dynamically attribute within textarea tag. <textarea class="form-control ckeditor" data-toolbar="web"></textarea> <script> $('textarea.ckeditor').ckeditor({ height : '100px', width : '100%', toolbar : $(this).attr('data-toolbar'), allowedcontent : true }); </script> in case have toolbar called "web" , configured in config file , figure nicer code if had control on toolbars using data- attribute. way can have different toolbars on multiple editors on page. any ideas on how can via attribute without having write additional code ? you can set toolbar configuration each editor instance handling instancecreated event. new editor instance passed in event data give access textarea element editor instance attached , allow use value of data-toolbar attribute toolbar conf

java - Calculate C(n, k) combinations for big numbers using modInverse -

i want calculate combinations c(n, k) n , k large. tried using modular inverse following, it's not giving correct output small numbers. can tell me i'm wrong? import java.math.biginteger; public class test { public static int[] factorials = new int[100001]; public static int mod = 1000000007; public static biginteger mod = biginteger.valueof(1000000007); public static void calculatefactorials() { long f = 1; (int = 1; < factorials.length; i++) { f = (f * i) % mod; factorials[i] = (int) f; } } // choose(n, k) = n! / (k! * (n-k)!) public static long nck(int n, int k) { if (n < k) { return 0; } long = biginteger.valueof(k).modinverse(mod).longvalue(); long b = biginteger.valueof(n - k).modinverse(mod).longvalue(); // left right associativity between * , % return factorials[n] * % mod * b % mod; } public static vo

c++ - glDrawElements not drawing anything to screen -

whenever try draw mesh using gldrawelements, program gets no errors, doesn't draw anything. i'm pretty sure issue gldrawelements since if comment gldrawelements out , replace gldrawarrays, works perfectly. so, question is, can me figure out why happening? also glgeterror returns no errors #include "mesh.h" mesh::mesh(glm::vec2* vertices, glm::vec2* texcoords, glushort* elements, int size) { m_size = size; m_vertices = vertices; m_elements = elements; movementvector = glm::vec2(0.0f, 0.0f); glgenvertexarrays(1, &vao); glbindvertexarray(vao); glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); glbufferdata(gl_array_buffer, size * sizeof(float), vertices, gl_dynamic_draw); glenablevertexattribarray(0); glbindbuffer(gl_array_buffer, vbo); glvertexattribpointer(0, 2, gl_float, gl_false, 0, null); glgenbuffers(1, &tex_vbo); glbindbuffer(gl_array_buffer, tex_vbo); glbufferdata(gl_arra

Iterate through XML variable in SQL Server whether what is in XML -

in sql server, how can query following xml <employee> <firstname>david</firstname> <lastname>jons</lastname> <age>28</age> </employee> <employee> <firstname>eric</firstname> <lastname>terry</lastname> <age>36</age> </employee> <employee> <firstname>kady</firstname> <lastname>campell</lastname> <age>21</age> </employee> if element names same, can use approach below: iterate through xml variable in sql server therefore, how following result or that: firstname | lastname | age ----------- +-------------+----- david | jons | 28 eric | terry | 36 kady | campell | 21 given don't know element name of xml such fisrtname, lastname, age, i think hope result sql statement: select * employee in don't know column name of table employee try this: dec

javascript - How to extract common methods into a function -

i want extract common method chains prevent copy paste identical code. how in javascript way ? original if(this.get('with_coverage')){ svg.append("text") .attr("x", (width / 2)) .attr("y", 0 - (margin.top / 2)) .attr("text-anchor", "middle") .style("font-size", "16px") .style("text-decoration", "underline") .text("with coverage"); } else{ svg.append("text") .attr("x", (width / 2)) .attr("y", 0 - (margin.top / 2)) .attr("text-anchor", "middle") .style("font-size", "16px") .style("text-decoration", "underline") .text("without coverage"); } expected var apply_style = attr("x", (width / 2)) .attr("y", 0 - (margin.top / 2)) .attr("text-ancho

spring oauth2 disabled form login -

i use oauth2 in spring. however, form login not available more. urls ,"/j_spring_login" , "/j_spring_login_check" not available. springmvc.xml: <!-- 自动扫描的包名 --> <context:component-scan base-package="com.sdp.hibernate.model.,com.sdp.hibernate.dao.,com.sdp.controller.,com.sdp.jsoncontroller."></context:component-scan> <!-- 默认的注解映射的支持 --> <mvc:annotation-driven /> <!-- 视图解释类 <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/jsp/"/> <property name="suffix" value=".jsp"/> <property name="viewclass" value="org.springframework.web.servlet.view.jstlview" /> </bean> --> <!-- 拦截器 <mvc:interceptors> <bean class="com.sdp.inteceptor.myinteceptor" /> </mvc:interceptors> --> <!-- 对静态资源文件的访问 方案一 (二选一

javascript - querying MongoDb with nodejs -

i have situation here. have ajax call used query value , return. in js file gave this function getlogindata(){ debugger; var getusername=$("#inputusername").val(); $.ajax({ url:'/users/loginvalidation', datatype:'json', data:{"uname":getusername}, type:'post', async:false, success:function(data){ debugger; } }) } in users.js file in routes gave this router.post('/loginvalidation',function(req,res){ var db=req.db; var getname=req.body.uname; db.collection("users").find({"name":getname},{"type":{$in: [ "admin", "owner" ]}}).toarray(function(err,result){ res.json(result); }) }) my requirement want check in users collection containing name in "getname" variable along want check whether name of type "admin" or "owner". if both these condi

python - Error when I try to play a sound -

i trying make alarm clock sort of thing when try , run thing using error: file "c:\python27\salty.py", line 2, in <module> winsound.playsound('siren.wav') typeerror: playsound() takes 2 arguments (1 given) here code running. import winsound winsound.playsound('siren.wav') i know simple fix late. thank help! winsound.playsound takes two parameters: sound , flags . sound may filename, audio data string, or none (from docs), while flags bitwise-or'd combination of winsound.snd_filename (the sound parameter path .wav file), winsound.snd_alias (the sound parameter name builtin windows sound, see docs), winsound.snd_loop (play sound in loop), winsound.snd_memory (the sound parameter memory image of .wav file), winsound.snd_purge (stop playing instances of specified sound, not supported on modern windows ), winsound.snd_async (return immediately, allowing sounds play asynchronously), winsound.snd_nodefault (d

node.js - Trying to install socket.io of npm NodeJS -

i'm trying install socket.io of npm nodejs, , got errors: npm err! fetch failed http://registry.npmjs.org/socket.io/-/socket.io-1.0.6.tgz npm err! fetch failed http://registry.npmjs.org/socket.io-client/-/socket.io-client-1.0.6.tgz npm err! fetch failed http://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.1.tgz npm err! fetch failed http://registry.npmjs.org/nan/-/nan-0.3.2.tgz npm err! fetch failed http://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz npm err! fetch failed http://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz > ws@0.4.31 install /home/admin/domains/{domain}.com/public_html/chat/node_modules/socket.io/node_modules/engine.io/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0) i have centos 5.10. thank you!

ios - view can't recognize gesture -

i got 2 views,view , view b, on same level, , have overlap area. view has tap gesture, in overlap area, view not recognize gesture, it's fine out of overlap area,what make view recognize gesture in overlap area? try [self.view bringsubviewtofront:viewa] in viewdidload.

delphi - Set date on TDateTimePicker On drop down -

i have datetimepicker on delphi 6 form default date of 30/12/1899. want users able click on or open dropdown calendar , select current date. using onclick procedure with: datetimepicker.date := date sets date in editable part date when users click on or calendar dropdown button not force calendar automatically select today's date. result same if use code in datetimepicker's ondropdown procedure. do need use in post manipulate calendar? or there simple property i've missed? thanks matt you can update month calendar window directly via monthcal_setcursel . (i leave "default" logic you): uses commctrl; type tdatetimepickeraccess = class(tdatetimepicker); procedure tform1.datetimepicker1dropdown(sender: tobject); var st: tsystemtime; calendarhandle: hwnd; begin datetimepicker1.date := date; datetimetosystemtime(date, st); calendarhandle := tdatetimepickeraccess(datetimepicker1).getcalendarhandle; monthcal_setcursel(calendarha

notepad++ Open current dir cmd using 64 bit cmd -

when open current dir cmd opens 32 bit cmd. problem because have 64 bit java 8 , javac 8 in program files running java defaults 32 bit java 7 in program files (x86) . without manually opening 64 bit cmd or installing 32 bit java 8 , there way me make , test simple programs way? you can open 64-bit cmd.exe 32-bit application running c:\windows\sysnative\cmd.exe . modify current entry in shortcuts.xml or add 1 specifying full path.

javascript - Visibility of default context menu -

i struck problem. need know whether or not context menu hidden or not. not using kind of plugin context menu. what did fix when right click , open context menu (default) make contextmenuvisible = true while menu open , click anywhere else menu gets hidden, in click click event handler not called. need set contextmenuvisible false . may wrong approach solve issue, if please tell me way achieve this. please help. you can use hidden selector: // matches elements hidden $('element:hidden') you can use in jquery var ishidden = $('#mydiv').is(':hidden'); check value of ishidden checking visibility.

javascript - Logical AND (&&) and OR (||) operators -

logical , ( && ) , or ( || ) operators --- knew trick :) their definition, js (according this explanation), following: expr1 && expr2 => returns expr1 if can converted false; otherwise, returns expr2. thus, when used boolean values, && returns true if both operands true; otherwise, returns false. expr1 || expr2 => returns expr1 if can converted true; otherwise, returns expr2. thus, when used boolean values, || returns true if either operand true; if both false, returns false. testing it, indeed works definition, here's problem: false || "" //returns "" "" || false //returns false so, obviously: (false || "") == ("" || false) // true but, sadly (false || "") === ("" || false) // false to main 2 questions: is bug, or why javascript forcing use == operator or pay attention order when using && , || operators? why javascript

linux - How one can set affinity for kernel threads? -

on linux kernel 3.11.0-13-generic can't set affinity kernel threads in following example: >ps -p 828 pid tty time cmd 828 ? 00:00:00 nfsiod >sudo taskset -pc 7 828 pid 828's current affinity list: 0-11 taskset: failed set pid 828's affinity: invalid argument >sudo taskset -pc 7 17551 pid 17551's current affinity list: 7 pid 17551's new affinity list: 7 > 17551 user process, , nfsiod kernel thread. how can change affinity nfsiod deamon running kernel thread ? many kernel threads set flag pf_no_setaffinity : #define pf_no_setaffinity 0x04000000 /* userland not allowed meddle cpus_allowed */ to change affinity, have change kernel.

sql server - sql how do i convert a time series data to a hoc -

i've sql table of format - company size segment date abc large cap 01-mar-98 abc large cap 01-sep-98 abc mid cap 01-mar-99 abc mid cap 01-sep-99 abc large cap 01-mar-00 i want convert format - end date last date of each period. example, start date 1st 'large cap' period 01-mar-98 , end date period 28-feb-99 . security size segment start date end date abc large cap 01-mar-98 28-feb-99 abc mid cap 1-mar-99 28-feb-00 abc large cap 1-mar-00 null how do in sql server? thank you. try this: create table b (id int identity primary key, [company] varchar(3), [size segment] varchar(9), [date] datetime) ; insert b ([company], [size segment], [date]) values ('abc', 'large cap', '1998-03-01 00:00:00'), ('abc', 'large cap', '1998-09-01 00

delphi - How to maintain "Ignore/handle subsequent exceptions" breakpoints between developers? -

sometimes there pieces of code exceptions occur don't want stop execution in ide (e.g. ole exceptions when setting connection). the trick place 2 breakpoints around this, 1st set "ignore subsequent exceptions" , 2nd "handle subsequent exceptions". this works fine when 1 working on code, breakpoint moves code. however, when several developers update same file , import/export from/to version control (svn in case) breakpoints can end on wrong lines , have reset them. this because these breakpoint settings maintained locally in ide configuration. has ever found way maintain these breakpoints among developers? how? using delphi xe2 w32 apps. these breakpoints stored in dsk file - either of project or of project group, depending on open in ide. may consider adding files version control. however, might have other significant drawbacks.

silverlight - An exception when downloading an image from url to siverlight c# project -

i searched how make gadget windows 7/vista programmatically in c# , @ end downloaded visual studio solution called silverlightgadgetdebugger: the purpose of silverlightgadgetdebugger project act debug session starter silverlight gadget. though console application project, produces no output. instead, whenever project started invoke sidebarsandboxstarter.exe file. application receives current solution path command line parameter. uses information connect visual studio has specified solution opened. sidebarsandboxstarter attach debugger instance of visual studio windows sidebar process (sidebar.exe). if process not started, start it. i added image silverlight control, i'm trying image url : http://lunaf.com/images/moon-phases/lunar_phase_20.jpg i searched how image , tried code : private void downloadimage() { string imagepath = "http://lunaf.com/images/moon-phases/lu

sql server - T-SQL Update Cell Based On Another Cell in Same Column for X Columns -

id | col1 | col2 | colx ------------------------ | 10 | 20 | v b | 15 | 5 | w c | 20 | 10 | x d | 25 | 10 | y e | 30 | 0 | z i value d/col1 (25) become value of cell plus value of b1/col1 (15) become 40 then value d/col2 (10) become value of cell plus value of b/col2 (5) become 15 similarly value d/colx (y) become value of cell plus value of b/col2 (w) become whatever w = y is at end, i'd row b deleted (easy enough) produce like id | col1 | col2 | colx ------------------------ | 10 | 20 | v c | 20 | 10 | x d | 40 | 15 | w+y e | 30 | 0 | z there amount of columns , values, represented letters. got following work single column update) update [table] set [col1]= ( select sum([col1]) [table] [id] in('b','d') ) [id]='d' thanks!

html - scrolling issue on iPad and Android -

i have 2 scrollable divs. 1 vertical scroll , and 1 horizontal scrolling folowing structure: html: <div class="main"> <div class="vscoller"> <div class="nohscroll">some text</div> <div class="hscroller"> <div class="body">some text</div> </div> </div> </div> css: .main { width: 400px; height: 400px; border: solid 1px black; overflow-y: auto; overflow-x: hidden; } .vscoller { height: 5000px; width: 400px; position: relative; } .nohscroll { width: 150px; background-color: green; height: 5000px; } .hscroller { width: 250px; overflow-x: auto; overflow-y: hidden; position: absolute; left: 150px; top: 0; } .body { background-color: gray; height: 5000px; width: 5000px; } fiddle demo on ipad , android can't scroll , down on .body div. can tell me how can correct this? i

database - connecting two hosts oracle linux on virtual box -

i new oracle. have problem when i'm going backup data 1 host other host using rman. i'm using sftp establish connection between 2 hosts on virtual box. first database's hostname oradb1 , second oradb2. use command establish connection [oracle@oradb1 ~]$ sftp oracle@oradb2 connecting oradb2 ssh: oradb2: temporary failure in name resolution couldn't read packet: connection reset peer what should do? or ideas how config it.

excel - How to make text fit to xls column size in java -

i need make text shows nice in xls document. i'm using spring mvc xml view java. there code sample: cellstyle style = workbook.createcellstyle(); hssfsheet sheet = workbook.createsheet("test"); sheet.setdefaultcolumnwidth(20); int worcount = 1; (object s : crimecaselist) { hssfrow nrow = ud.createrow(rowcount++); if(s.getclass().getname().equals("java.util.hashmap")) { map<string, object> map = (hashmap<string,object>)s; nrow.createcell(0).setcellvalue((map.get("rownum")==null)?"": map.get("rownum").tostring()); ..... } } so, have lot of columns , there of text. need make nice. so, when text come end of column needs transfer on new line automaticaly , row should grow according text length. how can it? may autosizecolumn(int) you. api

radio button - Android RadioButton icon disappears when singleline set to true and text gravity set to right -

Image
i found weird situation on android radiobutton, when set singleline true , setgravity right, radio icon disappears. know causes problem , how make shows icon while setting singleline true , gravity right? xml file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <radiobutton android:id="@+id/radio1" android:layout_width="fill_parent" android:layout_height="40dp" android:clickable="false" android:focusable="false" android:focusableintouchmode="false" android:gravity="right|center_vertical" android:background="#ff0000" android:text="hello" android:singleline=&q

c# - Generic extension method, operators -

i make method "transforms" 1 space another. quite simple thing template in c++ in c# i'm not sure interface/type or how need use "where" clause in order compiler understand want. c++ function looked this: template<class t> t transform(t s, t s1, t s2, t d1, t d2) { t result = (s - s1) / (s2 - s1) * (d2 - d1) + d1; return result; } and first stab @ generic c# version (in extension methods), looks this: public static t transform<t>(t s, t s1, t s2, t d1, t d2) { t result = (s - s1) / (s2 - s1) * (d2 - d1) + d1; return result; } alas c# me more specific types, i.e. "error cs0019: operator '-' cannot applied operands of type 't' , 't'". what c# want me do? you cannot directly tell compiler via constraint t implements operator. can tell compiler t implements class. if class overloads operator, can use it. for example, class defines '

javascript - d3.js Zooming in ie10 in metro view on windows 8 tablet -

i have zoom activated on graph , mouse events work fine , touch events work on ipad. however, trying them on ie 10 not work. because ie10 not support touch events , instead supports pointer events? is there way working or need hook hammer.js make life easier , work touch events on ie10 , ipad? cheers mark

Differences between Android and iOS regarding Intents and background operations -

for current project try figure out differences between android , ios. have knowledge in android , absolutely no idea ios. want know is: is there similar intents ios? indicate changes in wifi / bt connection android.bluetooth.device.action.acl_connected or android.net.wifi.state_change? or there method find out connection changes if app not running / in background mode? as understand ios background service (like in android) enable time & https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/managingyourapplicationsflow/managingyourapplicationsflow.html , having background service in ios allowed specific types of apps. app asks sensor values (like accelerator) on regular basis not allowed - correct? i thankful answers , further literature regarding these quesiton! you can use implementation of reachability notifications wifi connectivity, keep in mind these won't wake app. from apple from cocoapods you can us

php - Phalcon: How to get first model in 1-n relation -

i have following models class post extends \phalcon\mvc\model { ... $this->hasmany('id', 'postmedia', 'parent_id'); } class postmedia extends \phalcon\mvc\model { ... $this->belongsto('parent_id', 'post', 'id'); } to related entries following post::find(1)->postmedia; but how first model? following code results in phalcon\mvc\model\resultset\simple object, need postmedia object. post::find(1)->getpostmedia(['limit' => 1]); there getfirst() , getlast() , other useful methods in phalcon\mvc\model\resultset\simple class. there problem in code: post::find(1) returns resultset, not post object, correct code first related object this: $first_media = post::findfirst(1)->postmedia->getfirst();

sorting - Need to sort a list using Wicket -

i working on simple program, looking this: public class wicketapplication extends webapplication implements comparable<object>{ private list<person> persons = arrays.aslist( new person("mikkel", "20-02-91", 60169803), new person("jonas", "02-04-90", 86946512), new person("steffen", "15-07-90", 12684358), new person("rasmus", "08-12-93", 13842652), new person("michael", "10-10-65", 97642851)); /** * @see org.apache.wicket.application#gethomepage() */ @override public class<? extends webpage> gethomepage() { return simpleview.class; } public static wicketapplication get() { return (wicketapplication) application.get(); } /** * @return @see org.apache.wicket.application#init() */ public list<person> getpersons() { return persons; } public list<person> getsortedlist(){ return collections.sort

ruby on rails - I can't fetch any rows from a Polymorphic association -

i've set 2 polymorphic associations on table, have no problem adding table can't seem retrieve added information. here's i'm doing: post belongs_to :posted, polymorphic: true belongs_to :received, polymorphic: true user has_many :posted_posts, class_name: 'post', as: :posted has_many :received_posts, class_name: 'post', as: :received group has_many :posted_posts, class_name: 'post', as: :posted has_many :received_posts, class_name: 'post', as: :received users_controller.rb def post authorize @user @post = post.new(post_params) @post.received = @user @post.posted = @current_user if @post.save respond_to |format| format.html {redirect_to root_url} format.js end else respond_to |format| format.html {redirect_to root_url} format.js end end end post seems fine, should able retrieve information using <% @user.received_po