Posts

Showing posts from February, 2011

c# - WPF Dynamic TabControl SelectionChanged bug? -

i creating simple application using c# , wpf using mvvm pattern. there main window few buttons , contentcontrol containing list of view models, 1 of them being searchviewmodel. buttons flip between view models. the searchviewmodel bound searchview , contains tabcontrol. itemssource property bound list of searchtabviewmodels. in constructor of searchviewmodel, initializing observablecollection of searchtabviewmodels , adding 2 tabs. first tab has "+" header , other normal search tab. tabcontrol's selectionchanged event bound method checks if "+" tab clicked. if is, new tab inserted before "+" tab , tabcontrol's selectedindex property set index of inserted tab. simple setup. the issue i'm having when application first run, can click "+" tab , insert new tab "+" tab dead , nothing happens when click it. selectionchanged event not fire. i've checked , selectedindex set tab before it's not selected tab. fix it, ha

ios - How to shift items in a NSMutableArray -

i have nsmutablearray . checking each item in array 1 1 using loop , remove current item. want next index item 1st index. like array = 1,2,3,4,5,6 array = 3,4,5,6 i remove indexes using loop. how can shift next element removed index position updated (int i=0; i<[m3u8 count]; i++) { nsstring *str=[nsstring stringwithformat: @"http://cp2.comci.com:1000/server/default.stream/%@", [mutarraymp3files objectatindex:i] ]; [audioplayer queue:str]; [mutarraymp3files removeobjectatindex:i]; // here want make array continous one. // let's removed object @ index 0, 1st object should move 0th location, // 2nd should move 1st.... likewise } you cannot modify nsmutablearray while you're in midst of iterating on it. , if shrinking array loop, can't keep incrementing index use or "run off end" eventually. can make copy, , modify that; or, use while loop instead of iterator: ns

php - CakePHP counterCache with contain -

i have following database structure: users id, username, ..., silver_medal_counter, gold_medal_counter, bronze_medal_counter badges id, name, description, points, medal (silver, gold, bronze) userbadges id, user_id, badge_id, created if userbadge added, countercache should update relevant medal_counter field in users table. what have: class userbadge extends appmodel { public $belongsto = array( 'user' => array( 'countercache' => array( 'silver_medal_counter' => array('userbadge.badge.medal' => 'silver'), 'gold_medal_counter' => array('userbadge.badge.medal' => 'gold'), 'bronze_medal_counter' => array('userbadge.badge.medal' => 'bronze') ) ), 'badge' => array('classname' => 'badge') ); } note: $actas = array(&

javascript - How to set up an array of images and loop through them individually -

this simple task more experienced javascript. i'd have array of images , loop through them display each 1 interval of time between each one. store images in array: var anarray = [image1, image2, image] (can put images array put src in in array this? when tried treated each string.) create loop go through each image in array , fadein each image: (var = 0; <= array.length; i++) don't want want fade in images @ once, want 1 @ time. set interval of time: setinterval(functioin() {}, 1000); each image displayed 1 second or many seconds after each other. i know use plugin, i'm trying learn javascript want avoid taking shortcuts(except of course shortcut of asking on here!) thanks var img; for(length) { img[i]=new image(); img[i].src="src"; } //for storing image array var count=0; var timerid = setinterval(function() { //fade in image count++; if(count > length)clearinterval(timerid); }, 1000); better option a

Android:Take pictures to send them with WebService -

i want take number of photos and, when completing , send of them on webservice without keeping them on device. i tried deleting them after sending didn't succeed. what best way this? this image capturing activity. private imageview imgpreview; private button btncapturepicture; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.image_capture); context = getapplicationcontext(); imgpreview = (imageview) findviewbyid(r.id.imgpreview); btncapturepicture = (button) findviewbyid(r.id.btncapturepicture); /** * capture image button click event * */ btncapturepicture.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // capture picture captureimage(); } }); } gpstracker gps; @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // if res

C++ How to create a function writing data in file for multiple use with different names -

i have data in array manipulated in 5 or 6 steps. after each step want program write file manipulated data. working code that: ofstream mirroreddata("mirroreddata.dat", ios::out); (int = 0; < n_values; i++) { mirroreddata << datavector[i] << "\n"; } mirroreddata << endl; mirroreddata.close(); the problem is, don't want write thing multiple times. want create function have call name of file (here: mirroreddata) , n_values , datavector. giving function datavector , n_values no problem, how tell writing data in new file? code fragment not right: void createdataoutputfile(int n_values, double* datavector) { ofstream mirroreddata("mirroreddata.dat", ios::out); (int = 0; < n_values; i++) { mirroreddata << datavector[i] << "\n"; } mirroreddata << endl;

Ansible - how to keep only 3 release -

i have vps sever deploy releases , dir structure have current dir, symlink actual release under releases dir. how can achieve, x ( in case 3) releases stay in releases dir, rest can deleted, spare free hdd , because don't need them more. setup capifony uses. perhaps bit off-topic, give place start: there ansible role in galaxy pointed @ replacing capistrano/capifony. example symfony2 project :-) https://galaxy.ansible.com/list#/roles/732 example usage: https://github.com/sweetlakephp/sweetlakephp/blob/master/ansible/deploy.yml to answer question more specifically: the loop required clean releases folder either shell script or composition of ansible tasks (saving ls output, sorting , removing). make smoother process, decided place logic in ansible module. module used in project_deploy role linked above. if prefer wrote own role, module extracted , placed in ot's own galaxy role: https://galaxy.ansible.com/list#/roles/2266 finally, if you'

xml - Concatenate node values in XSLT -

i need concatenate values of xml based on following: here xml: <?xml version="1.0" encoding="utf-8"?> <root> <parent> <name>father 1</name> <child> <name>f1 - child 1</name> <age>2</age> </child> <child> <name>f1- child 2</name> <age>4</age> </child> </parent> <parent> <name>father 2</name> <child> <name>f2 - child 1</name> <age>2</age> </child> <child> <name>f2 - child 2</name> <age>4</age> </child> </parent> </root> and here xslt: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"

windows - Difference in relative file path: debug mode and release mode of Qt Creator -

Image
qfile file("test.txt"); if (file.open(qiodevice::readonly)) { qdebug()<<"you got me."; } i using: qt 4.8.6 msvc 2010 qt creator 3.1.1 windows 7 (32 bit) from above code, if .pro file has not been changed , corresponding build directory for debug mode : d:\...\build-main-msvc2010-debug and .exe of debug mode located in d:\...\build-main-msvc2010-debug\debug for release mode : d:\...\build-main-msvc2010-release and .exe of release mode located in d:\...\build-main-msvc2010-release\release [question] if want release program read "test.txt" file, put file in folder d:\...\build-main-msvc2010-release\release which makes sense. but if want debug program read "test.txt" file, have put file in folder d:\...\build-main-msvc2010-debug\ rather than d:\...\build-main-msvc2010-debug\debug i wondering why relative file path worked differently in debug & release mode, has been bothering

php - Error on getting data from a JSON API -

currently i'd data json api url: http://bitsnoop.com/api/trackers.php?hash=3ba918bf6b648bb6bec6aac716f1855451016980&json=1 i have tried following: <?php $query = file_get_contents('http://bitsnoop.com/api/trackers.php?hash=3ba918bf6b648bb6bec6aac716f1855451016980&json=1'); $parsed_json = json_decode($query, true); foreach ($parsed_json $key => $value) { echo $value['announce']; echo "<br>"; } ?> here i'd want value of as: announce, num_seeders, num_leechers, found, updated. but i'm getting error: warning: invalid argument supplied foreach() in c:\xampp\test.php on line 4 you need add user agent headers <?php function get_json($url, $curl = true) { $responsestring = ''; if (!$curl) { $responsestring = file_get_contents($url); } else { $ch = curl_init( $url ); $options = array( curlopt_returntransfer => true, curlopt_

python - Slicing an image array into sub array -

import numpy np import numpy numpy import cv2 pil import image numpy import array img = cv2.imread('image test.jpg') gray = cv2.cvtcolor(img.cv2.color_bgr2gray) myarray = array(gray) slice = myarray[:8,:8] print slice print myarray k = cv2.waitkey(0) if k == 27: cv2.destroyallwindows() this code slicing array of image 8*8 block.i trying convert array 8*8 matrix resulted 3*8 matrix while running above python code. information regarding helpful. import numpy np import cv2 img = cv2.imread('image test.jpg') gray = cv2.cvtcolor(img.cv2.color_bgr2gray) data = np.asarray(gray) data = np.split(data, data.shape[0]/8) res = [] arr in data: res.extend(np.split(arr,arr.shape[1]/8, axis = 1) print res[0] k = cv2.waitkey(0) if k == 27: cv2.destroyallwindows() [[6 6 6 6 5 5 6 6] [7 7 7 6 6 6 7 7] [8 7 7 7 7 8 8 8] [8 7 6 6 7 8 8 8] [7 6 5 6 6 7 7 7] [6 5 5 5 6 6 7 7] [6 5 5 5 6 6 7 8] [6 6 6 6 6 7 8 9]] this output repeated thrice.when print res[

ios - How to let the app know if its running Unit tests in a pure Swift project? -

Image
one annoying thing when running tests in xcode 6.1 entire app has run , launch storyboard , root viewcontroller. in app runs server calls fetches api data. however, don't want app when running tests. with preprocessor macros gone, whats best project aware launched running tests , not ordinary launch? run them cmd+u , on bot. pseudo code be: // appdelegate.swift if runningtests() { return } else { // ordinary api calls } instead of checking if tests running avoid side-effects, run tests without host app itself. go project settings -> select test target -> general -> testing -> host application -> select 'none'. remember include files need run tests, libraries included host app target.

android - Is there a way to fetch my app's latest reviews and stars in google play through api? -

i want fetch app's latest reviews , stars and find google cloud storage's save (buckets begin pubsite_prod_rev) not latest is there way fetch app's latest reviews , stars in google play through api? playstore api returns average score , top reviews. free tier provides 100 calls per month. http://www.playstoreapi.com/docs#app_info

c# - Save formatted plain text into SQL Server? -

i have text file following content hdcnwupc 2014110616414617001509cn dt01u00008 ak ctn head lettuce i need save sql table nvarchar column. distorted content when retreive values. hdcnwupc 2014110616414617001509cn dt01u00008 ak ctn head lettuce this not html content, plain text text file, spacing have significance. need implement in c#. following code reads content text file. var k = system.io.file.readalltext(@location); what might suitable way ? try (add encoding parameter) var k = system.io.file.readalltext(@location,, encoding.ascii); refer here documentation

javascript - Exit full screen using F11 key and Esc key? -

most modern browsers support javascript apis requesting fullscreen mode now. default, user may press f11 view page in fullscreen mode. if, however, developer decides request fullscreen mode himself on javascript event, mode can exited both esc , f11 keys. note if users request fullscreen mode default key (using f11 ), (tested on newest versions of chromium , firefox) not exitable using esc key. it's obvious makes user interfaces little inconsistent. unfortunately, both of these browsers don't seem register eventlisteners on esc once you're in fullscreen, that's choice security-wise. is there way use browser api , still consistent how users can leave fullscreen mode, i.e. can make esc exit browser's f11 fullscreen mode, too?

javascript - Get whole tags including selected tag in jquery -

this question has answer here: get selected element's outer html 26 answers my html content <div class="div1> div1 </div> <div class="div2> div2 </div> my jquery code is $("div").click(function(){ alert($(this).html()); }); this return either "div1" or "div2" based on click. whole tags <div class="div1"> div1 </div> "this" object. there anyway that...? you need outer html of element. can achieve creating temporary clone of element itself. example: $('div').on('click', function() { alert( $('<div>').append( $(this).clone() ).html() ); }); alternatively, can use built-in outerhtml property, example: $('div').on('click', function() { alert( this.outerhtml ); });

android - Refresh ListView from another activity -

i have 2 activities: "a" (my main activity listview) , "b" (is form showed dialog). when start "b" "a", need "a" not finished stay in background. then, when finish "b" need listview in "a" refreshes items. how can do? let me know if wasn't clear. launch b activity startactivityforresult , catch result in onactivityresult . remember use unique code activity b when launched can check if response right one. example intent intent= new intent(this, activityb.class); startactivityforresult(intent, 1000); @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if(requestcode == 100&&resultcode=result_ok) { myadapter.notifydatasetchanged(); } }

C How to get the text after the space -

i have 2 words , separated space . how can use / print second word (the 1 comes after space?) have @ time : if (strncmp(buf,"hi",3) == 0) printf("first word detected"); please have @ strtok() function. as per man page, the strtok() function parses string sequence of tokens. the syntax char *strtok(char *str, const char *delim); where, str denotes mutable string , delim list of characters used delimiter. in case, can use space " " delimiter. hint: second word, need iterate more once. check syntax of doing man page. notes: you need have #include <string.h> header included in code use function. the str [first argument] should not constant or read-only literal. strtok() may need modify input argument. if compiler supports, can use strtok_r() provided compiler extension have reentrant version of strtok() .

mysql - Update Column in a table based on column from another table. -

i want update field in column based on column table. i have tried query gives me error report. update set a.calculatedcolumn = b.calculatedcolumn table1 inner join table2 b on a.commonfield = b.commonfield a.batchno = '110'; can please inspect wrong there , how fix that? thanks. the correct way update table1 join table2 b on a.commonfield = b.commonfield set a.calculatedcolumn = b.calculatedcolumn a.batchno = '110';

python - Iterating on return object -

this question has answer here: return statement in loops 6 answers i trying oop python. need iterating values in objects defined for loop, call function process_test() , loop stops return object. how can make function process_test() create objects , assign values of i on on each loop? class test(object): abc = 0 cde = 0 def process_test(): in xrange(5): # print myobj = test() myobj.abc = #print myobj.abc return myobj.abc myobj = process_test() print myobj output: 0 desired output: 0 1 2 3 4 5 when first return function, no longer in function. need store value in list, return it class test(object): abc = 0 cde = 0 def process_test(): l = [] in xrange(6): # print myobj = test() myobj.abc = #print myobj.abc l.append(myobj.abc) ret

jbilling - unable to generate single invoice for multiple order of single user -

if create 4 orders single user , want create single invoice 4 order. able through api how can billing ui. if run billing process, create invoice billing process run existing user not particular user. musaddique - start 1 of 4 orders belong 1 user, begin with, click on generate invoice button on show order page this create invoice includes selected order only go orders list, select 1 one, each of remaining un-invoiced orders, , click on button apply invoice this action list available invoices customer, may select created 1 , click submit hope helps. vikas

Material Design theme in android -

i learn how apply theme in app. <style name="theme.baseapp" parent="theme.appcompat.light"> <item name="colorprimary">@color/colorprimary</item> <item name="android:colorprimary">@color/colorprimary</item> </style> when use android:colorprimary line. please me. i dont know asking for. set @color/colorprimary in separeate colors.xml file. after assign color <item name="android:colorprimarydark">@color/colorprimary</item> automatically used things in theme notification bar etc example: styles.xml <style name="apptheme" parent="android:theme.material.light"> <item name="android:colorprimary">@color/primary</item> <item name="android:colorprimarydark">@color/primary_dark</item> <item name="android:coloraccent">@color/accent</item> </style&g

cloud - Why Xen needs Domain0(the first host virtual machine that starts when Xen boots up) -

why xen hypervisor needs domain0? why can't communicate hardware through xen, xen os in physical machine, why can't work on xen instead of creating domain0 handle i/o communication , managing rest of vms(domainus). what's point? it's have microsoft office on windows 7 computer, , want have windows 7 vm running on windows 7 computer, , use microsoft office in virtual windows 7. the xen philosophy have minimum functionality possible handle safe execution of multiple vm on system. xen handles cpu , memory management, while leaves out i/o operations dom0 do. facilitates communication between domu (a normal vm) , dom0. thus, xen in sense not operating system. the minimum-functionality "principle" ensures xen not exposed driver-related bugs (which occur frequently) , extremely reliable.

java - JSTL foreach - how to loop from last to first -

this question has answer here: jstl foreach reverse order 5 answers <c:set var="eventslastindex" value="${events.size() - 1}" /> <c:foreach items="${events}" var="event" begin="${eventslastindex}" end="0" step="-1"> ... </c:foreach> this code throws exception: javax.servlet.jsp.jsptagexception: 'step' <= 0 but, how iterate last element? as specified in this question ; you can use sthg this; <c:foreach var="i" begin="0" end="10" step="1" varstatus="loop"> ... ${loop.end - + loop.begin} ... </c:foreach> you must write foreach usual, , while getting value must decremental.

What's the right way to access the data from a JavaScript object? -

this question has answer here: javascript property access: dot notation vs. brackets? 10 answers i have object: var messages = { "msg100": "message 100", "msg101": "message 101", "msg102": "message 102", "msg103": "message 103", } if want msg101 can using of these 2 methods: messages.msg101 // or messages['msg101'] both return same value. so, method better use , why? the first 1 more limited ( btw i'm sure it's dup). var messages = { "1": "message 103" } alert(messages.1) //nope as opposed : var messages = { "1": "message 103" } alert(messages["1"]) //all ok

cmd - Set one variable in another batch file -

i set variable in batch file, if exsists. works localy in sub batch file. how can fix problem? main.bat: set temp="" if exist sub.bat ( call sub.bat rem returns: temp="" in main echo %temp% in main ) else ( set temp="default value" ) sub.bat: set temp="other value" rem returns: temp="other value" in sub echo %temp% in sub output calling main.bat: temp="other value" in sub temp="" in main two issues: your test incorrect. within block statement (a parenthesised series of statements) , entire block parsed , then executed. %var% within block replaced variable's value at time block parsed - before block executed - same thing applies for ... (block) . hence, if (something) else (somethingelse) executed using values of %variables% @ time if encountered. try using call echo %%temp%% display altered value , "delayedexpansion" endless items on frequent

vba - Access form linked to disconnected ADODB.Recordset: save changes -

i trying set form use disconnected adodb.recordset source. issue have changes not saved original access table upon closing form , replying "yes" prompt. missing ? note: please don't tell me method useless, it's poc local table, plan try later more "distant" recordset. dim conn adodb.connection dim rs adodb.recordset private sub form_load() set conn = new adodb.connection conn.open currentproject.connection set rs = new adodb.recordset rs rs.cursorlocation = aduseclient rs.open "select * amspor", conn, adopenstatic, adlockbatchoptimistic set rs.activeconnection = nothing end set me.recordset = rs conn.close end sub private sub form_unload(cancel integer) select case msgbox("save changes ?", vbquestion + vbyesnocancel) case vbno 'do nothing case vbyes conn.open currentproject.connection rs.activeconnection = conn rs.updatebatch

node.js - Connect to MongoDB hosted on AWS ec2 from Elastic Beanstalk -

i'm trying host web app on aws. i'm hosting nodejs app on elastic beanstalk (salable). have created ec2 instance host mongodb. in test, mongodb ec2 instance accepts connection @ port 27017 anywhere. , website works great. the problems want restrict access mongodb ec2 instance allow connections elastic beanstalk app. i changed rule of ec2 instance security group, accept tcp port 27017 connection security group elastic beanstalk app assigned to. this breaks communication mongodb app immediately. i have tried allow traffic beanstalk security group, no luck have got wrong? please help! needed edit /etc/mongod.conf file , set bind_ip = 0.0.0.0 in order make connections externally. also had try different version of mask work. xxx.xxx.0.0/16 worked me, xxx.xxx.0.0/24 , xxx.xxx.0.0/32 didn't. also, recommended use private ip if in same zone (keeps costs down), public otherwise.

c# - How to deal with two successive inserts in the same form (Order-OrderItem) -

i'm simulating process of selling items customers. seller can click on button create new order. order form consists of few fields order , empty grid footer row add order items. table order: orderid creationdate createdby orderitem orderitemid orderitemquantity orderid in case of new order, system should insert new row orders table , retrieve new id created system, items created user in new order form , insert orderitem table each reference orderid. once seller clicks on button create new order, form pops-ups , should able add new items order right away. problem must save order first no items orderid should add items in grid. this doesn't sound best way it, i thought of couple solutions : 1- once seller clicks button, insert order order table , id, , in same way insert items directly database once they're created. problem i'm not sure how distinguish if closed form without saving or saving know whether should delete records or not. 2- thought of cr

Asp.net Windows Authentication not working -

confused windows authentication. i tried in below way. 1) have created 2 pages home.aspx , admin.aspx 2) created virtual directory , placed application in iis. 3) antonymous access false , integrated windows security true. 4) in web.config file haven given code. <authentication mode="windows"/> <authorization> ---------------------- </authorization> 5) created new user under computer management. trying various roles section in tag. but ever entering roles not asking credentials. seems near roles section in tag making problem. please me out tag need add windows authentication. thanks in advance help. you must make sure url not contain dots ! see answer on: windows authentication not working

