Posts

Showing posts from March, 2014

vb.net - How can I dynamically select my Table at runtime with Dynamic LINQ -

i'm developing application allow engineers conduct simple single table/view queries against our databases selecting database, table, fields. i how use dynamic linq library sample provide dynamically selecting select, , order clauses @ runtime i'm @ impass on how allot table choice. is there way provide dynamically selecting "from" table @ run time, , if how provide concrete example or point me in direction of has? thank ever much. edit so both of answers seem saying same general idea. i'm going try convert c# vb , work. the first answer converts notinheritable class datacontextextensions private sub new() end sub <system.runtime.compilerservices.extension> _ public shared function gettablebyname(context datacontext, tablename string) itable if context nothing throw new argumentnullexception("context") end if if tablename nothing throw new argumentnullexception(...

settings - Can't apply system screen brightness programmatically in Android -

i'm using following set system auto brightness mode , level: android.provider.settings.system.putint(y.getcontentresolver(),settings.system.screen_brightness_mode, 0); android.provider.settings.system.putint(y.getcontentresolver(),settings.system.screen_brightness, y.brightness1); i can change auto-brighess on , off, , set different levels. settings seem applied -- can go settings --> display --> brightness, , whanever setting set shown correctly. however, actual screen isn't changing brightness. if tap on slider in display settings, gets applied. i shoudl mention i'm running app withat main activity, , these settings getting applied in broadcastreceiver. did try create dummy activity , tested stuff there, got same results. ok, found answer here: refreshing display widget? basically, have make transparent activity processes brightness change. what's not mentioned in post have do: settings.system.putint(y.getcontentresolver(),settings...

java - APT (Annotation Processing Tool) -

i trying find simple example understand usage of apt command, couldn't find helpful resource this. i have referred getting started annotation processing tool high level understanding. want write code test apt command. can post simple example or better link refer? here's example of creating note annotation , associated processor: apt: compile-time annotation processing java update. of java 1.7: jsr 269, known language model api, has 2 basic pieces: api models java programming language, , api writing annotation processors. functionality accessed through new options javac command; including jsr 269 support, javac acts analogously apt command in jdk 5.

mongodb - Can you create multiple indexes on a single field in Mongo? What does that look like? -

i'm trying create compound key "_id" field, takes in geo information other attributes. looks like: {_id: {lat: 50, lon: 50, name: "some name"}} after creating document, mongo assigns index default, , ignores command db.coll.ensureindex(_id: "2d") is there way can have _id field index-able both geo-index , regular index? you have 2 options here. both of them require change in schema: make _id unique hash , put coordinates in separate field 2d index: {_id: "standard objectid or hash", name: "some name", loc: [50, 50]} if want _id field (i wouldn't recommend this): {_id: {name: "some name", loc: [50, 50]}} db.coll.ensureindex({'_id.loc': '2d'})

bash - Struggling to combine two Greps statements -

greetings! i have been tasked create report off files receive our hardware suppliers. need grep these files 2 fields 'test_version' , 'model-manufacturer' ; each field, need capture corresponding values. when running each statement separately, results want: 1) 'test_version', straightforward: find . -name "*.ver" -exec grep 'test_version=' '{}' ';' -print; ./(file_name).ver test_version=2.6.3 ./(file_name).ver test_version=2.4.7 2) 'model-manufacturer', , bit tricky since need across multiple lines. solved issue using perl regex option -p. find . -name "*.ver" -exec grep -p 'model-manufacturer:.\n.' '{}' ';' -print ./(file_name).ver --> model-manufacturer: d12-100 ./(file_name).ver --> model-manufacturer: h21-100 ideally, create simple report looks this (file_name) test_version=2.6.3 model-manufacturer: d12-100 (file_name) test_version=2.4.7 model-manufact...

java - JAXB / Jersey - Feed doesn't show my nested list - Any idea? -

