Posts

Showing posts from May, 2013

Why does Internet Explorer reject my filename with spaces? -

i have bunch of pdf files have spaces in name displayed in iframe in new window using window.open (not @ same time). both work fine in except ie8 throws file not found error. remove spaces , work fine in ie8. i need retain spaces in file names tried using escape(filename); repalces spaces escape key %20. doesn't work either. i have tried evrything think of or google make ie8 accept spaces, nothing seams work. any suggestions? can remove spaces testing in real world removing spaces names of pdf files in file system not option. here code working with var file = "pdfs/this file name has spaces.pdf"; file = escape(file); //this not fix problem //to display in new window or tab... window.open(file); //to display in iframe... $('.viewer .ifrm').attr('src', file); thanks. use encodeuri instead of escape

c - Why is my Windows program trying to call main() instead of WinMain()? -

i'm trying make first steps opengl. however seems not happen because of error coming while trying debug solution: msvcrtd.lib(crtexe.obj) : error lnk2019: unresolved external symbol main referenced in function _ _tmaincrtstartup i understand complier wants see int main() ... , doesn't see winmain call? here code: #include <windows.h> #include <stdio.h> #include <stdlib.h> typedef struct { hwnd hwnd; } glab_t; static glab_t glab; char szclassname[ ] = "glab"; static lresult callback windowprocedure (hwnd hwnd, uint message, wparam wparam, lparam lparam) { switch (message) { case wm_destroy: postquitmessage (0); break; default: return defwindowproc (hwnd, message, wparam, lparam); } return 0; } int winapi winmain (hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int ncmdshow) { msg messages; rect rect; wndclassex wndclass; int scr...

How to read my own configuration file in perl -

how read own configuration file .pl extension? have used require read file in script. not sure right way it? can please suggest me how this? and when read config file require in script, errors global symbol requires explicit package name. how solve this? here example: this config file: $username="sach"; $password="sach123"; $dbname="personal"; $host="localhost"; $list_old_files_file="old_files.txt"; $remove_files=1; $file_path="/sach/"; and here how call in script: require "config.pl" ; $dbh = dbi->connect("dbi:mysql:$dbname:$host",$username,$password) or die "$dbh->errstr\n"; you can use do command read in configuration file perl code in it. do 'config.pl';

javascript - Node to parse xml using xml2js -