Stripping blank XML tags from PHP generated XML files? -

i have generated xml file database using php dom functions. save file using dom->save("feed.xml"). the problem i'm facing of rows in database have empty feilds, resulting in type of output - <summary/> as summary field empty. is possible remove these tags without affecting other nodes? reason want remove them xml fed app , don't want take in blank fields inconsistent. does know of way acheive desire? thanks. you use xpath() select empty nodes , delete them: example xml: <root> <test/> <test></test> <test> <name>michi</name> <name/> </test> </root> php: $xml = simplexml_load_string($x); // assume xml in $x // select node @ position in tree has no children , no text // store them in array $results $results = $xml->xpath("//*[not(node())]"); // iterate , delete foreach ($results $r) unset($r[0]); // display new xml ec

Xamarin Android Player Drag and Drop not working? -

i had xamarin android player installed on machine , install apks on through dragging , dropping inside device until have updated today. http://developer.xamarin.com/guides/android/getting_started/installation/android-player/ does have other ideas other dragging , dropping? reverting emulator previous version instead of latest 1 solution had. emulator still new know xamarin hasn't communication channels allow me inform them problem.

c# - Can't send word documents (.doc and .docx) as email attachment from form -

i'm trying send email attachment form myself. works succesfully when add .pdf file attachment. fails when try .doc or .docx file. i've added validation in javascript, accepts every file type need: var validfiletypes = ["doc", "docx", "pdf", "tiff"]; this c# code check form , send email: private bool sendjobmail() { var client = new mailerservicereference.iemailclient(); var succeeded = false; string _recipient = "jobs@company.eu"; string _firstname = firstname.value; string _lastname = lastname.value; string _telnr = phone.value; string _motivation = motivation.value; string _sender = "info@company.eu"; int vacid = int32.parse(vacancyid.value); string vactitle = _vacancies.find(vac => vac.id == vacid).title; string subject = string.format("application {0} {1} {2}", _firstname, _lastname, vactitle);

