Posts

Showing posts from July, 2011

javascript - How to show only the first by hover with jQuery? -

if make hover on menulinks submenues on first level shown dont know whats wrong, see code: $('#menu li').hover(function () { //show submenu $('ul', this).slidedown(100); }, function () { //hide submenu $('ul', this).slideup(100); }); so in opinion must work because hover on link should display first submenu. submenu of first link show directly hover , dont know how fix better yet. need please. for better understanging hve created fiddle here . your selector in hover functions finding ul elements descendants of li element. want show direct children. try instead: $('#menu li').hover(function() { //show submenu $(this).children('ul').slidedown(100); }, function() { //hide submenu $(this).children('ul').slideup(100); });

user interface - What was this live filtered table implemented with? -

i browsing http://plugins.netbeans.org/pluginportal/ i way table @ bottom of page works, various live filtering & sort options. particularly speed, fluidity & function. does know how have been implemented (i'm talking specifically, have understanding of generalized process, , interested in specific technology if exists particular type of control in/on particular platform)? your appreciated. looking @ page source looks datatables plug in jquery see here

Add css class to a javascript event -

how can add class following element? window.location = 'page.html'; for example, i'd result: <a href="page.html" class="nameclass">link</a> but javascript page loads automatically after function, not link text click on. create link element: var = document.createelement('a'); // <a></a> add href: a.href = 'page.html'; // <a href="page.html"></a> add class: a.classname = 'nameclass'; // <a href="page.html" class="nameclass"></a> add text: a.innerhtml = 'link'; // <a href="page.html" class="nameclass">link</a> append body element: document.body.appendchild(a); // in page!

php - No connection could be made because the target machine actively refused it LARAVEL 4 error -

no connection made because target machine actively refused it. [tcp://127.0.0.1:6379] in laravel 4.my code is: $redis = redis::connection(); $redis->set('name', 'taylor'); $name = $redis->get('name'); $values = $redis->lrange('names', 5, 10); after installing redis server(you can download form redis ) should run file redis-server.exe located in c:\program files\redis\ , refresh page!

cloud - XTIFY failed on find provider packagename.XTFY_PROVIDER -

i'm following instructions in http://developer.xtify.com/display/sdk/getting+started+with+google+cloud+messaging implement push messages android throught xtify, , executing app error: failed on find provider info com.example.gcmessaging.xtfy_provider in manifest have on receiver tag: .... android:name="com.xtify.sdk.db.provider" android:authorities="com.example.gcmessaging.xtify_provider" android:exported="false" can me wrong? i'd appreciate help. thanks you didn't add correct package name, find defined in top of androidmanifest.xml file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.site.yourapp" ...> then add package name provider node: <provider android:name="com.xtify.sdk.db.provider" android:authorities="com.site.yourapp.xtify_provider" android:exported="false" /> if didn't workout you,

java - how to fix the order of the buttons in SWT? -

i have scroller 2 buttons how can set order of buttons in same raw , not each control : button scroller , button in different row fcomposite= new composite(composite, swt.right_to_left); griddata layoutdata= new griddata(swt.fill, swt.right_to_left, true, false); fcomposite.setlayoutdata(layoutdata); layout= new gridlayout(1, false); layout.marginheight= 0; layout.marginwidth= 0; layout.horizontalspacing= 0; layout.verticalspacing= 0; fcomposite.setlayout(layout); display display = parent.getdisplay(); shell shell = parent.getshell(); button button = new button(fcomposite, swt.left); button.settext("two"); //$non-nls-1$ button.setimage(display.getsystemimage(icon_1)); final scale scale = new scale (fcomposite, swt.border); rectangle clientarea = fcomposite.getclientarea (); scale.setbounds (clientarea.x, clientarea.y, 200, 64); scale.setmaximum (5); scale.setpageincrement (1); scal

C pointer frustration EXC_BAD_ACCESS -

can please tell me what's wrong following code? i'm getting exc_bad_access , not access memory. reason: kern_invalid_address i declare global array of 7 pointers, each points int array, of different sizes. int **pt_all_arrays[7]; in function a() (int = 0; < 7; ++i) { int array_size = function_that_returns_array_size(); int *myarray = (int *)malloc(array_size * sizeof (int)); // work... // store array in big array *(pt_all_arrays[i]) = myarray; <-----exception } the exception thrown on last line. i'm running on mac, gcc -std=gnu99 you want declare int *pt_all_arrays[7]; and assign as pt_all_arrays[i] = myarray; with int **pt_all_arrays[7]; create array of pointer pointer int, not want. and *(pt_all_arrays[i]) = myarray; trying change address of array not valid. example int array[7]; int *pi; array = pi; //this not valid.

iphone - Draggable button in uiwebview -

i trying make draggable button inside uiwebview, when website displayed can move button around screen. can make button move when placed in viewcontroller. need different when wanting on uiwebview? thanks.. if works in regular uiviewcontroller should work. suggest doing using uiviewcontroller , add uiwebview , button subviews. make sure have button in front of uiwebview though.

jquery - How to multithread loading partial views? -

i've got dashboard view loads several independent partial views. each partial view takes around quarter of second load (and yes, optimized), i'd find way multithread loading of these partial views make loading faster. right now, in order render screen quickly, start loading bare-bones view, <div id="mywidget"> section each partial view/widget, in fill in "loading data..." then, in javascript on each partial view, make jquery call load related data. when comes back, replace original mywidget span partial view. i widgets work in parallel. how do it? you try making single ajax call, prepare data widgets. in action method make async calls prepare data in parallel. refer http://www.asp.net/mvc/tutorials/mvc-4/using-asynchronous-methods-in-aspnet-mvc-4#sampleapp then pass data view model, use different partial views render each widgets , return mashup view response. on client side, on success of ajax call, replace entire dashboard/

assembly - Is there a system for realizing digital logic functions without branches? -

i going ask on electric engineering, decided it's more related programming. with digital logic, can reduce truth tables minimized functions using karnaugh diagrams or boolean algebra. on cpu, these functions can of course expressed using conditional statements, however, i'm curious if there's standard approach realizing them without branches , using bit operations, whenever possible. i don't know if ever interesting able nowadays, or if more efficient today's processors. still, might have been relevant in past , interesting know anyhow. so, let's have f = !a*b + !b*!c , or similar function: there system (like karnaugh) finding out whether there's "smart" way avoid branches, using registers, calculating total bits, masking, anything? or, see if see , otherwise don't?

perl - How to get the value of class member? -

there following class: package myclass; use strict; use warnings; sub new { $class = shift(); $self = { _class_member => "default" }; bless ($self, $class); return $self; } how can set/get value of _class_member ? i tried following code: sub set_name { $self = shift(); $self->_class_member = shift(); } but following error: can't locate object method "_class_member" via package "myclass" ... what doing wrong here? $self blessed hash. unless or original author provided method _class_member , there's no such method. you can however, "reach in" hash access it: $self->{'_class_member'} = shift; this not recommended practice instance values because it's easy type: $self->{'_vlass_member'} = shift; without complaint. hence value of accessors .

CSS Border rendering -

i know if possible specify border drawing style (not border-style ) css (i need works @ least on webkit ). well, have element div.border , have four-side border 5px silver solid . depending of class addition, div.border.red-mark , receive border-left: 15px red solid . need rendering style rectangular , not adaptative line width (or angled point). to clarify, take @ this example . , need like that . i can't modify html structure , did on second example; can use only css that. is possible? you use css pseudo-content achieve fake border, this: .red-mark:before { content: ''; display:block; width: 15px; position: absolute; top: -15px; left: -15px; bottom: -15px; background: red; } see: http://jsfiddle.net/mnpka/1/ the minus positions because 0 starts within border. may able change behaviour setting box-sizing though support isn't great yet - http://caniuse.com/#search=box-sizing

type inference - Tuple2 mistakenly inferred as Product in recursive Scala function -

i've got function create combinations list of tuple2[char,int]. however when make recursive call on compile error, tuple inferred product. why , how can compile? here's code samples this compiles ok:- welcome scala version 2.10.1 (openjdk 64-bit server vm, java 1.7.0_17). type in expressions have them evaluated. type :help more information. scala> def combos(a: list[(char,int)]): list[list[(char,int)]] = { | if(a.isempty) list(list()) else { | { | for{ | x <- 0 a.length | (char,num) <- take x | rest = drop x | less <- num 1 -1 | } yield (char,less) :: rest | } tolist | } | } warning: there 1 feature warning(s); re-run -feature details combos: (a: list[(char, int)])list[list[(char, int)]] but recursive 1 fails.. see error @ bottom welcome scala version 2.10.1 (openjdk 64-bit server vm, java 1.7.0_17). type

css - Background Image doesn't show right -

my background image navbar isn't showing properly. if notice, gradient navbar doesn't display properly. top half should light gray , bottom half should darker gray. when page firsts loads can see appear goes gray , loses gradient look. my site usahvacsupply.com , edited background-image bigger fit 1600 width resolution. here picture of background image http://tinypic.com/view.php?pic=20ge8nl&s=5 . appreciated. here css code background. html, body{ margin: auto; background-image:url('/images/testing1/bg2.jpg'); background-repeat: no-repeat; background-position:top center; -moz-background-size:100% 100%; -webkit-background-size:100% 100%; background-size:100% 100%; min-width:1600px; min-height:1400px; top: 0; left: 0; } removing float:left on div id lol seems fix it.

c++ - Why does pkg-config --libs opencv return library locations and not the libraries themselves? -

i trying compile c++ program incorporates opencv. want use pkg-config make compilation easier. not work due fact pkg-config -libs opencv returns library locations , not libraries themselves. got: /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so ... while expecting like -l/usr/local/include/ -lopencv_contrib -lopencv_features2d ... have screwed up? if not, why has happened? , can fixed? the output of pkg-config correct. the gnu linker (ld) (i don't know if others too) allows write libraries full path, without -l or -l, in addition usual -l , -l options. the error must in other place.

c# - Incrementing a pointer inside a fixed block prohibited, it seems it should work -

i error trying increment pointer. cannot assign ptr because fixed variable cs1656 same error other pointer ptruc unsafe void organize_data() { fixed(byte* ptr = &database[0]) { fixed(byte* ptruc = &dtbaseuc[0]) { strcnt=1; linestrts[0]=0; for(int i=0;i<filelen;i++) { if(*ptr > 96 && *ptr < 123)*ptruc=(byte)((int)*ptr-(int)32); if(*ptr ==13) { linestrts[strcnt]=i+1; strcnt++; } ptr++; ptruc++; } } } textbox2.text=strcnt.tostring(); } variables declared in fixed block read-only , cannot assigned to. must instead copy pointer , increment copy. fixed (byte* ptr = &database[0]) { byte* dbptr = ptr; ptr++; // cs1656, ptr read-only. dbptr++; // valid. }

osx - How to discard command+shift+Q command in mac OS X objective c code? -

i'm trying implement screensaver simulator on mac os x , managed disable effect of pressing command+q causing application exit, if it's in full screen mode, not respond quit keyboard shortcut. but, problem in handling shortcut of ( command+ shift+q) pops confirmation dialog of max os x warns exiting apps , logging of system. can me in preventing effect of command+shift+q shortcut while being in full screen mode ? thanks this best answer question first in applicationdidfinishedload function, add peace of code create event tap , add event tap in current run loop cfmachportref eventtap; cgeventmask eventmask; cfrunloopsourceref runloopsource; // create event tap. interested in key presses. eventmask = ((1 << kcgeventkeydown) | (1 << kcgeventkeyup)); eventtap = cgeventtapcreate(kcgsessioneventtap, kcgheadinserteventtap, 0, eventmask, mycgeventcallback, null); if (!eventtap) { fprintf(stderr, "f

Full-width divs behind main content / wrapper.(But with a repeating background) -

first question posed, apologies if not worded correctly or vague. question this: can fullwidth div put in background of wrapper? here i'm trying achieve: (not enough reputation upload image?) basically, full-width gradiented banner behind main content / wrapper. there however, repeating background pattern too. like on rosetta stone example: http://www.rosettastone.co.uk/lp/branduk/?gclid=cntzoopihrccfsxltaodmymaeg&rd=0&cid=se-gguk113f2&s_tnt=59574:1:0 banner image overlaps background yellow. can achieved way i'm going it? i'm using dreamweaver cs6 , css skills basic. thanks in advance help. cheers you should started adding: <div class="banner"></div> <div> //content wrapper </div> css: .banner{ position: absolute; top: 0; z-index: -1; with: 100%; height: 100px; background-image: 'your-image'; background-repeat:repeat-x; //whatever condition need. }

php - Symfony2 - Authentication login..... service -

i had application (running on prod) while. thing new project application need add couple of rest services authenticated users. security handled sf2 (doctrine2 user provider). pretty standard stuff. so been thinking creating new entity token field (randomly created) , user. (since sessions needed persist). , on new controller provide rest responses (json) add token param, adding 1 take user/password , return new token. that's idea, maybe there better way of doing so, more standard or kind of provider. suggestions welcome implement webservice fosrestbundle under dedicated route (ex /api) , secure fosoauthserverbundle .

php - Sign in to wordpress from iPhone app -

i creating iphone app wordpress membership site. in app user faces log in screen enter username , password , these sent via post external php page store on server. what trying check user's credentials in external php page. if user registered on wp database , has entered right credentials, send 'success' response, otherwise nothing. my problem not working. using wp_signon function reason is_wp_error($user_verify) keeps returning 1. here code far, appreciate help. <?php $parse_uri = explode('apple', $_server['script_filename']); //makes page part of wordpress $wp_load = $parse_uri[0].'wp-load.php'; require_once($wp_load); global $wpdb; global $current_user; //####### code responsible secure log in iphone app ############# header('content-type: application/json'); //matches json content type app expecting //sql escape inputs $username = $wpdb->escape($_post['username']); $password = $wpdb->escape($_post['pass

php - issue with searching for string inside the array -

Image
i hour trying understand doing wrong here. no output. the connection ok, array full of data <?php header('content-type: text/html; charset=utf-8'); // here's argument client. $domain = $_get['string']; $quest=$_get['quest']; $event=$_get['event']; $con = mysql_connect('localhost', '******', '********'); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("vocabulary", $con); $sql="select * `0` event_name = '".$event."' , quest_id = '".$quest."'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $key = array_search($domain, $row); echo $key; mysql_close($con); ?> any ideas?? thanks a few things. you selecting table named 0 . don't think should doing that. since doubt table 0 exists, guess have error @ mysql_fecth_array . try putting error_reporting(e_all); @ start of script. ar

Local File Support Detection in JavaScript - Windows Phone 8 Bug -

i have question <input type=file> html element -- specifically, why signs point being supported on windows phone 8 (ie 10 mobile), yet doesn't work. i have been working on photo uploader project, , in javascript development, have logic in place check file api support, know if can support local file selection. surprisingly, code have in place returning true value on windows phone 8. shouldn't issue, <input type=file> element isn't supported wp 8 (as noted on windows blog in article ie 10 mobile ). result on wp 8 if <input type=file> element on page, shows fine, nothing happens when clicking "browse" button. my js code check file api support is: function checklocalfilesupport() { if (window.file && window.filereader && window.filelist && window.blob) { return true; } return false; } i'm hoping shed light on how better check , confirm if local file selection available on specific device/bro

Drupal 6: Want to remove access restrictions on a View -

i have view page display allows returned data linked if user authenticated/logged in. i want remove restriction. there view looks same except it's public , shows same data not linked. (the data pdf files). on authenticated display, next access in basic settings has: authenticated user. if click user role (not gear options), i'm allowed list of: domain none permission role …for access restrictions. click "none", save. but, links not there anon visitor. same if try changing user anonymous user. note: in permissions, anon has right see webfm attachments. i noticed url like: documents-public or documents-auth made documents. no luck. i visited actual custom-page-type puts view in content pane. re-ordered variants, removed selection rules , didn't either. flushed caches. somewhere, view still showing view based on whether user authenticated or not though i've removed access (it says "unrestricted" next access) on both displays , removed

asp.net mvc 3 - Error in a Foreach loop ASP MVC view -

in view code follows need replace "foreach" loop @ line 243 return once shipment date,carrier , tracking number. code returns shipment date,carrier , tracking number each spipment package. if have 3 packages each line returns 3 times same info on each line. want have them displayed once per shipmentpackage. i trying learn asp , mvc working on developed project. please let me know if need more info. @model insite.mvc.models.viewmodels.orderhistorydetailviewmodel @section templatecsscontent { <link href="/styles/template/ma-order-details.css" rel="stylesheet" type="text/css" /> <link href="/styles/print.css" rel="stylesheet" type="text/css" media="print" /> } <div class="midwrapper2"> <div class="contentarea2"> <div class="mavd-wrapper"> @{ html.renderaction("myaccountleftnav", "shared"); } <div clas

What is the most popular C++ gui framework in windows? -

nowadays there many windows applications. several years ago, mfc may popular gui framework create windows applications. think mfc old , doesn't have oo design. here want know there modern, designed , used c++ gui framework in windows? my company use qt framework. adobe photoshop (afaik) , other popular windows programs using it. qt modern, documented , tested. try , enjoy :)

convert date and time format in django -

how convert datefield of format mm/dd/yyyy format dd/mm/yyyy , timefield of format 24hrs 12hr am/pm. this using in below circumstances in database model getting values,so if values getting db '0' date , time format should of (dd/mm/yyyy , 12hr am/pm). if value database field '1',the format of (mm/dd/yyyy , 24hr) models.py class report(models.model): user = models.foreignkey(user, null=false) manual_date = models.datefield('another date', null=true, blank=true) manual_time = models.timefield('another time', null=true, blank=true) class settings(models.model): date_format = models.charfield('date format', max_length=100) time_format = models.charfield('time format', max_length=100) how do. thanks i think better off handling converts @ template level using tag date . example, see pass date , time variables template. pass them unconverted , later in template wherever appear this: {% if conditi

php - active according base on page/file name -

in project have 1 according menu h2 if click menu name h2 open , show subment. default it's 1st (governing body) open..so when click link add gallery it's go page , gallery management open (active) , rest of close. open 1st 1 (governing body) .. how that. idea. jquery or php no problem. make work… please check http://jsfiddle.net/km4w6/ $(document).ready(function(){ //sub menu //set default open/close settings $('.acc_container').hide(); //hide/close containers //$('.acc_trigger:first').addclass('active').next().show(); //add "active" class first trigger, show/open immediate next container //on click $('.acc_trigger').click(function(){ if( $(this).next().is(':hidden') ) { //if immediate next container closed... $('.acc_trigger').removeclass('active').next().slideup(); //remove .acc_trigger classes , slide immediate next container $(this).toggleclass('active').next(

actionscript 3 - SplitViewNavigator Flashing between Transitions -

Image
this little difficult describe please bear me. right now, i've got splitviewnavigator setup small viewnavigator on left menu , larger 1 on right content (i imagine pretty obvious though). when click on 1 of options on left, content on right transitions, should, appropriate view. however, transitions seem involve black box flashes on bottom part of right side viewnavigator before new view pushed onto right side viewnavigator . here picture of mean: i'm little confounded why happening since i've never seen before. example, in "phone friendly" version (which pushes views around instead of using viewnavigator ), never occurs. although doesn't affect functionality, it's ugly , makes app "flashing" anytime changes views more frustrating in light of normal phone interface. here's code i'm using pushing in case relevant (i don't think because learned method adobe): var splitnavigator:splitviewnavigator = navigator.parentn

MS Access display query results on form -

i have simple clients table , made form enter fields. have query called "balances" math , calculates balance on each clients account. want particular client's balance show on form when record open. i tried making text box control source = [balances].[balance] gives me #name? when view form. names correct, i'm not sure if right way go this. it sounds want dlookup() , in case control source of "balance" text box like =dlookup("balance", "balances", "clientid=" & [clientid]) experiment , let know how goes.

java - JSoup Remove Elements -

even though, may sound basic, ask how remove element doc using jsoup. i tried searching it, no success. here problem: elements mynewelements = doc.getelementsbyattribute("hello"); //now need perform other methods on mynewelements before removing. //hence..suggested method says, doc.getelementsbyattribute("hello").remove(); this works fine. believe selecting same elements again , again prove memory hungry. possible ? doc.select(mynewelements).remove(); //try select mynewelements doc. if didn't add new elements match inital select, don't need select elements again. each element in elements has reference parent , remove() method tells parent remove child element. in essence, doing: mynewelements.remove() should work.

delphi - I need my desktop app to access network folder that the current user does not have permission to -

i have windows desktop app (written in delphi) allows users store , retrieve files. the application stores these files in single network shared folder (active directory). the various users of app not have permission see of files, these permissions controlled app. currently have allow every user of app access shared folder, malicious user find directory , gain access of files. is there way app can act specific user such "app user" , not each individual needs permission shared folder? you need either: 1) run app desired user. 2) have code programmably impersonate desired user, via logonuser() , impersonateloggedonuser() , or other similar functions, before accessing shared folder. don't forget stop impersonating when finished using folder.

c# - Where Does Environment.GetEnvironmentVariables() Get Its Information? -

i have tt powershell script running part of c# project. script references environment.getenvironmentvariables() contents of path variable. but data returned includes paths need change, , not match path in windows itself. where method paths , how change them? it uses windows api getenvironmentstrings() data. (the unicode version.) also see documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653%28v=vs.85%29.aspx to set environment variable, can use this overload of environment.setenvironmentvariable() lets specify process, user or machine set.

sql - db2 alter column length named:"Group" -

"group" used column name wity 'char' type. i have increase column length, following error message. alter table "db2.faqa_group" specified attributes column "group" not compatible existing column. alter table <table-name> alter column group set data type char(10) group reserved keyword why getting syntax error. however, can still alter column provided escape column name " " alter table <table-name> alter column "group" set data type char(10)

cocos2d iphone - Accessing Information on other Layers -

i have 2 layers, game , hudlayer. hud on top of helloworldlayer. i've got button press reload hudlayer numbers showing on screen capture what's on gameplay. buttontapped: declared on hudlayer(which goes before helloworldlayer) implementation. hudlayer , helloworldlayer on same file helloworldlayer.m i press button and: - (void)buttontapped:(id)sender { int number = 6; //heres problem //i dont know how change part... [[helloworldlayer]->changednumber = number; ///how give changednumber number's value????? _label.string = [nsstring stringwithformat:@"number: %d",number]; } helloworldlayer has property: @property (assign) int changednumber; sounds sender helloworldlayer. you can try: sender.changednumber = number;

python - Best way to reduce dictionary of lists -

i asking question starting point of pythonic way reduce of list contents in following dictionary using list comprehensions: {'cycle1': [1, 2407, 2393, 14], 'cycle2': [2, 1657, 1652, 5], 'cycle3': [3, 2698, 2673, 25], 'cycle4': [4, 2116, 2102, 14], 'cycle5': [5, 2065, 2048, 17], 'cycle6': [6, 1633, 1615, 18]} each list's columns, though not marked, have these headers: section_num,account_total,billable_count,nonbillable_count i want sum each of last 3 columns, account_total, billable_count, non-billable_count in list comprehension. i'm not sure how sum going through each list member in comprehension. need ask values of each key, each value being list. i'm little unsure how that. how using zip ? individual sum of each column, although i'm not sure want. [sum(x) x in zip(*my_dict.values())[1:]] this outputs: [12576, 12483, 93]

php - Image upload not working in IE? -

please help! i've image uploader seems working great in every browser except ie :( it seems stuck loading gif , nothing. above code or javascript in actual upload page? any suggestions?... <?php session_start(); include 'resizeimage.php'; include '../conf/config.php'; $loggedin = $_session['loggedin_user']; $getmid = mysql_query("select * members username = '$loggedin'"); while($iamid = mysql_fetch_array($getmid)) { $member_id = $iamid['id']; } $path = "../m/members_image/".$member_id."/temp/"; $valid_formats = array("jpg", "jepg", "png", "gif", "pjpeg", "pjpg", "pjpeg", "pjpg", "jpg", "jpeg", "png", "gif"); $pid = date("ymdhis"); $pid = str_replace(".", "", "$pid"); $pid = $member_id; /*$_session['pid'] = $pid;*/ if(isset($_post) ,

c# - What is the .Net 2.0 equivalent of xElement.Parse (string) -

i have code in c# .net 4.0 need work on computer functioning .net 2.0 framework. basically, read lines of data server. line looks this: <rec cnt="5275" time="-66520.287" time_tick="0" fpogx="0.00000" fpogy="0.00000" fpogs="0.000" fpogd="0.000" fpogid="0"/> i took these lines , added xml document using xelement.parse function. following disconnection, data saved. xelement xmldoc = new xelement("data"); //dataline string obtained each iteration reading network stream xelement xmldataline = xelement.parse(dataline); xmldoc.add(xmldataline) while (!stopclient) xmldoc.save(filename) how can in .net 2.0? you best off using xmldocument ; xmldocument doc = new xmldocument(); xmlelement root = (xmlelement)doc.appendchild(doc.createelement("data")); { string dataline = ...; using(xmlreader reader = xmlreader.create( new stringreader(datal

html - how to access multiple select array data in javascript -

i have multiple select box , want access selected data in javascript. here code: <form onsubmit="return false;" id="multisel"> <select name="a[]" id="a" multiple style="width:350px;" tabindex="4"> <option value="pedro">1</option> <option value="alexis">2</option> <option value="messi">3</option> <option value="villa">4</option> <option value="andres">5</option> <option value="sergio">6</option> <option value="xavi">7</option> </select> <button id="btn1" onclick="ajaxmultiselect()" type="submit" class="btn btn-primary">save changes</button> <p id="status"></p> </form> here code have tried far : <script> function ajaxmultise

c++ - How to move the position of a calculated circle? -

the situation have working method correctly calculates circumference. each position within circumference, stored within array of structs. camera position moves along circle depending on position within array. each element of array holds x,y , z values of position within 3d space. the problem: position of circle seems located @ x:0,y:0,z:0 radius of 3 need @ location within 3d space (x:10,y:35,z:20) radius of 3. my struct: typedef struct { float x; float y; float z; } circle; circle loop[600] = {0}; my method calculates circle: void calccircle() { (int = 0; < 599 ; i++) { loop[i].x = radius * sin(i/100.0); loop[i].y = 10; loop[i].z = radius * cos(i/100.0); } } simply add offset calculations, eg center @ 10,35,20 ... const double pi = 3.1415926535; void calccircle() { (double = 0; < 2*pi ; i+=pi*2/600) { loop[i].x =

sql - How to combine two tables (with same schema) into a single table with distinct values and indicating which table each row came from? -

suppose have 2 tables in sql: table_alpha table_bravo id | name id | name ---+------ ---+----- 1 | alice 1 | charlie 2 | bob 2 | bob 3 | charlie 3 | dorothy i want combine 2 tables single table, avoiding duplicates , keeping track of table each name came so: result name | alpha | bravo -------+-------+------ alice | 1 | 0 bob | 1 | 1 charlie| 1 | 1 dorothy| 0 | 1 i think query want this: select name, 1 alpha, 0 bravo table_alpha union select name, 0 alpha, 1 bravo table_bravo; however, above query return 2 rows each name appears in both tables. how can write query return 1 row each distinct name? will work? select distinct name, sum(alpha) 'alpha', sum(bravo) 'bravo' ( select name, 1 alpha, 0 bravo table_alpha union select name, 0 alpha, 1 bravo table_bravo ) x group name

c# - unit testing a class with event and delegate -

i new testing please help. i have following class public delegate void oninvalidentrymethod(itnentry entry, string message); public class entryvalidator { public event oninvalidentrymethod oninvalidentry; public bool isvalidentry(itnentry entry, string ticker) { if (!isfieldvalid(entry, ticker.trim().length.tostring(), "0")) return false; return true; } private bool isfieldvalid(itnentry entry, string actual, string invalidvalue) { if (actual == invalidvalue) { raiseinvalidentryevent(entry); return false; } return true; } private void raiseinvalidentryevent(itnentry entry) { if (oninvalidentry != null) oninvalidentry(entry, "invalid entry in list: " + entry.list.name + "."); } } i have written test case far struggling event , delegate shown below [testfixture] public class entryvalidatortests {

Kernel panics : trying to write / read on tiny tty driver -

i'm beginner linux programming , trying hands on device driver examples while practising. below code (a trimmed down version of tiny_tty.c ) loads using insmod , i'm able see in /proc/tty/drivers , /proc/modules , device nodes getting created under /dev. when try write device file echo "abcd" > /dev/ttyms0 (i hope fine) or read cat /dev/ttyms0 , kernel panics call trace on screen. i'm on kernel 3.5.0 under ubuntu. unfortunately i'm not able capture trace , when panics i'm left no option reboot using power button. believe issue timer here, trace shows line on top saying : "*kernel bug @ /build/buildd/linux-3.5.0/kernel/timer.c:901* ", call trace , followed "*eip @ add_timer+0x18/0x20*" below full code. guidance appreciated in anticipation. 10may2013 : tried initializing timer in open function , time below call trace "kernel panic - not syncing : fatal exception in interrupt panic occurred, switching text console"

c# - Accessing and getting response from API call -

i checking out namecheap api , having difficulty getting started. trying access api after setting sandbox account etc , sample response in xml format: <apiresponse status="ok" xmlns="http://api.namecheap.com/xml.response"> <errors /> <warnings /> <requestedcommand>namecheap.domains.check</requestedcommand> <commandresponse> <domaincheckresult domain="google.com" available="false" /> </commandresponse> <server>web1-sandbox1</server> <gmttimedifference>--4:00</gmttimedifference> <executiontime>0.875</executiontime> </apiresponse> i know how parse xml, need little guidance how started actual request/response part of api call. i know parameters need send, , know need api key , url, how write webrequest , webresponse part of it? or can linq provide me way achieve too? i trying use: webrequest req = httpwebrequest.create(url + api

django - How to handle user registration over django_rest_framework based API -

how handle user registration on , api using django_rest_framework? specifically, how set password field in userserializer class newuserserializer(serializer.serializers): first_name = serializers.charfield(required=true, max_length=30) last_name = serializers.charfield(required=true, max_length=30) username = serlializers.charfield(required=true, max_length=30) email = serializers.emailfield(required=true) password = ??? def restore_object(self, attrs, instance=none): if instance: instance.username = attrs.get('username', instance.username) instance.first_name = attrs.get('first_name', instance.first_name) instance.last_name = attrs.get('last_name', instance.last_name) instance.email = attrs.get('email', instance.email) # instance.password field necessary? instance.password = attrs.get('password', instance.password) else: return

jpa - Is there a way to eager fetch a lazy relationship through the Predicate API in QueryDSL? -

i using querydslpredicateexecutor spring data jpa project, , facing need eager fetch lazy relation. know can use native jpa-ql query in repository interface, or used jpaqlquery query dsl, intrigued if possible in order facilitate building queries future needs. i had similar problem had fetch join collection while using predicates , querydslpredicateexecutor. what did create custom repository implementation add method allowed me define entities should fetched. don't daunted amount of code in here, it's simple , need few changes use on application this interface of custom repository @norepositorybean public interface joinfetchcapablerepository<t, id extends serializable> extends jparepository<t, id>, querydslpredicateexecutor<t> { page<t> findall(predicate predicate, pageable pageable, joindescriptor... joindescriptors); } joindescriptor public class joindescriptor { public final entitypath path; public final joi

extendscript - How to replace selected text in InDesign via script? -

in scripted ui panel, have button supposed insert text. came routine, which, indeed, inserts whatever text wherever want, if there text selected, doesn't replace selection. how can modify function replace selection? if there nothing selected, should insert text normally. function inserttext(whattext){ if( app.selection.length < 1 ){ exit(); } var tf = app.selection; for( var q = 0; q < tf.length; q++ ){ var thisframe = tf[q]; var originaltext = thisframe.contents; thisframe.contents = originaltext + whattext; } } hmmm... well, seems work pretty well... [embarassed on face] function inserttext(whattext){ app.selection[0].contents = whattext; }