i trying parse , query element within xml using xml2js. xml string follows: var xml = "<config><test>hello</test><data>somedata</data></config>"; what want extract value in , assign var extracteddata here's have far: var parser = new xml2js.parser(); parser.parsestring(xml, function(err,result){ //extract value data element extracteddata = result['data']; } this not work. can point out how might able grab values xml? thanks this doesn't seem working. can tell me might issue here? it works me var xml2js = require('xml2js'); var xml = "<config><test>hello</test><data>somedata</data></config>"; var extracteddata = ""; var parser = new xml2js.parser(); parser.parsestring(xml, function(err,result){ //extract value data element extracteddata = result['config']['data']; console.log(extracteddata); }); console.log...

php - How to take an action after certain time (different from user to user)? -

i'm developing web game (js php mysql) in 1 clicks button start action takes time complete (let's 10 hours) , when finishes points added player's total.. problem need points added if player not online @ time action finishes.. example need have rankings updated, or email sent player.. i thought cron job checking ending actions, think kill resources (contantly checking against actions of thousands of players..). is there better solution problem? thanks attention!! you can write database when it's finished , when user logs in add earned points account. can check cronjob. if have millions of user this not kill server.

Need to import a python library into a webserver -

i want run python file on webserver uses sqlite3 library, have no idea how install on server. sqlite3 part of python standard library . such, if python installed on application server, use library. seems issue question getting web server use python. dependent upon many different things, beginning on web server. here few starting points: lighttpd apache modwsgi or mod_python nginx

c# - DateTimeOffset to DateTime conversion - Data Loss -

when convert datetimeoffset value datetime value, there possibility data loss. msdn documentation, conversion datetimeoffset datetime mentioned follows: the datetime property commonly used perform datetimeoffset datetime conversion. however, returns datetime value kind property unspecified. means information datetimeoffset value's relationship utc lost conversion when datetime property used. to indicate converted datetime value utc time, can retrieve value of datetimeoffset.utcdatetime property. differs datetime property in 2 ways: it returns datetime value kind property utc. if offset property value not equal timespan.zero, converts time utc. i see following method convert datetime offset datetime: static datetime convertfromdatetimeoffset(datetimeoffset datetime) { if (datetime.offset.equals(timespan.zero)) return datetime.utcdatetime; else if (datetime.offset.equals(timezoneinfo.local.getutcoffset(datetime.datetime))) return datetime....

bash - How to print out the number of lines in an output command -

for example: cat /etc/passwd what easiest way count , display number of lines command outputs? wc unix utility counts characters, words, lines etc. try man wc learn more it. -l option makes print number of lines (and not characters , other stuff). so, wc -l <filename> print number of lines in file <filename> . you asked how count number of lines output command line program in general. that, can use pipes in unix. so, can pipe output of command wc -l . in example, cat /etc/password command line program want count. should do: cat /etc/password | wc -l

jquery - Disable a drop down and still submit a value? -

i have drop down box lock after item has been selected. unfortunately using 'disable' stops field being submitted @ when form submitted. there way around this? you can re-enable dropdown list right before form submitted: $("form").submit(function() { $("#yourdropdown").prop("disabled", false); });

java - What type of connections "RMI TCP Connection(idle)" threads correspond to? -

i'm working on distributed system rmi based using jdk1.6. occasionally can see concurrentmodificationexception errors on thread happening within rmi runtime when fails serialize objects. can reproduce exception concurrently updating object being returned remote method. but problem can't find source of calls. rmi exception written stderr (captured on server side within runtime code after exits remote object method), there no matching exception in client services (while if legitimate remote call, remoteexception appropriate cause raised). the different thing exceptions happening on "rmi tcp connection(idle)" thread , not on thread "rmi tcp connection(<connection count>)-<client endpoint info>". any clues on "idle" threads in rmi? failed find such within openjdk sources. upd: i'm adding exception stack trace reproduced, see in described situation. server side console shows: exception dispatching call [-3534448f:12f...

ios - Why does a CALayer's transform3D's m34 need to be modified before applying the rotate transform? -

the following code can make perspective rotation transform layer: catransform3d transform3dfoo = catransform3didentity; transform3dfoo.m34 = -1.0 / 1000; transform3dfoo = catransform3drotate(transform3dfoo, m_pi / 4, 1, 0, 0); however, if 2 lines reversed: catransform3d transform3dfoo = catransform3didentity; transform3dfoo = catransform3drotate(transform3dfoo, m_pi / 4, 1, 0, 0); transform3dfoo.m34 = -1.0 / 1000; then perspective gone. orthographic (no perspective). familiar perspective know why reason? update: // first identity , transform3dfoo.m34 = -1.0 / 1000; done 1.00000 0.00000 0.00000 0.00000 0.00000 1.00000 0.00000 0.00000 0.00000 0.00000 1.00000 -0.00100 0.00000 0.00000 0.00000 1.00000 // , catransform3drotate(transform3dfoo, m_pi / 4, 1, 0, 0); 1.00000 0.00000 0.00000 0.00000 0.00000 0.70711 0.70711 -0.00071 0.00000 -0.70711 0.70711 -0.00071 0.00000 0.00000...

User interface of desktop application using SWT -

i'm working on desktop application using swt. need make ui , feel skype's interface. can suggest me something? the presentations package allows customization of of swt application. here's general presentation, including lot of links : http://jroller.com/mpermar/date/20050619#eclipse_presentations_jlibrary_and_vs of course you'll have lot of work if don't find existing skin suitable need.

PHP : Retrieving keys using openssl -

i manage generate private / public keys using following script : $res = openssl_pkey_new(array('private_key_bits' => 2048,'private_key_type' => openssl_keytype_rsa)); openssl_pkey_export($res, $privkey); file_put_contents('test.private.key', $privkey); $pubkey = openssl_pkey_get_details($res); $pubkey = $pubkey["key"]; file_put_contents('test.public.key', $pubkey); the generated files : -----begin rsa private key----- miieowibaakcaqeawq5l0jq2g5zghc4udiso6krn/mkrbuulyhrvl9zdve+c9duh 6udtrcc07pvikchvj13vkb4yvrlwccaxhg5p34p3w9vjmri91rdvj31norvj/i5z jnbfy7c8nrioa6m4gicfpbozuqu741jlsncdquyzrradbfwppiz/mlm5wdzk6+nu yam2o0jvdske7i3st+ikjpjuc8me+ronioonthb3gjarsckg5l6e0eagxlvp9mez lssn/z5p1wu3gjq02lnglt5bvgcfe7ajbdzwrdg+mbp4/yct/zxz5xwm2/bxd78c 2wh3qms/bijvq5mtta4e2vqtscxi5fmjruf5qqidaqabaoibaqcvzuxljf3kyjq1 fcasj5vjcz4pomzzzvdqwabir+pz5ed9nflplevdslozdslt5wa5s4bo1el1xd7c ayodq0s+irbldwvf6zv1saxurmoyxstjjcoiponklr7imw44lcnlvvxnj5hgylkx ...

swing - java threading control / concurrent operation -

i have created control in java. allows user download file. user can download list of files @ once. there program must load controls , start @ least 4 of them. want 4 operations run concurrently. far can 1 run @ time. how achieve this? public class download extends java.awt.panel implements runnable i have looked @ threading can mod make thread? or better way? note looked @ threading , confused in c# have used background process. learning java in netbeans ide.

php - Yii Framework, reduce page loading time due to massive data in sql table -

i have table contains more 15k rows of records. i'm pulling out data , displaying in jquery datatable plugin took few minutes display. suggestions how reduce page load time? this how extract data in controller. $model = property::model->with('estates','types','tenures','rooms','districts')->findall(); $this->render('index', compact('models','pages')); use pagination , omit "with", way records eagerly loaded, needed display in cache. give try , you'll see immediate difference.

iphone - How to restrict uilabel to be dragged within a particular frame only? -

i have added 1 label in imageview , added pangesture dragging label.with code label dragged within whole.but want restrict label drag within frame of uiimageview only. how can achieve this? code adding lable , gesture below. lblquote=[[uilabel alloc]init]; lblquote.frame=cgrectmake(130,380, 400,100); lblquote.userinteractionenabled=true; lblquote.backgroundcolor=[uicolor clearcolor]; lblquote.userinteractionenabled=true; lblquote.linebreakmode=uilinebreakmodewordwrap; lblquote.font=[uifont systemfontofsize:40.0]; lblquote.tag=500; lblquote.text=@""; cgsize maximumlabelsize = cgsizemake(296,9999); cgsize expectedlabelsize = [strquote sizewithfont:lblquote.font constrainedtosize:maximumlabelsize linebreakmode:lblquote.linebreakmode]; //adjust label the new height. int noofline...

c# - Unable to cast object of type ,Drawing Item -

how fix problem follow : when drawitem, message error: "unable cast object of type 'system.collections.generic.list`1[mypro.infodialog+mycontact]' type 'mycontact'." c# code @ line number: public class mycontact { public string p_display_name { get; set; } public string p_availability { get; set; } public string p_avatar_image { get; set; } } mycontact fbcontact; private void adddatatolist() { var fblist = new list<mycontact>(); foreach (dynamic item in result.data) { fbcontact = new mycontact() { p_display_name = (string)item["name"], p_availability = (string)item["online_presence"]}; fblist.add(fbcontact); listbox1.items.add(fblist); } } private int mouseindex = -1; private void listbox1_drawitem(object sender, drawitemeventargs e) { if (e.index == -1) return; line number: mycontact contact = (mycontact)listbox1.items[e.index]; ...

phpinfo - php.ini variable not set throgh htacess -

which php.ini variables can not set through phpfiles or htaccess. means if want set variable have directly configure @ php server files. can give me list of variables name ? in advance. http://php.net/manual/en/ini.list.php check "changeable" column

ios - Why to store username and password in Keychain in iPhone app -

i have worked nsuserdefault keychain concept totally new me. i have tried looking similar questions couldn't find exact reason so. what have done: i know how store data in nsuserdefault . , reason why need store it. regarding keychain know storing in keychain stores data security encoding original text while nsuserdefault stores data plain text. , stores data after application removed. is reason storing data in keychain? edit: got this link says have said. keychain data more secure in comparision of nsuserdefault. , keychain data in device after remove application device. more keychain wrapper read this.

c - What files does setlocale() use? -

compiling on shared centos server not allowed. therefore, compile program in debian computer, linking debian's system libraries such libc, etc. upload program , debian system libraries , program works. problem setlocale() not work @ centos. centos has "en_us.utf8" installed , works on programs except mine. suspect have upload debian's locale files ? how link program debian locale files ? tried use locpath unsure of how works exactly. files have link , how ? c program: setenv("locpath", "/", 1); if (setlocale(lc_all, "en_us.utf8") == null) { puts("not set"); } quote: locpath environment variable tells setlocale() function name of directory load locale object files. if locpath not defined, default directory /usr/lib/nls/locale searched. locpath similar path environment variable; contains list of z/os unix directories separated colons. so specifying / , hoping recursive search not work. you produce static...

return undefined value in jquery function -

i use code calculate distance between 2 gps positions. problem when return calculated value returns undefined value. please me function calcdistane(offerid,userlocation){ var dist; var adapter = new locationadapter(); adapter.selectbyofferid(offerid,function(res){ navigator.geolocation.getcurrentposition(function(position){ var r = 6371; var userlocation= position.coords; dist= math.acos(math.sin(userlocation.latitude)*math.sin(res.item(0).lt) + math.cos(userlocation.latitude)*math.cos(res.item(0).lt) * math.cos(userlocation.longitude-res.item(0).lg)) * r; }); }); return dist; }; dist isn't set yet when return. function setting dist callback. called after return outer (callback) function. the order of execution is adapter.selectbyofferid return dist (undefined) call anonymous function used callback adapter.selectbyofferid call navigator.geolocat...

version control - Running Android Marketplace Crawler ('hg' directory?) -

i'm having trouble figuring out how run android marketplace crawler here: http://code.google.com/p/android-marketplace-crawler/ i think don't understand how crawler supposed operate -- first of all, source -- http://code.google.com/p/android-marketplace-crawler/source/checkout -- says can create local copy of crawler command hg clone https://code.google.com/p/android-marketplace-crawler/ how supposed run command? thanks. the hg command distributed version control system called mercurial . first install mercurial command-line utility , run given command shell (terminal on os x). check out copy of source code android-marketplace-crawler current working directory.

Apache ErrorDocument External Redirect with Variables -

is possible in apache ... (i.e. redirect external url path causing 403 error passed along) errordocument 403 http://www.sample.com/{{redirect_url}} i create /publication directory, want served main index.php there file in directory. /publication?page=1 served /index.php, /publication/file.pdf file residing in directory. apache returend 403 error since /publication directory has no permission listed. whe redirect 403 error /index.php cant catch variables. think redirect_query_string variable can used mess php classes. i changed mod_rewrite config catch directory serving, see '#', removed errordocument 403 directive, since no need. <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f # rewritecond %{request_filename} !-d rewritecond %{request_uri} !=/favicon.ico rewriterule ^(.*)$ index.php?path=$1 [l,qsa] </ifmodule> what have /publication > /index.php?path=publication /publication/?page=1 > /inde...

add layered navigation to magento tag page -

for tag page, mean kind of page: http://demo.magentocommerce.com/tag/product/list/tagid/448/ i have add following code mytheme/layout/tag.xml after line <label>tagged products list</label> //code added <reference name="left"> <block type="catalog/layer_view" name="catalog.leftnav" before="-" template="catalog/layer/view.phtml"/> </reference> but layered navigation not show. answers.

windows 7 - How to recover OpenGL buffers after minimization? -

assume made application uses sdl + opengl display graphics. scene not dynamic drawing , swapping of buffers once in while. i observed after minimization , bringing of window under windows 7 displayed content gets destroyed , random stuff displayed. there way can recover without repeating last rendering? i'm using windows 7 proffesional sp1 intel g45/g43 express chipset. you copy texture (with glcopytexsubimage2d ), , render texture when need display stuff. or render texture begin via fbos. but there no automatic way recover image data. really, it'd easier re-render display when restored. may have same problem if window overlaps display.

Protecting against SQL injection in python -

i have code in python sets char(80) value in sqlite db. the string obtained directly user through text input field , sent server post method in json structure. on server side pass string method calling sql update operation. it works, i'm aware not safe @ all. i expect client side unsafe anyway, protection put on server side. can secure update operation agains sql injection ? a function "quote" text can't confuse sql parser i'm looking for. expect such function exist couldn't find it. edit: here current code setting char field name label: def setlabel( self, userid, refid, label ): self._db.cursor().execute( """ update items set label = ? userid ? , refid ?""", ( label, userid, refid) ) self._db.commit() from documentation: con.execute("insert person(firstname) values (?)", ("joe",)) this escapes "joe" , want is con.execute("insert person(firstname...

mercurial - How do I back out of a backout? -

i've committed whole load of files didn't mean to, , backed out. realising i've removed changes, updated revision "committed files" before backout. can re-commit them changed files. is possible backout of backout? if have mqextension installed, can hg strip commits don't want, although should if haven't yet pushed them. easier , tidier trying commit series of backouts want be.

recursion - php category recursive hierarchy -

i have category hierarchy this. 721 parent 235 235 parent 201 201 parent 1 1 parent 0 0 root category id, trying build function input leaf id 721, full path id of 721, 235, 201, 1 public function getpath($inputid = 0, $idlist=array()) { $sql ="select * hierarchy id='{$inputid}'"; $result = $this->db->fetchall($sql); if($result){ $currentid = $result[0]["id"]; $parentid = $result[0]["parent_id"]; $idlist[] = $currentid; if ($parentid !=0){ $this->getpath($parentid, $idlist); }else{ //var_dump($idlist); return $idlist; } } } i can see correct results in var_dump part above, when use function class, return null, $data = $whatevehelper->getpath('721'); could help? thanks you need change this: if ($parentid !=0){ $this->getpath($parentid, $idlist); } to this: if ($parentid !=0){ ...

c# - Is there a way to set the BackColor of Winforms ListView cells individually? -

Image
i want color each list view cell's backcolor using different color. possible? to change colour of cell's backcolor , can this: listview1.items[0].useitemstyleforsubitems = false; listview1.items[0].subitems[0].backcolor = color.green; listview1.items[0].subitems[1].backcolor = color.orange; listview1.items[0].subitems[2].backcolor = color.red; // change 0 in items[0] whatever row want, // , 0, 1 or 2 in subitems[0] whatever column want. the first line, listview1.items[0].useitemstyleforsubitems = false; will make row of cells not coloured same colour. here demo picture: hope helps!

python - Problems with navigablestrings and unicode in BeautifulSoup -

i having problems navigablestrings , unicode in beautifulsoup (python). basically, parsing 4 results pages youtube, , putting top result's extension (end of url after youtube.com/watch?=) list. i loop list in 2 other functions, on one, throws error: typeerror: 'navigablestring' object not callable . however, other 1 says typeerror: 'unicode' object not callable . both using same exact string. what doing wrong here? know parsing code not perfect, i'm using both beautifulsoup , regex. in past whenever navigablestring errors, have thrown in ".encode('ascii', 'ignore') or str(), , has seemed work. appreciated! url in urls: response = urllib2.urlopen(url) html = response.read() soup = beautifulsoup(html) link_data = soup.findall("a", {"class":"yt-uix-tile-link result-item-translation-title"})[0] ext = re.findall('href="/(.*)">', str(link_dat...

symfony - unique slugs with multi entities in symfony2 -

i have small symfony2 application user can create pages. each page should accessible via route /{user_slug}/{page_slug}. have entities user , page , use sluggable behavior both entities. in order find correct page combination of user_slug , page_slug has unique. what best way check combination of user_slug , page_slug uniqe? try in prepository: public function findbyusernameandslug($username, $slug) { $em = $this->getentitymanager(); $query = $em->createquery(" select g acme\pagesbundle\entity\page p join p.owner u u.username = :username , p.slug = :slug ") ->setparameter('username', $username) ->setparameter('slug', $slug); foreach ($query->getresult() $goal) { return $goal; } return null; }

generics - Why ForEach extension method is not available in ObservableCollections in C# -

possible duplicate: why there not foreach extension method on ienumerable interface? why foreach extension method not available in observablecollections class while available in list ? as jjohn says, it's design. read this post eric lippert more information. standard foreach loop works , more readable.

find/search div id's and classes throughout the website using google chrome developer tools -

i'm in process of writing comments in style sheet i'm going through style sheet line line instance have style called #main , i'm searching in tools using the search facility searches in current page not pages , there way can search whole site instances.. or there other tool can use ? find in sources ctrl-shift-f on windows , cmd-opt-f on mac. link a few resources leveling chrome dev tools game: addy osmani on google plus. link the breakpoint googledevelopers videos link chrome canary - jump on chromes new features link

coding style - Multiple PHP tags -

this general php question. or hurt have multiple <?php code ?> in scripts? i looking @ of scripts , noticed of them have 3-4 in it. dont know if causing slowness on site or not :) no, it's not causing slowness or problems. it's common have dozens or hundreds of separate <?php ?> blocks in templates.

jquery - Scroll position lost when hiding div -

http://jsfiddle.net/cbp4n/16/ if show div. change scroll position , hide , show agian scroll position lost. am doing wrong or bug. there way round som plugins. /anders thanks answers , solutions. if div hide outer div , scrolling div deep inside div hide. there smart way fix this. becuse cant set/save scroll position in callback of hide/show jquery's .scrolltop() works if maintain position data. $('#cbxshowhide').click(function(){ if(this.checked) { $('#block').show('fast',function() { $(this).scrolltop($(this).data('scroll')); }); } else { $('#block').data('scroll',$('#block').scrolltop()); $('#block').hide('fast'); } }); example

Structuring Azure solution with multiple roles -

i'm curious how others have structured (or suggest structuring) azure applications have multiple roles. in particular i'm curious how have them broken our between subscriptions , hosted services. in particular case have web role hosting webapp & api. changes quickly, multiple times per day. have several different worker roles things video processing, email sending, , reporting/analytics. workers change rarely, less once month. have running in single subscription. each role in own hosted service. this setup lets deploy 1 role without affecting others. avoids interrupting worker roles unnecessarily, since in middle of long (10+ minute) processing jobs have restarted. so how guys it? part of reason ask microsoft seems want put single hosted service. eg, new caching function that's in preview visible within single hosted service, makes useless layout have. this bit of opinion, think have right of it. there advantages deploying single package roles (ato...

.net - The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty -

so yesterday installed php , mysql on development machine. since following error when trying run 1 of .net projects: the connection name 'localsqlserver' not found in applications configuration or connection string empty. it references line of machine.config: <add name="aspnetsqlroleprovider" connectionstringname="localsqlserver" applicationname="/" type="system.web.security.sqlroleprovider, system.web, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" /> i have searched online, high , low , can confirm machine.config has necessary connection string: <connectionstrings> <add name="localsqlserver" connectionstring="data source=.\sqlexpress;integrated security=sspi;attachdbfilename=|datadirectory|aspnetdb.mdf;user instance=true" providername="system.data.sqlclient" /> <add name="localmysqlserver" connectionstring="" /> interestingl...

java - Is it possible to return or somehow access the data from "courses" from this method? -

i'm working on first programming assignment java , had question. put course[] inside of student[] seem encountering nullpointerexception error , can't figure out why. public student[] analyzedata() { scanner inputstream = null; try { inputstream = new scanner(new fileinputstream("programming assignment 1 data.txt")); } catch (filenotfoundexception e) { system.out.println("file programming assignment 1 data.txt not found or opened."); system.exit(0); } int numberofstudents = inputstream.nextint(); int tuitionperhour = inputstream.nextint(); student[] students = new student[numberofstudents]; (int = 0; < numberofstudents; i++) { string firstname = inputstream.next(); string lastname = inputstream.next(); int studentid = inputstream.nextint(); string istuitionpaid = inputstream.next(); int numberofcourses = inputstream.nextint(); course[] course...

extjs4 - ExtJs 4 File upload with RESTEasy 2.3.0.GA , Invalid JSON response -

there lot of discussion topic no real solution. here problem if use 1) @produce("application/json") json response show in <pre> tag 2) if use @produce("application/html") or @produce("text/html"),then resteasy breakdown , error out jaxb exception : uncaught ext.error: you're trying decode invalid json string: http status 500 - not find jaxbcontextfinder media type: text/html type status report message not find jaxbcontextfinder media type: text/html description server encountered internal error (could not find jaxbcontextfinder media type: text/html) prevented fulfilling request. jboss web/3.0.0-cr2 i desperate , there solution suggested in forms: 1) change contect type text/html 2) update extjs source code 3) parse <pre> tag in fron the json response don't want 2nd , 3rd in ist want valid json output. how can ? here is serverice class: @post @path("/bulkupdate") @consumes("multipart/form-...

dataframe - How can I create a transitions column in R -

i have state column in dataframe , want create 2 new columns: 1 looks ahead next stage change , 1 looks previous state change. resulting dataframe below: state coming previous a-b na a-b na a-b na a-b na b b-c a-b b b-c a-b b b-c a-b c c-a b-c c c-a b-c c c-a b-c na c-a na c-a or maybe better, create 2 transition columns: state trans1 trans2 a-b na a-b na a-b na a-b na b a-b b-c b a-b b-c b a-b b-c c c-a b-c c c-a b-c c c-a b-c c-a na c-a na [edit] changed states named "1" "c" because confusing let's give dataframe name, 'inp'. use rle function construct sequence of "states": > rle(inp$state) run length encoding lengths: int [1:4] 4 3 3 2 values : chr [1:4] "a...

ios - AVPlayer Progress slider change with user dragging it -

i using avplayer, , working good. i put slider , progression according player duration. want if user drags slider play time changes accordingly. i.e. song forwards or backwards according slider position. i have tried -(ibaction)sliderchange:(id)sender{ [player pause]; cmtime t = cmtimemake(slider.value,1); [player seektotime:t]; [player play]; } but again takes slider starting point. appreciated. edit (working below link) avplayer video seektotime -(ibaction) valuechangeslidertimer:(id)sender{ [avplayer pause]; isplaying = false; [btnpauseandplay settitle:@"play" forstate:uicontrolstatenormal]; float timeinsecond = slidertimer.value; timeinsecond *= 1000; cmtime cmtime = cmtimemake(timeinsecond, 1000); [avplayer seektotime:cmtime tolerancebefore:kcmtimezero toleranceafter:kcmtimezero]; } edited code . and try link : try link

How to create wrapper holding of multiple properties in c# -

i want wrapper whether class or list type, hold multiple properties. want store values of properties , retrieve later. created class , doing operations below. internal class dependencies { public string issueid; public int dependencycheck; public string jirastatus; public dependencies() { this.issueid = string.empty; this.dependencycheck = 0; this.jirastatus = string.empty; } //calling function. preapreissueslist(issuekey, jiratoken); private static void preapreissueslist(string issuekey,string jiratoken) { dependencies dependeant = new dependencies(); if (!dependeant.issueid.contains(issuekey)) { dependeant.issueid = issuekey; jirasoapserviceservice jira = new jirasoapserviceservice(); remoteissue ri = jira.getissue(jiratoken, (issuekey).tostring()); dependeant.jirastatus = enum...

java ee - @Named + @RequestScoped not working in JSF 2.0 with JBoss 7.1.1 -

i have working @managedbean i'd substitute @named + @requestscoped bean. // before @managedbean public class login { ... } // after import javax.enterprise.context.requestscoped; @named @requestscoped public class login { ... } everything works fine long use @managedbean . @named without @requestscoped works creates new instance each el-expression. @named + @requestscoped yields exception: unable add request scoped cache item when request cache not active java.lang.illegalstateexception: unable add request scoped cache item when request cache not active @ org.jboss.weld.context.cache.requestscopedbeancache.additem(requestscopedbeancache.java:51) @ de.prosis.dafe.presentation.login$proxy$_$$_weldclientproxy.getusername(login$proxy$_$$_weldclientproxy.java) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.inv...

c# - Best .net open source ntier distributed sample projects or sample applications -

i've been away quite while . , looking modern open source samples , applications based on.net , have ntier architecture . i aware of old enterprise distributed application developed microsoft , called duwamish . but know there plenty of open source applications, u please suggest , introduce useful of them . in advance. i'm going give bad examples, instance http://microsoftnlayerapp.codeplex.com/ it's bad ddd example, can see 1 , others reviewed on following site http://ayende.com/blog/19457/review-microsoft-n-layer-app-sample-part-i the thing business software can done simple crud 2-layer approach, mindlessly implementing design patterns find in book not hard/clever/awesome best thing keep things simple possible read ayende's review of some of these ddd frameworks not make mistake of overdesigning architecture also when doing simple 2-layer crud, use simple orm dapper or bltoolkit or need automatic entity tracking? btw seeing link nddd projec...

In Linux, how do I find find directory with the most subdirectories or files? -

how can find directory largest number of files/subdirectories in on system? clever answer / , that's not i'm looking for. i’ve been told filesystem out of nodes, suspect somewhere there lot of files/directories garbage, , want find them. i’ve tried running this: $ find /home/user -type d -print | wc -l to find specific directories. starting current directory, try find . -type d | cut -d/ -f 2 | uniq -c this list directories starting current one, split each line character "/", select field number "2" (each line starts "./", first field ".") , outputs unique lines, , count how unique line appears (-c parameter). you add "sort -g" @ end.

algorithm - find all rectangular areas with certain properties in a matrix -

Image
given n*m matrix possible values of 1, 2 , null: . . . . . 1 . . . 1 . . . . . 1 . . . 2 . . . . . . . . 2 . . . 1 . . . . . 1 . . . . . . . . . . . 1 . . 2 . . 2 . . . . . . 1 i looking blocks b (containing values between (x0,y0) , (x1,y1)) that: contain @ least 1 '1' contain no '2' are not subset of block above properties example: the red, green , blue area contain '1', no '2', , not part of larger area. there of course more 3 such blocks in picture. want find these blocks. what fast way find these areas? i have working brute-force solution, iterating on possible rectangles, checking if fulfill first 2 criteria; iterating on found rectangles, removing rectangles contained in rectangle; , can speed first removing consecutive identical rows , columns. there faster way. you can somewhere between considering every rectangle, , clever solution. for example, starting @ each 1 create rectangle , gradually e...

How do Salesforce validations fail on existing records? -

imagine have 2 checkbox fields in account: "not programmer" , "programs java" i can set validation rule error condition formula of: and( not_a_programmer__c = true, programs_java__c = true ) this rule won't allow me save record if both boxes checked. but happens existing records, have both boxes checked? how error thrown, , how reported on? i'm asking here instead of testing out because have access live environment. validation rules execute when record saved (inserted, updated, upserted). see order of execution (#4) document details. if want validate existing records, best method doing running report filter fields or use scheduled batch job log errors.

c# - BehaviourSubject and CombineLatest - Weird behaviour -

given following code. eventloopscheduler scheduler = new eventloopscheduler(ts => new thread(ts)); behaviorsubject<int> subject = new behaviorsubject<int>(0); subject .observeon(scheduler) .combinelatest(observable.interval(timespan.fromseconds(1), scheduler), (x, y) => x) .subscribe(x => debug.writeline(x)); subject.onnext(1); why print? 0 1 0 1 0 1 ... instead of: 0 1 1 1 1 1 ... first of output looks strange. both of them. guess output should be: 1 1 1 1 1 without 0 . because of first interval value produced in 1 second - after call subject.onnext(1); the other strage thing behavioursubject<int> - uk version of behaviorsubject(of t) ? :) if have own behavioursubject implementation, please extend question it.

ruby on rails - Selenium doesn't open firefox -

when run test using cucumber , selenium, browser "firefox" opened first time run test. each time run test, fails error "execution expired (timeout::error)" i'm on ubuntu 12.04, ruby 1.8.7 , rails 2.3.5. gem list : capybara (1.1.2) cucumber (1.2.0) cucumber-rails (0.3.2) selenium-client (1.2.18) selenium-webdriver (2.21.1) webrat (0.7.3) i had same issue. don't know reason installing gem launchy solved it. check out if helpful https://github.com/copiousfreetime/launchy

jquery - knockoutjs single and double click -

i want able bind single , double click event span of text. know can use data-bind ="event: { dblclick: dosomething } for double click, need ability perform different function on single click. suggestions? first, wouldn't recommend click binding @ all. instead should use "click" , "dblclick" handlers jquery: $(someparentelement).on('click', 'your span selector', function (event) { var myviewmodelfragment = ko.datafor(this); // code here }); $(someparentelement).on('dblclick', 'your span selector', function (event) { var myviewmodelfragment = ko.datafor(this); // code here }); edit: see niko's suggestion regarding supporting both single , double clicks. basically, you should count number of clicks manually , call different functions accordingly. assumed jquery handles but, unfortunately, doesn't.

android - setRotation(90) to take picture in portrait mode does not work on samsung devices -

according documentation, setrotation(90) should rotate captured jpeg picture ( takepicture in landscape mode. this works fine on htc phone, not work on samsung google nexus s , samsung galaxy s3. bug? i know can use matrix transform rotation, wish os can more efficiently, , don't want risk over-rotating on other devices. edit setting camera.setdisplayorientation(90); made preview in portrait mode, did not have affect on picture taken. further, besides setrotation , have tried set picture size - flip h w : parameters.setpicturesize(1200, 1600); . did not have affect. solution apparently samsung phones set exif orientation tag, rather rotating individual pixels. ariefbayu suggested, reading bitmap using bitmapfactory not support tag. code sample solution, , solution compatible using insamplesize . i try answer in relation exif tag. did: bitmap realimage = bitmapfactory.decodestream(stream); exifinterface exif=new exifinterface(getrealpathfromuri(im...

backbone.js - How should I bootstrap my web app? -

i looking best way bootstrap web app using backbone.marionette , backbone.router , requirejs . following implementation works know if right way make things. here's of code (*). my questions are: 1) right following data flow ( index.html -> conf.js -> router.js -> app.js ) ? 2) backbone.view each region ( header , sidebar .....) should instantiate in router.js or app.js or booths according context? // index.html <!doctype html> <html lang="en"> <head> <!-- load script "/js/conf.js" our entry point --> <script data-main="js/conf" src="js/vendor/require.js"></script> </head> <body> </body> // js/config.js require.config({ // code }); require(['app']); // instead of require(['conf']); // router.js define([ 'app', // others modules ], function(app, $, _, backbone, marionette){ ...

php - How to add the namespace to all elements that get returned WSDL / SOAP -

i'm new soap , wsdl world. have do, make sure namespace in return-element? <?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://someurl.com"> <soap-env:body> <ns1:sayhelloresponse> <return>say hello kelvin</return> </ns1:sayhelloresponse> </soap-env:body> </soap-env:envelope> what want is: <ns1:sayhelloresponse> <ns1:return>say hello kelvin</ns1:return> </ns1:sayhelloresponse> i'm using php , zend framework. wsdl gets generated zend_soap_autodiscovery . shouldn't barrier though, because modify output of anyways. thanks help. after taking break while, approached problem once again. time though, stumbled upon nice article (credits former co-worker mike). if attribute elementformdefault isn't declared in schema t...

java - Wrong picture on FB Wall, feed post from android app (android FB sdk) -

i have problem feed post picture, decided change our (android native) fb app icon, changed icon @ occurrences in fb app settings, , changed picture on ftp server(on refferenced when posting feed app). but when post feed app (in feed dialog there correct picture), on wall in browser there wrong(old) picture, weird when check wall katana(facebook android app), there correct picture. size of picture 512x512 , it's png format. i'm talking picture besides feed (not small icon under feed) sample of feed post: ... bundle parameters = new bundle(); parameters.putstring("picture", path_tou_our_icon_on_ftp_server_in_png_fromat); parameters.putstring("name", facebookmsgname); parameters.putstring("caption", facebookmsgcaption); parameters.putstring("description", facebook_message); parameters.putstring("link", "http://bit.ly/...."); facebook.dialog(minstance, "feed", parameters,.... add "?cache=...

java - Alternative method for Android push notification -

is there alternative using google c2dm push notifications android? ask because app i'm working on run when device connected specific network. it's app members of specific company , notifications come companies server. since "in-house" make sense push them google have them come same network? i've heard jms. know if work? there options. played urbanairship bit , seems nice. check out http://urbanairship.com/

.net - WCF Dispose() Not Called With InstanceContectMode = PerSession -

in persession how dispose() on service fire? in code below dispose() not called. neither when call .close() nor if let session time out. if change service percall dispose() called (with each method call). persession getting session (tested servicestarttime). service [servicebehavior (instancecontextmode=instancecontextmode.persession)] public class magiceightballservice : ieightball, idisposable { private datetime servicestarttime; public void dispose() { console.writeline("eightball dispose ... " + operationcontext.current.sessionid.tostring()); } public magiceightballservice() { servicestarttime = datetime.now; console.writeline("eightball awaits question " + operationcontext.current.sessionid.tostring() + " " + servicestarttime.tolongtimestring()); } public string obtainanswertoquestion(string userquestion) { return "maybe " + operationcontext.current.sessionid....

Update JavaFX 2 GUI at intervals? -

i've spent last 24 hours trying learn javafx. i'm trying build gui display values data source (for example database). question preferred way this. far i've come code build simple gui , data data source: import javafx.application.application; import javafx.application.platform; import javafx.scene.group; import javafx.scene.scene; import javafx.scene.text.text; import javafx.stage.stage; public class avchmi extends application { public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) { text t = new text(10, 50, "replace/update text periodically data"); group root = new group(); root.getchildren().add(t); primarystage.setscene(new scene(root, 400, 300)); primarystage.show(); new thread() { private datasource datasource = new datasource(); { setdaemon(true); } @override public vo...