computing a 8 bit checksum in c++ -

i have following setup trying write custom file header. have fields described follows: // assume these variables initialized. unsigned short x, y, z; unsigned int dl; unsigned int offset; // end assume u_int8_t major_version = 0x31; u_int8_t minor_version = 0x30; u_int_32_t data_offset = (u_int_32_t)offset; u_int16_t size_x = (u_int16_t)x; u_int16_t size_y = (u_int16_t)y; u_int16_t size_z = (u_int16_t)z; u_int_32_t data_size = (u_int_32_t)dl; now, compute 8 bit header checksum fields starting major revision data_size variables. new , simple suffice current needs. i'm not sure trying achieve, strictly answer question, 8-bit checksum computed as sum_of_all_elements %255 simply put, add elements together, , sum % 255 checksum . watch out overflows when doing addition (you can compute partial sums if run trouble). on side note, 8-bit checksum not - won't distinguish cases , won't data recovery; that's why 16-bit checksum preferred.

OpenAM 11: Display exception from authenticating datastore -

we using custom database data store in openam. store authenticates user against our oracle database. now, there many possible causes why authentication might fail. account locked in oracle or password might expired. datastore catches sqlexception, how propagate cause openam ui? i can throw authloginexception authenticate(), on way amlogincontext, gets wrapped , amlogincontext kind of ignores error codes of authloginexceptions anyway. meaning: amlogincontext doesn't read error code exception tries determine error code itself, , puts amautherrorcode.auth_login_failed login state. how ui show cause of login problem? as bernhard says, not recommended. however, data store obtain debug instance (com.sun.identity.shared.debug.debug) , can log exceptions, , appear in [am_install_dir]/openam/debug. edit: can find examples of doing throughout openam source code.