it's frustrating , i've been fighting issue 5 hours now... :( i'd expect jaxb/jersey embed list of downloads in project's json feed... unfortunately it's missing. here's code snippet: project.java ... @xmlelement public final list<download> getdownloads() { return this.downloads; } ... i can fetch download object without problems... {"contenttype":"application/zip","filename":"source_something.zip","key":"17","title":"some new title"} when use list of strings - works fine! @xmlelement public final list<string> gettechnologies() { return this.technologies; } output of project.json (see nested technologies list): {"key":"16","date":"1999-01-13t02:23:31.712z","description":"somedesc","teaser":"this teaser!","technologies":["some...

c# - How to specifiy proxy settings for SSRS Winforms Control -

i using ssrs winforms client control display reports in app. user's behind proxies getting 407 (proxy authentication) error. how specify proxy settings request? i.e. proxy server, username & password. expecting similar httprequest , webproxy. this helpful c# connecting through proxy need specify proxy settings on per ssrs request basis. any ideas? thanks. you can specify proxy settings using reporting web services. add reporting web reference project. url of web service : http://servername/reportserver/reportexecution2005.asmx in code calling web service. byte[] report = null; //create instance of reporting service web reference var reportreference = new reportexecutionservice(); <strong>//set proxy settings reportreference.proxy = new webproxy("address:port"); //create credential used authenticate again reporting services var credential = new networkcredenti...

c++ - Why marking variables as a constant? -

possible duplicate: does declaring c++ variables const or hurt performance? besides point of can't change cost variables, use less memory or can access values faster? const int = 1; int b = 1; taking account it's same global, local , class member. thanks does use less memory or can access values faster? usually neither. makes program more robust because (or other people) cannot change value accidentally. this makes sense in public apis when want show consumers won’t modify values. every modification of variable means change in program state. in order programmers sure program works correctly need keep track of state, , tremendously more difficult if don’t know when or how variables changed. the primary purpose of const therefore documentation of semantics , powerful purpose. use const often.

How To Tell Whether a Protocol is Valid In Javascript -

possible duplicate: how detect browser's protocol handlers? a software (non-browser based) installs custom protocol when installed. thus, if software installed on system, putting link looks <a href="mycustomprotocol:///foobar">launch program!</a> in web page launches software when clicked (after putting warning of course). if software not installed want dynamically change element browser not try launch it. is there way in javascript detect whether protocol valid? work in @ least firefox, ie, chrome , safari. thanks there no way javascript access user's desktop file system or registry validate custom protocol.

Need to change URL of wiki on SharePoint 2007 (MOSS) -

i created wiki in sharepoint 2007 title "test wiki," not realizing stuck url (yeah, know...). created bunch of pages on wiki, , want modify url "wiki." changing title through web interface not change url. have sharepoint designer , read elsewhere can rename list , change url... happens wiki pages? links break? just clear (this first question here), example of current page in wiki like https://moss.mycompanyname.com/supportdesk/test%20wiki/usermanuals.aspx and want be https://moss.mycompanyname.com/supportdesk/wiki/usermanuals.aspx thanks in advance. why don't give try sharepoint designer ? if links break, can switch 'test wiki' spd , try else. :-)

WebPart that redirect if user is not in a specific SharePoint security group -

does know of webpart, webpart code or client code this? i'd give security group contribute sepecific list, want customize copies of forms can run , make sure can't run other speicfic forms list. when webpart sees not in specific security group redirect them error page or other page. thanks. you can create webpart runs code: if (!spcontext.current.web.sitegroups["groupname"].containscurrentuser) { sputility.redirect("url", spredirectflags.default, httpcontext.current); }

actionscript - How do I download multiple large files and saving locally -- URLStream or URLLoader? -

this absolutely driving me crazy. while i'm fan of availability of asynchronous calls in air, i'm finding being forced use them should super simple severe limitation. severe may end abandoning air , writing native android , ios apps instead of using shared air platform. ok, have off chest, here's i'm trying accomplish. have app that, when deployed, relatively small. once deployed user's device user log in using login name/password. once log in, content specific user needs downloaded , saved local device. since content varies user can't include in package deployment. but cannot figure out how accomplish this: want download 10 files , each file 2-3mb , want show "downloading, please wait..." view during download. application cannot proceed until 10 files downloaded. since i've seen urlstream , urlloader both async cannot figure out how block app opening "view available content" , on "downloading, please wait..." vie...

php - Generating a PDF using CodeIgniter -

i using dompdf create pdf file out of html file gets created on-the-fly sole purpose of serving input pdf generator, having trouble doing this, implemented code in this thread , works fine (i output simple pdf) when try give more specific url error: an error encountered unable load requested file here's code has problem: function printpdf(){ //write_file() usa un helper (file) $this->load->library('table'); $this->load->plugin('to_pdf'); // page info here, db calls, etc. $query = $this->db->get('producto'); $data['table'] = $this->table->generate($query); $path_url = base_url().'print/existencias.html'; write_file($path_url, $data['table']); $html = $this->load->view($path_url, 'consulta', true); pdf_create($html, 'consulta'); } ...

c# - Possible Ways to Merge/Join Similar Collections from Different Systems -

i keep running same programming task without satisfying solution. have similar collections of objects different systems need combine or merge one, , possibly report on intersections between two. a example of might collection of users active directory, , same collection of users sap (with richer attributes not exist in ad). want 1 collection of users containing properties both collections. or maybe have collection of users in sharepoint, , collection of newsletter subscribers in constant contact, , want collection of active users newsletter subscribers in constant contact. given there common identifier in both collections (email address, id of sort) join them, find have few options efficiently merged data: get objects system a. objects system b. in double-loop, find matches , add them new collection. get objects system a. each object in system a, query system b find match , add new collection. option 1 stinks because have fetch data system b, though may throw of away i...

python - Submit without the use of a submit button, Mechanize -

so, started out mechanize, , apparently first thing try on monkey-rhino-level high javascript navigated site. now thing i'm stuck on submitting form. normally i'd submit using mechanize built-in submit() function. import mechanize browser = mechanize.browser() browser.select_form(name = 'foo') browser.form['bar'] = 'baz' browser.submit() this way it'd use submit button that's available in html form. however, site i'm stuck on had 1 doesn't use html submit buttons... no, they're trying javascript gurus, , submit via javascript. the usual submit() doesn't seem work this. so... there way around this? any appreciated. many thanks! --[edit]-- the javascript function i'm stuck on: function foo(bar, baz) { var qux = document.forms["qux"]; qux.bar.value = bar.split("$").join(":"); qux.baz.value = baz; qux.submit(); } what did in python (and doesn't work): def fo...

Is User Control in Asp.Net can be completely self contain? -

i trying make usercontrol have data process, initialize data, ajax, self contain 1 control. can insert anywhere on asp pages. but problem is, usercontrol contains script manager , page contain user control has script manager too, asp doesn't allow me have 2 script manager in 1 page. in case this, wonder if usercontrol can self contain? or proper way of using usercontrol using template, , data process, event handler have on page contains usercontrol? thanks. ======edit: guess use scriptmanager.getcurrent check if page exists scriptmanager , add otherwise. thanks. for part, can make self-contained. use clientscript object. this: if (!page.clientscript.isclientscriptblockregistered("key")) { page.clientscript.registerclientscriptblock(gettype(), "key", "function myfunction() {" + "..." + "}", true); } by providing unique key code block, can ensure particular block of javascript add...

iphone - Loading and Unloading background images as game moves -

hey guys, have raidan style 2d flying/fighter game im working on. upon moving standard nsobject framework cocos2d, have encountered issue background image/sprite. before cocos2d, background large vertically. 320x9999 (or something). loaded , created illusion large level. cocos2d has limitations on image sizes, forced slice image 33 different background images each @ 320x480. understanding memory big deal on ios platform, decided create 2 background ccsprites: ccsprite *background1, *background2; background2 ontop of background1. using these 2 backgrounds, jet moves screen, each background move inversely down screen @ equal rate, first background1 moves off screen vertically, released memory , new sprite loaded background1 , background1 positioned above background2 vertically. as background2 moves off screen, released , new image loaded background2 , placed ontop of background1. creating illusion of constant , consistent background. q. seem valid method? q. how go achiev...

jquery - Accessing multiple cloned fields from PHP -

i have form has ability copy row of several fields using jquery - question how access these form values in target php page? any code, chance? anyway, can make add name new field square braces, ti accessed array, happens multiselect checkboxes es: new field 1 <input type="text" name="added[]" value=""> new field 2 <input type="text" name="added[]" value=""> and on... then have everythin in $_post['added'] array

c# 2.0 - Help With pattern matching -

in code have match below 3 types of data abcd:xyz:def def:xyz xyz:def where "xyz" real data , other part junk data. now, first 2 types below can split ':' , can array[1] position data ... give me correct one. abcd:xyz:def def:xyz i not getting how can extract 3rd case. idea? please help. thanks, rahul string case1 = "abcd:xyz:def"; string case2 = "def:xyz"; string case3 = "xyz:def"; string result1 = case1.split(':')[1]; string result2 = case2.split(':')[1]; string result3 = case3.split(':')[0]; if understand question correctly.

trying to isolate a block from my logs with awk, help please! -

i trying write awk script can block contains word "error", out of long log file. basically log file contains actions performed, , when 1 of these fails, add under action error line, saying wrong. i can isolate error line doing grep "error:", missing command given since printed before error line, , not know how many lines before, cannot arbitrarily "print 10 lines precede word "error:" i've figured out sort of scheme thou; each of block contain error lines starts in same way ("processname"), followed command , other parameters, each 1 on different line, , last line empty line. so idea use block awk, can "processname" string, start print lines 1 one until reach empty line, , pipe printed result trough grep see if there word "error:" in there; if there error redirect on file , append whole block, otherwise continue next block , same thing. now if can hand task; since not know how achieve this; i've look...

javascript - How do I fix this error with node.js and node-imagemagick: Error: Command failed: execvp(): Permission denied? -

im getting error: error: command failed: execvp(): permission denied when simple node-imagemagick script: im = require('imagemagick'); im.identify.path = '/tmp/node_thumbs/'; im.identify('cool.jpg',function(err,features){ if(err) throw err; console.log(features); }); any ideas on causing this? the permission denied trying launch imagemagick command, not in process of executing it. if @ documentation , identify.path "path identify program." in case, you're redefining path executable /tmp/node_thumbs/, presumably not executable. you want: var im = require("imagemagick"); im.identify('/tmp/node_thumbs/cool.jpg',function...

select - Java can't find symbol -

import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.*; public class stuff extends applet implements actionlistener { button okbutton; public void init() { setlayout(new flowlayout()); okbutton = new button(""); add(okbutton); okbutton.addactionlistener(this); } public void paint(graphics g) { if (okbutton.getstate()) g.setcolor(color.black); g.drawrect(20, 20, 200, 200); } public void actionperformed(actionevent evt) { if (evt.getsource() == okbutton) repaint(); } } i think button don't has state . isn't checkbox state if marked or not. so, okbutton.getstate() error. an explanation of trying achieve every 1 you. don't post code, leaving decipher trying achieve .

android - Activity from a background activity? -

am having application contains activity a,b,c , launched browser , b launched a, count timer running on launches activity c if timer hits. 1 plz tell stack order activity of application. either a->b->c or a->c->b. visible activiy should c if press key c should display either or b ? thanks in advance. you can try launch b , c startactivityfromchild(this, intentofc, req_code_for_c); i'm not sure may useful you.

XMPP connect and receive -

i have been working on text , voice chat application, , looking @ xmpp. visited http://www.xmpp.org , found open source server , clients. clients don't seem provide me complete flexibility need, need create 1 of own. i need know following: how can connect xmpp server(i have installed openfire)? basic aim send xml , receive response openfire. what xml need send, , how send , receive it? see rfc 3920 , section 4.8 simplified stream examples

c++ - How to include CTime in my vc++ code -

i have need use ctime in code. tried add header file "atltime.h" code. now, getting many errors in compiling. every error coming header file "afxconv.h". searched msdn ctime, didn't describe this( may yet see proper page). using visualstudio-2008, 64 bit. can point me correct direction? sounds having conflict mfc , atl version of ctime. since specify mfc in tag suspect want mfc verion. atltime.h atl projects. afx.h has ctime mfc afaik included in stdafx.h

android - Forward button functionality -

can give functionality of forward button in android app. in case of web app, urls , session id stored in stack can provide functionality. can provide similar kind of functionality in our mobile app using activities.if yes how , implications of same. if don't kill activities, wouldn't create memory issues?? thanks.. yeah think pretty simple. so if working android 2.0 there function, there function in activity called, onbackpressed(). if have activities override , like: public void onbackpressed() { intent intent = getintent(); myaccessablestoragefacility.storeforwardintent(intent); super.onbackpressed(); } public void oncreateoptionsmenu(menu menu) { menu.add("forward").setintent(myaccessablestoragefacility.getlastintent()); super.oncreateoptionsmenu(menu); } if don't have android 2.0, override onkeypressed method instead of onbackpressed , keycode of button , write same code save last intent.

regex - How do HTML parsers work? -

i've seen humorous threads , read warnings, , know you don't parse html regex . don't worry... i'm not planning on trying it . but... leads me ask: how html parsers coded (including built-in functions of programming languages, dom parsers , php's strip_tags)? mechanism employ parse (sometimes malformed) markup? i found source of one coded in javascript , , uses regex job: // regular expressions parsing tags , attributes var starttag = /^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, endtag = /^<\/(\w+)[^>]*>/, attr = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; do this? there conventional, standard way code html parser? i not know that style “normal” way things. better i’ve seen, it’s still close refer “naïve” approach in this answer . 1 thing, isn’t accounting html comments getting in way of ...

vb.net - Where can I d/l MS Powerpacks 10? -

i not able find site download ms powerpacks 10, use vb.net 2010. microsoft.visualbasic.powerpacks.vs 10.0.0.0 included visual studio 2010. by default located c:\program files\microsoft sdks\windows\v7.0a\bootstrapper\packages\vbpowerpacks\en\visualbasicpowerpackssetup.exe

Memory Leak Observed in Erlang Application -

let me put question simple below. mine network router software built in erlang, @ particular scenario observing high memory growth shown vm. have 1 process receives binary packet other process socket. process, parses binary packet , passes binary packet gen_server (handle_cast called) gen_server again stores information in ets table , send packet peer server. when peer server responds entry ets deleted , gen_server responds first process if first process (which sent packet gen_server) gets timedout after 5 seconds waiting response gen_server , deletes ets entry in gen_server , exits. observing high memory growth when lots of events gets timed out (due unavailability of peer server) , have researched "**binary**" , "**processes_used**" given erlang:memory command thats using of memory. same not true when events processed successfully. the memory lost can in 3 places: the state of gen_server look @ state, find out if there big or grow...

jquery and select tag help -

firstly, i'm totally javascript inept please explain throughly. ok, have 2 issues going on here. need save data using json posts server side code. first need attribute values can passed server. pertains input boxes, i'm because straightforward can't seem values selects. the last problem i'm having using jwysiwyg , cannot value of either. have 3 of jqysiwyg on single form. each 1 has different id. can me put together? thanks rhaul, able values of selects i'm still having problem getting values of editors. to value of select box , editor can use .val() $("#yourselectboxid").val(); and $("#youreditorid").val();

c# - Display and update a TimeSpan -

...hello, i explain problem : in xaml code, binded element propertie "duration" of class "mtask". "duration" type timespan. when start method class "mtask" called mstart, want update propertie "duration" during execution of method, , display binding. but problem don't know how keep updated time span. thinking create datetime @ beginning of method , substract current datetime.now during execution, solution? if need more information, ask! thanks, y. the easiest way write start time field , let property "duration" return datetime.now - _starttime. update: class mtask must implement inotifypropertychanged , raise event of interface, whenever value of property changes. in case, value of property calculated on fly, need raise event cyclically while method mstart runs.

Are there any alternative methods for calculating the loading time of a web page on the Android? -

i know webview class has onpagestarted() , onpagefinished() methods, can used calculating load time page. there other methods doing this? i'm using intent object launch browser, i'm looking method works under setup: uri url = uri.parse("www.google.com"); intent browser = new intent(intent.action_view, url ); startactivity(browser); afaik, approach of writing custom code in onpagestarted() , onpagefinished() way. till now, haven't come across method works under setup use device browser, since loaded separately.

state - jQuery: overriding and restoring attribute values -

i trying have expandable rows in data table. each time have "master row", followed 1 or more "child rows" toggled clicking on first cell of master row. this html: <tbody> <tr class="master"> <th rowspan="3" scope="row" class="toggle">toggle</th> <td>column 2</td> <td>column 3</td> </tr> <tr class="child"> <td>column 2</td> <td>column 3</td> </tr> <tr class="child"> <td>column 2</td> <td>column 3</td> </tr> <tr class="master"> <th rowspan="2" scope="row" class="toggle">toggle</th> <td>column 2</td> <td>column 3</td> </tr> <tr class="child"> <td>column 2</td> <td>column 3</td> </tr...

oop - PHP Child class accessing object in Parent class -

class bm_main { public $db; public function __construct(){ $this->db = new db(); } } class bm extends bm_main{ public function __construct($id){ $this->db = parent::$db; $this->db->save($id); } } how access $db object parent class can use in child one call parent constructor db class instantiated: public function __construct($id) { parent::__construct(); $this->db->save($id); } the $db property inherited subclass, , public, can access using $this->db .

Character encoding in javascript file and a simple php file -

i got problem special characters. have defined meta tag as <meta http-equiv="content-type" content="text/html; charset=utf-8" /> so far good. in 1 occassion have select tag many options many special characters. got problem showing (å ä ö). defined in .js file , appended document using dom. pls. there solution except using &... forgot name type. second character problem have in php. try send email amazon ses. <?php $message['body.html.data'] = "please confirm tönt clicking on link"." ....<a href='s'>tönt</a>"; $message['body.html.charset'] = 'utf-8'; ?> the ö not showing properly? you'd better use: <?php header('content-type: text/html; charset=utf-8'); ?> at top of php file, no need use http-equiv metas when can send real http headers ;-) also check if files (both php , js) encoded in utf8 in editor. setting utf8 header on non utf8 files ...

html - How to save my page so it looks as is in the browser? -

a client wants save , print out particular page i've made them, when file looked at, loses of css formatting. what need in order make if page printed, looks close on screen? you should provide same css both screen , print follows: <link rel="stylesheet" type="text/css" href="path/to/your.css" media="screen,print" />

regex - How can i express in regexp "match until a pattern without including that pattern"? -

i have input : {http://sdfgdf.dfg.dfg.dfg#value1 : http://sdfgdf.dfg.dfg.dfg#value2} and i'd match value1 first url. thought below regexp : [^#]\w*\s: but matches "value1 :" how can express "match until \s: ,without including pattern? zero-width lookahead. in java this: [^#]\w*(?=\s:) you may think making regex more flexible, handle whitespaces , such... in case input different expect.

android - listView inside a ViewFlipper - scrolling problems -

i'm having trouble litview inside viewflipper . // gesturedetector class mygesturedetector extends simpleongesturelistener { @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { try { if (math.abs(e1.gety() - e2.gety()) > swipe_max_off_path) return false; // right left swipe if(e1.getx() - e2.getx() > swipe_min_distance && math.abs(velocityx) > swipe_threshold_velocity) { iconmanager.instance.leftswipe(); vf.setinanimation(slideleftin); vf.setoutanimation(slideleftout); vf.shownext(); system.out.println("swiiingg!!"); // left right swipe } else if (e2.getx() - e1.getx() > swipe_min_distance && math.abs(velocityx) > swipe_threshold_velocity) { iconmanager.instance.rightswipe(); v...

android - Position of the activity in the activity stack -

am having applications contains activity a,b,c , activity has been launched launcher , b , c b. having button in c on clicking button should tell position of activity c in activity stack . ex a-b->c means c @ 3 position of activity stack.. how find ? thanks in advance. there no other way know this, because of how tasks designed. see this , this solution keep track of activities storing them in array of activities. hope helps.

windows - Force passing long file names to dos for command -

i have problem following simple dos command: for %%f in (.\07_procedures\datasources\*.sql) echo "%%f" it action every file sql extension. works fine, except long names. when directory contains files, sql_ extensions, picked too. behavior depend on whether 8.3 files turned on or off on file system. if turned on (default choice on computers) sql_ passed, because extension cropped. how force for fetch long file names ? ! p.s. not offer powershell upgrade. you can try examine extension in loop itself for %%f in (*.sql) ( if /i "%%~xf" equ ".sql" echo %%f )

blackberry - How to display Half screen? -

i working on project need display listfield takes top half of screen when user clicks on menu item. should display on top of earlier screen. how can implement it? here ideas: use listfield directly above screen size required screen. use popupscreen listfield use screensplit functionality display half of screen popupscreen best fit question. can try , post code didn't work? another option use managers split screen (higher manager , lower manager) , hold 2 managers: 1 displayed on click , 1 used pointer displayed manager. then, when ever replace event fired should call following function: void updatemanagers(boolean click) { if(click) { currentmanager = afterclickmanager; } else { currrentmanager = beforeclickmanager; } invalidate(); } where currentmanager instance of manager , afterclickmanager & beforeclickmanager instances of class extends manager (no need same class). note should add curren...

Chilkat parsing XML - Looping problem -

i'm using chilkat parse xml response external api. works when xml formed follows: <response> <field1>data1a</field1> <field2>data2a</field2> <field3>data2a</field2> </response> <response> <field1>data1b</field1> <field2>data2b</field2> <field3>data2b</field2> </response> using .nextsibling() loop through nodes; however, when xml formed follows: <response> <data field1="data1a" field2="data2a" field3="data3a"/> <data field1="data1b" field2="data2b" field3="data3b"/> </response> only first node captured (using .chilkatpath extract attributes) , .nextsibling() has no effect. what should using loop though these nodes? thanks help i'm throwing shot in dark here, there chance you're parsing "response" field instead of "data" field ? on first example respons...

python - How to find elements by class -

i'm having trouble parsing html elements "class" attribute using beautifulsoup. code looks this soup = beautifulsoup(sdata) mydivs = soup.findall('div') div in mydivs: if (div["class"]=="stylelistrow"): print div i error on same line "after" script finishes. file "./beautifulcoding.py", line 130, in getlanguage if (div["class"]=="stylelistrow"): file "/usr/local/lib/python2.6/dist-packages/beautifulsoup.py", line 599, in __getitem__ return self._getattrmap()[key] keyerror: 'class' how rid or error? you can refine search find divs given class using bs3: mydivs = soup.findall("div", { "class" : "stylelistrow" })

xml - To Substring in xsl -

hi converting 1 xml xml using xsl. the problem face value inside tag 10feb2011 i.e <date>10feb2011</date> . i need output be: <date>10</date> <month>feb</month> <year>2011</year> so used substring function, not work. my xml looks like <arrivaldatetime> <date>20feb2011<date> </arrivaldatetime> it should converted format <arrivaldatetime> <dayofmonth>10</dayofmonth> <month>feb</month> <year>2011</year> </arrivaldatetime> below xsl wrote <?xml version="1.0" encoding="iso-8859-1"?> <!-- edited xmlspy® --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:text><![cdata[<arrivaldatetime>]]></xsl:text...

python - MySQLDB code to create wordpress DB tables -

i need create wordpress databases using mysqldb connected mysql server using sqlalchemy code. sql table follows: create table if not exists `wp_links` ( `link_id` bigint(20) unsigned not null auto_increment, `link_url` varchar(255) not null default '', `link_name` varchar(255) not null default '', `link_image` varchar(255) not null default '', `link_target` varchar(25) not null default '', `link_description` varchar(255) not null default '', `link_visible` varchar(20) not null default 'y', `link_owner` bigint(20) unsigned not null default '1', `link_rating` int(11) not null default '0', `link_updated` datetime not null default '0000-00-00 00:00:00', `link_rel` varchar(255) not null default '', `link_notes` mediumtext not null, `link_rss` varchar(255) not null default '', primary key (`link_id`), key `link_visible` (`link_visible`) ) engine=myisam default charset...

Dynamically load and use COM object in C# -

i have c# project, access ms outlook, if installed on client´s machine. "access outlook" part has been done referencing outlook com object, , going there. problem "if installed" part. @ moment, project doesn´t compile on machines without outlook installed, assume have not reference outlook component, , instead load , use dynamically, after detecting outlook present, haven´t found way this. correct, , have hints on how this? thanks. edit: resolved. following advice given hans passant in 1 of comments using office pias, proved path of least resistance. had little difficulty getting pias on office-less machine, overcome using accepted answer this question. you won't able compile assembly on machine without outlook com object being present, doesn't mean application fail work on machine without outlook - attempting create or use outlook com object result in failure / exception being thrown. according this question best way of detecting whethe...

wcf - StructureMap grouping of named instances -

long post - sorry.... i'm doing input validation wcf service , using structuremap ioc instantiate appropriate validation objects. have 2 different validation groups: per object validation: means 1 input parameter, resolve ioc (e.g. ioc.resolveall<ivalidatorobject<inputparameter1> , .... <inputparameter2> ... etc). if rules found, validate method invoked. per context validation: mean validation rules invoked, based on current context (explicit roles). context 'deposit money' or 'open bank account'. context validation dependent on 2 or more of input parameters , key difference between object , context validation. the input validation performed in beforecall event call in iparameterinspector (provider/server side!). event string containing operation name (aka. context) , object[] input parameters. the problem there's multiple validation rules single context , way have figured out register context in ioc, using named intances. can regi...

load - Can php divide the page into small block and gradually appear? -

can php divide page small block , gradually appear? divided main page several small blocks, like: <?php include('header.php'); <div id="content"> <!-- content --> </div> include('partone.php'); include('parttwo.php'); include('partthree.php'); include('footer.php'); ?> i need open page, first load header.php , div#content , footer.php , gradually loaded partone.php , parttwo.php , partthree.php . there way that? thanks. modify code following <?php include('header.php'); ?> <div id="content"> <!-- content --> </div> <div id="partone"></div> <div id="parttwo"></div> <div id="partthree"></div> <?php include('footer.php'); ?> then make 3 ajax requests load in partone.php, parttwo.php , partthree.php respecitve divs in above code. plenty of tutorials on how via different jav...

how to disply my content on a html page in android -

i want display data's in html page,i make static html page in assest folder .but dont know how insert data's in html page programtically. please urgent. loading html page asset relatively simple: webview webview = (webview)view.findviewbyid(r.id.mywebview); webview.loadurl("file:///android_asset/index.html"); but programatically alter content of page you'd have first read asset file string, insert data string replace, or use java.text.messageformat. here's code inputstream asset: assetmanager mgr = this.getassets(); inputstream = mgr.open("index.html"); bufferedinputstream in = new bufferedinputstream(is); // read contents of file once have html string populated, can programmatically set content of webview: webview.loaddata(htmlstring, "text/html", "utf-8");

unicode - Objective-C and scanning an integer or character to a hex representation -

nsscanner has instance method -scanhexint: converting hexadecimal string representation of int int . i'd invert this: i'd method takes int , returns hexadecimal representation. is there ready made method in docs? [to more relevant, i'd take string comprising single kanji , return unicode point.] if check documentation on string format specifiers , you'll see there several specifiers can use hexadecimal string representation of number. instance, use: [nsstring stringwithformat:@"%x", foo]

javascript - Why does document.getElementById() function exist? -

this question has answer here: why don't use element ids identifiers in javascript? 3 answers when creating web pages have used function var somevariable = document.getelementbyid('myid'); to reference element object. suggested me not necessary, because there such variable. it's name equal id. i've tested , seems work. <div id="myid">some text</div> <a href="someplace" onclick="alert(myid.innerhtml)">click here</a> this code works , alerts "some text" expected. there warning in firefox error console: element referenced id/name in global scope. use wc3 standard document.getelementbyid() instead.... i using jquery need prove point boss @ work or else have have buy him box of chocolate :-). any ideas why upper code shouldnt work or why wrong idea use it(warning in firef...

iphone - Do NSMutableAttributedString addAttribute methods retain the passed in value? -

for example following code memory safe? nsmutableattributedstring *str = ...; ctfontref afont = ctfontcreatewithname((cfstringref)fontname, size, null); [str addattribute:(nsstring*)kctfontattributename value:(id)afont range:range]; cfrelease(afont); also, ctfontcreatewithname efficient call multiple times or should effort made cache ctfontref's same font/size? i believe safe release font object after adding attribute. have done in own core text code , never have issues. as caching, make sense keep font object around if used multiple times rather releasing , recreating many times. though, pre-optimisation, wouldn't make conscious effort yet. profile current code , decide whether or not microseconds worth work.

geocoding in excel -

i have excel sheet address column. latitude , longitude required these addresses. how fill next column 'latitude' , second next column 'longitude' ? there helpful tool ? suggestion ? i forked , updated tool easily: excel geocoding tool

oracle - Hibernate ManyToOne and OneToMany i one Entity -

i have 3 tables university(id,name), group(id,name,university_id), student(id,name,number,group_id). 1 university have many groups , 1 group have many students. my pojos this: @entity(name = "student") public class student { @sequencegenerator(name = "genstudent",sequencename = "studentseq") @id @generatedvalue(generator = "genstudent") private int id; @column(name = "name") private string name; @column(name = "facnum") private string facnum; @manytoone private unigroup group; public unigroup getgroup() { return group; } public void setgroup(unigroup group) { this.group = group; } public student(){ } ... getters , setters } @entity public class unigroup { @sequencegenerator(name = "gengroup",sequencename = "unigroupseq") @id @generatedvalue(generator = "gengroup") private int id; @column...

javascript - form.onsumbit subclass -

i write smart extension chrome , inject javascript inside frame in frameset page... in 1 of frame want replace onsumbit form. want analyze (x, y) values image type field before make submit. i can find element name form. can onsubmit property. how make check sending values before submit? thanks. hm, this? var formel = document.getelementbyid("form1"); var originalonsubmit = formel.onsubmit; formel.onsubmit = function() { if(all_ok) { originalonsubmit(); } else { return false; } }

git project vs repository, what's the fundamental difference? -

i have 2 projects use svn , i'm migrating git, signed gitorious , there's option create new project or add repository. i'm starting out git don't know difference is, or rather means if use repositories under 1 project. if i'll end theirdomain.com/myname/repository1 , theirdomain.com/myname/repository2 if choose create 2 projects end theirdomain.com/project1 theirdomain.com/project2 apart url difference, there implications in choosing 1 on other? in advance that gitorious, not git thing. can have multiple repositories per project. for instance, if have client/server application. have 1 project, , repository client , repo server inside it.

java - How can I retrieve the submitted values of a dynamically generated form? -

i need application allows final user create own form (drop checkboxes,inputtexts, etc) save form , user can open form , write values in elements of form print form. i'm working icefaces, , doing in managed bean: javax.faces.component.uiviewroot root = facescontext.getcurrentinstance().getviewroot(); // find form clientid. uicomponent = root.findcomponent("a"); uicomponent b = a.findcomponent("form"); uicomponent form = b.findcomponent("formulario"); list children = form.getchildren(); if (tipo.equalsignorecase("text")) { htmlinputtext inputtext = new htmlinputtext(); inputtext.setid("text" + nro + (indice + 1)); indice++; inputtext.setvalue(""); inputtext.setsize(tamanio); children.add(inputtext); elemento = new elemento(tipo, inputtext.getid(), i...

How to delete entry in an Address Book program using Java? -

i having trouble logic of deleting entry in address book... saving entries using array. i try make array[i] = null, if array[i] equals entered name of user. after delete entry , try view entries again, nothing shows.. , output says : exception in thread "main" java.lang.nullpointerexception @ addressbook.viewall(addressbook.java:61) @ addressbook.main(addressbook.java:35) java result: 1 this code in deleting entry: public void deleteentry() { sname = joptionpane.showinputdialog("enter name delete: "); (int = 0; < counter; i++) { if (entry[i].getname().equals(sname)) { //joptionpane.showmessagedialog(null, "found!"); entry[i] = null; } } } can me figure out wrong code... or logical error? if have suggestion or better way delete entry big help.. please help... if (entry[i].getname().equals(sname)) { if on 1 pas...

uinavigationcontroller - UITableView with UIToolBar -

i have uitableview being pushed uinavigationcontroller. need add uitoolbar tableview. toolbar has have 2 buttons. after pressing each of them tableview show different types of data, sections , cells. uitableview has header view , need stay whyle tableview changes. what right way implement logics? your uitoolbar , uitableview can composed inside viewcontroller, uitoolbar not need child view of uitableview. if viewcontroller subclass of uitableviewcontroller may need switch simple uiviewcontroller parent, can add both tool bar , table within view. that way toolbar not scroll table.

c# - Access control in a number of tags from codebehind -

i've such structure <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:login id="logincontrol" runat="server" onauthenticate="logincontrol_authenticate" > <layouttemplate> <table> <tr> <td> <asp:uploadfile id="upfile"... <td> <asp:button id="loginbutton" onclick="loginbutton_click"... how access fileupload control in codebehind? if there's no , it's simple e.g. upfile.filename if it's in tags ther's error: the name 'upfile' not exist in current context how change it? i don't know how layouttemplate works, can try this: fileupload upfile = (fileupload)logincontrol.findcontrol("upfile");

storing order in drag and drop interfaces -

i guess less direct problem more of implementation question. for drag , drop interfaces. how people store order of elements being re-arranged. since user expects order preserved when user refreshes page, how store kinda information in relational database or other persistent layer? a number system seems extraneous requiring multiple updates anytime arranged , couldn't think of nicer system storing information if user doesn't have click "done" or other button after re-ordering. (ie facebook photos) any appreciated. one approach linked-list style: each element, store after (or both before , after, doubly linked list). way, when move something, have update affected elements. since don't typically need retrieve, say, 2357th element (more typically need recreate entire list) performance impact should fine.

c - Program using read() entering into an infinite loop -

1oid readbinary(char *infile,hxmap* assetmap) { int fd; size_t bytes_read, bytes_expected = 100000000*sizeof(char); char *data; if ((fd = open(infile,o_rdonly)) < 0) err(ex_noinput, "%s", infile); if ((data = malloc(bytes_expected)) == null) err(ex_oserr, "data malloc"); bytes_read = read(fd, data, bytes_expected); if (bytes_read != bytes_expected) printf("read %d of %d bytes %d\n", \ bytes_read, bytes_expected,ex_dataerr); /* ... operate on data ... */ printf("\n"); int i=0; int counter=0; char ch=data[0]; char message[512]; message* newmessage; while(i!=bytes_read) { while(ch!='\n') { message[counter]=ch; i++; counter++; ch =data[i]; } message[counter]='\n'; message[counter+1]='\0'; //--------------------------------------------------- newmessage = (mess...