c# - Get all building Elements with quantity and unity - Revit Api -

for export add-in on revit 2014, need building elements in opened project. to elements, using logicalfilter : new logicalorfilter(new elementiselementtypefilter(true),new elementiselementtypefilter(false)); then parse them using filters on category id, using element.category.id.integervalue compare every elements in arrays. i can elements, parameters missing: how many elements of type have? (like n doors). wich unity should use (m2, m3, m, kg, etc) wich materials in element? (i know can element's materialids using getmaterialids() method, seems returns materials, not of them) also, when elements, elements does'nt have name, or meanless name "300x75", not element name (wood door example). supamiu, of depends on you're trying do. logicalorfilter you're using pull in every element - whether "type" element or "instance" element (and others neither, families, materials, etc). to investigate how many doors have, yo

"Like" counter, increment value by click in django -

im trying make simple button increament value 1 in database , show on page. i found on django - how increment integer field user input? doesn't solve problem. my code in views.py: if request.method == 'post': id = request.post.get('slug') vote = request.post.get('voo') glosy = request.post.get('glosy') git = photo.objects.all().filter(pk=id, votes = vote) vote = int(vote)+1 p = photo.objects.get(pk=id) print p.votes3 p.votes3 += 1 print p.votes3 p.save() photo.objects.all().filter(pk=id).update(votes3=10) and code in template: {% extends "photologue/root.html" %} {% load photologue_tags i18n %} {% load comments %} {% block title %}{{ obj.title }}{% endblock %} {% block content %} {% load static %} <script src="{% static 'js/pinol-ajax.js' %}"></script> <script> window.fbasyncinit = function() { fb.init({ appid : '87

vb.net - {A first chance exception of type 'System.NullReferenceException' occurred in calculator.exe} error during declaring variable -

how write code in right way? public class form1 dim y string = lbl_1.text it says: {a first chance exception of type 'system.nullreferenceexception' occurred in calculator.exe} can me guys? this sample code public class form1 dim y string = lbl_1.text private sub btn_diff_click(byval sender system.object, byval e system.eventargs) handles btn_diff.click lbl_1.text = y & "-*" end sub private sub btn_1_click(byval sender system.object, byval e system.eventargs) handles btn_1.click lbl_1.text = y & "1" end sub private sub lbl_1_click(byval sender system.object, byval e system.eventargs) handles lbl_1.click dim y string = lbl_1.text lbl_1.text = y end sub private sub btn_n_click(byval sender system.object, byval e system.eventargs) handles btn_n.click lbl_1.text = "" lbl_1.focus() end sub private sub btn_2_click(byval sender system.object, byval e system.eventargs) handles btn_2.click dim y

javascript - Making an array of object which have an asynchronous constructor -

i want following nodejs. make object array of following, each object has different local variables want when initialize. obj.js var obj = function (_id) { this.id = _id; var that=this; db.getdata(_id,function(collection){ //this method asynchronous collection.toarray(function(err, items) { that.data=items; }); }); } obj.prototype.data = []; module.exports = obj; app.js var arr=[]; arr.push(new obj(24)); arr.push(new obj(41)); arr.push(new obj(24)); arr.push(new obj(42)); //then tasks arr but since arr constructor synchronous may not have data when calculations arr. how handle scenario ? want make sure objects created before doing work them. thanks in advance. guy, @mscdex said correct. firstly, in code, data shared in memory, should use this.data=[] in constructor. secondly, @mscdex said, move method prototype, say obj.prototype.load=function(){ //code here... } then code below: var obj = function(_i

ios - Plist file not creating from webservice in one button clickbut loading on second click -

i'm having viewcontroller has show segue next view controller but each button connected show segue having webservice call , response webservice storing in plist file , accessing in next view my issue:when click on button directly going nextview without loading plist contents first time when i'm go , click on button showing plist contents any appreciated here plist creation code creating after button click if(connection == conn1) { nserror *e = nil; classresponse = [nsjsonserialization jsonobjectwithdata:classdata options:nsjsonreadingmutableleaves error:&e]; nserror *error; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:@"classesarray.plist"]; nslog(@"file path %@ ",path); nsfilemanager *filemanager=[nsfilemanager defaultmana

windows 7 - Is there a registry setting I can change to make the default drag and drop to move not copy -

i have user keeps whining file keeps copying , not moving. after showing them multiple times need still persist on complaining "this needs fixed" there program dont' want download http://www.winmatrix.com/forums/index.php?/topic/34601-dragndrop-editor/ inside said registry setting was hkcr\allfilesystemobject\defaultdropeffect and hkcr*\defaultdropeffect - dword, values 1,2 or 4 however can't find registry setting in windows 7. windows uses concept registry keys present if want differ default behavior. this setting once of cases. key correct, can create it. keep in mind although other keys in allfilesystemobjects reg_sz 1 has dword (also note hkcr hkey_classes_root, saw people mix hkey_current_user). value "always copy" 1 "always move" 2, in case decimal or hexadecimal not make difference same anyways. the change take effect without reboot, can test it.

Check if a Javascript Object has a property name that starts with a specific string -

lets have javascript objects one: addr:housenumber: "7" addr:street: "frauenplan" owner: "knaut, kaufmann" how can check if object has property name starts addr ? i’d imagine along lines of following should possible: if (e.data[addr*].length) { i tried regexp , .match() no avail. you can check against object's keys using array.some returns bool . if(object.keys(obj).some(function(k){ return ~k.indexof("addr") })){ // has addr property } you use array.filter , check it's length. array.some more apt here.

How to call the values of a C# enum in F# -

i'm writing f# code , i'd use enum value defined in c# assembly. instance, in c# assembly i've got code public enum myenum { valuea, valueb, valuec } how call myenum.valuea in f#? when write that, compiler shouts: invalid use of type name and/or object constructor. if necessary use 'new' , apply constructor arguments, e.g. 'new type(args)'. required signature is: myenum() ok... i'm sorry, i've found problem... c# code actually: public enum myenum { @valuea, @valueb, @valuec } i know, it's weird, isn't "my" c# code... to call in f#, have write: myenum.``valuea``

angularjs - Angular Scope variables are not updated in Controller when changed in UI and vice versa -

i have below controller angular.module("test") .controller("anyctrl", ["$scope", "$state","$timeout", anyctrl]); function anyctrl($scope,$state,$timeout) { $scope.jumpoutnotes="test"; } and below view <!-- start of jump out reason window --> <div class="col-md-8"> <div class="panel panel-primary"> <div class="panel-body"> <div class="form-group row"> <label class="col-md-3 control-label" for="jumpoutnotes">notes</label> <div class="col-md-6"> <textarea class="form-control" id="jumpoutnotes" name="jumpoutnotes" type="text" rows="4&q

How do I Mute/UnMute Notifications in Android Wear -

andoid wear allows user mute , unmute notifications on watch. there way app? want include user setting lets them choose whether or not interrupted while using app. cannot find clear way in api docs. the main mute , unmute system setting app not able change programmatically without rooting. said, if purely wanted mute own app on wear continue display notification on mobile device, can choose display notification on mobile / tablet device , not wearables setting setlocalonly true.

javascript - angular, nested repeat breaking directive (packery + dragabilly) -

i having slight issue using dragabilly in angular, problem odd because working until made changes how content using packery loaded in, adding level of nested repeats. when this, packery still runs correctly, seems dragabilly runs on first object. the html looks - <div class="item gs-w" ng-class="widget.size" ng-repeat="widget in contenthere" packery-angular > <!-- nested repeat --> <div ng-repeat="side in widget.sides" ng-show="side.active"> so it's nested repeat packery runs off of outer items, , again, packery element works fine. broke when added in nested repeat - these objects have multiple faces hide side.acive see there, drag handle inside nested repeat , think may problem, or perhaps nested taking bit longer load in , doesn't recognize handle in time? i'm not sure , that's use direction. here directive - http://jsfiddle.net/yq4zwlzs/ . thing added mobile ua check try , turn

c# - combining one observable with latest from another observable -

i'm trying combine 2 observables values share key. i want produce new value whenever first observable produces new value, combined latest value second observable selection depends on latest value first observable. pseudo code example: var obs1 = observable.interval(timespan.fromseconds(1)).select(x => tuple.create(somekeythatvaries, x) var obs2 = observable.interval(timespan.frommilliseconds(1)).select(x => tuple.create(somekeythatvaries, x) x in obs1 let latestfromobs2wherekeymatches = … select tuple.create(x, latestfromobs2wherekeymatches) any suggestions? clearly implemented subcribing second observable , creating dictionary latest values indexable key. i'm looking different approach.. usage scenario: 1 minute price bars computed stream of stock quotes. in case key ticker , dictionary contains latest ask , bid prices concrete tickers, used in computation. (by way, thank dave , james has been fruitful discussion) (sorry formatting, hard right o

javascript - Spidermonkey: How do I delete the global object -

i can create global objects with js_newcompartmentandglobalobject (sm 1.8.5) or similar function but how delete global object. far know global object rooted , no gc thing. @ end can call js_destroycontext call js_gc must have context. when global object garbage collected? the js_destroycontext call garbage collection reclaim memory used context's global. presumably should set js::rooted jsval_null before destroying context there no stack roots of global when gc runs.

How to run parallel Aggregators in Spring Integration? -

Image
i'd run spring integration flow can scale instances of components if capacity of reached. in particular, wonder how scale aggregators in following scenario: various components right before aggregator layer produce different parts of objects of class x - let's produce parts of 2 such objects x 1 , x 2 - parts called {a 1 , b 1 } , {a 2 , b 2 }, respectively. aggregators should construct x 1 , x 2 parts , send them on. let's assume there's 2 aggregators, a 1 , a 2 . how can set works expected, i.e. x 1 , x 2 created , sent off? i see following considerations: a 1 gets a 1 , a 2 gets b 1 , , x 1 can't constructed without here. we want load balancing, reason multiple aggregators in first place. extra aggregators should added if needed - static configuration of number of aggregators avoided. i wonder if following work me - based on spring integration docs, i'm not sure if got right. set redis message store , parts of x 1 , x 2 stor