Posts

Showing posts from April, 2011

ios - How to scroll storyboard in XCode while Ctrl key pressed -

Image
i'am developing application on macbook pro lot of view controllers in storyboard. screen resolution not big, , need scroll editor, while dragging segues (with ctrl key pressed). with apple mouse impossible. how can it? thanks. the way when i'm developing on small macbook use window on left shows view hierarchy. way don't have use actual storyboard, , can control drag between of components...

How to check for existing Quartz.net schedulers? -

recently upgraded embedded quartz.net scheduler 2.x @ point had give on giving 0 thread schedulers unique names , have problem (very rarely) object trying create instance of zt scheduler throws exception because object has instance of zt scheduler instantiated , since zt schedulers have default 'quartzscheduler' name throws exception... i tried checking scheduler count using myschedfactory.allschedulers.count after calling myschedfactory = new stdschedulerfactory(properties) stdschedulerfactory creates instance of zt scheduler it's instantiated , not when getscheduler() method called dead end... i not find other way of checking existing schedulers before instantiating stdschedulerfactory and, mentioned already, instantiated, creates instance of zt scheduler ended using while loop in catch block horrible solution i'm hoping knows better way of checking existing zt schedulers... try { //setting properties

Javascript Object to Java List -

i have following type of json want send java (i'm using jersey , default json parser comes with) { "something" : "1", "someotherthing" : "2" , ... } but instead of creating object these properties in java, have single hashmap (or whatever) allow me still have access key , value is such thing possible? i don't have code transformation, use jersey this @post @path("/purchase") @produces(mediatype.application_json) @consumes(mediatype.application_json) public statusresult purchase(userpurchaserequest upr) { } if put properties , someotherthing strings in userpurchaserequest object, come in fine, want have in 1 structure (because don't know how many values get, , need names well) yes, possible. still, depends on json java api using. example using jackson json can create hashmap json string this objectmapper obj = new objectmapper(); string json = pbj.writevalue(<hash

multithreading - Thread safe Increment in C# -

i trying increment element in list in c#, need thread safe, count not affected. i know can integers: interlocked.increment(ref sdmpobjectlist1count); but not work on list have following far: lock (padlock) { differencelist[diff[d].propertyname] = differencelist[diff[d].propertyname] + 1; } i know works, i'm not sure if there way this? as david heffernan said, concurrentdictionary should provider better performance. but, performance gain might negligible depending upon how multiple threads try access cache. using system; using system.collections.concurrent; using system.threading; namespace concurrentcollections { class program { static void main() { var cache = new concurrentdictionary<string, int>(); (int threadid = 0; threadid < 2; threadid++) { new thread( () => { while (true)

ruby on rails 3 - Logged out users are seeing error message "undefined method `leads' for nil:NilClass" -

i made simple app lets users track sales leads. works except home page logged out users, error message - undefined method `leads' nil:nilclass. the index in leads controller: def index @leads = current_user.leads.all respond_to |format| format.html # index.html.erb format.json { render json: @leads } end end the homepage: <% if user_signed_in? %> <div class="row"> <div class="span3"> <h2>leads</h2> </div> <div class="pull-right"> <%= link_to 'add new lead', new_lead_path, class: 'btn btn-primary' %> </div> </div> <div> <table id="leads" class="display"> <thead> <tr> <th>company</th> <th>contact</th> <th>phone</th> <th class="hidden-tablet hidden-phone hidden-desktop-small"&

php - is it possible to open RSS feed links from other sites within my site? -

i wandering if possible open rss feed link other sites within same site rss feed displayed on? for example: i rss feed sky sport , display images, title , link on own website... when clicks on link rss feed, pointed sky sport page news. now, wandering if possible open news page within own site instead of pointing users/readers sky's website? i don't know maybe using iframe? this how rss feed: <?php $rss = simplexml_load_file('http://www.fifa.com/rss/index.xml'); $limit = 1; // change number many items want display $counter = 1; if($rss) { $items = $rss->channel->item; } ?> <?php $rss = simplexml_load_file('http://www.skysports.com/rss/0,20514,12010,00.xml'); $limit = 1; // change number many items want display $counter = 1; if($rss) { $items = $rss->channel->item; } foreach ($rss->channel->item $item) { if($counter <= $limit) { echo "<div style='border: solid #0c0 1px; width:150px; height:100px;'

jython - Rank within Groups in Pig 11 -

pig question, i have data setup following way. function group home name rent mx 1 john rent mx 1 jake rent mx 1 pat rent dg 2 jason rent dg 6 patrick rent dg 6 smith rent dg 6 joe what want group function,group , home , rank within group. function group home name rank rent mx 1 john 1 rent mx 1 jake 2 rent mx 1 pat 3 rent dg 6 patrick 1 rent dg 6 smith 2 rent dg 6 joe 3 the rank function in pig not allow me rank within group.any suggestions? jython udf ? check out enumerate udf in datafu, you. http://datafu.incubator.apache.org/docs/datafu/1.1.0/datafu/pig/bags/enumerate.html

php - Mod_Rewrite URL -

current url: http://localhost/blog/profile.php?username=username&page_type=following i want be: http://localhost/blog/profile/username/following current .htaccess: rewriteengine on checkcaseonly on checkspelling on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l rewriterule ^profile/(.*)$ /blog/profile.php?username=$1&page_type=$2 [qsa,l] is possible rewrite way? or there better way? you need 2 capture groups: rewriterule ^profile/(.*?)/(.*)$ /blog/profile.php?username=$1&page_type=$2 [qsa,l]

c - Void * parameter address shift -

i using codewarrior 8.3 (ide version 5.9) program 56f8367 dsc. i using respected third party software, imagine know doing , don't want mess code much, playing around passing void * parameters , not totally familiar with. so have function: static void t_callback _transmit( void *pcontext, tx_data *ptxdescriptor) { context *plinkcontext = (context *)pcontext; ... } which being called through function pointer. when stop processor before function call, can see address pointed pcontext 0x1000, after cast here, address pointed plinkcontext 0x0800. this, causes problems because start writing , reading different part of memory. there weird going on byte addressing/alignment getting "shifted" on 1 bit. see going wrong, don't understand why or, more importantly, how solve problem. what should looking for? (editing add call per comment request) - although, i'm not sure how considering buried in structures , being called through function pointer.

java - How to apply a res/color/xml style to a button created dynamically -

i have xml file, res/color/btn_black allows me apply gradient buttons. i can use in layout.xml calling: <button android:background="@color/btn_black" /> elsewhere, creating buttons dynamically in java, , want apply same style. when try using: mybutton.setbackgroundcolor(getresources().getcolor(r.color.btn_black)); i error: android.content.res.resources$notfoundexception: file res/color/btn_black.xml color state list resource id #0x7f040001 this seems correct method other questions i've found answered here, isn't working me. doing wrong? edit: file btn_black.xml reference <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape> <solid android:color="#343434" /> <stroke android:width="1dp" android:color="#171717" /> <corners

javascript - Is it possible to nest one (or more) layout(s) within another, different layout(s) in d3? -

i'm trying build force-directed layout, wherein connected nodes have own internal layout not recursive force-directed layout (which, believe, possible hierarchy layout). "inner" layout custom, but, illustration let's wanted nodes, internally, have partition layout. possible? my question twofold: can pull off having more 1 style of layout (for instance, bubble graph inside force-directed graph) in sensible way d3, or d3 wrong tool such thing, and can use d3 layouts each of these layouts, or have custom. in end, design changed, , no longer called odd scenario. being more familiar d3, though, think can answer. yes. can done. each layout own discrete object, own data on work, , can given own dom elements populate. creating 2 layouts shared same data , dom outputs work, if manage interaction between 2 (making sure 1 overrode changes other when desired). what know can sure manually manipulate anything d3 doing. @ 1 point during development, actual

Set Based SQL Server sp_send_dbmail Stored Procedure call for a ResultSet of multiple rows -

hello stackoverflow community! i have query have found difficult find answer in forms. i have simple stored procedure: create procedure [dbo].[spsendemail] @to nvarchar(100), @subject nvarchar(200), @body nvarchar(max), @fileattachments nvarchar(max) = null begin exec [msdb].[dbo].sp_send_dbmail @profile_name= 'test mail', @recipients=@to, @subject=@subject, @body=@body, @body_format = 'html', @file_attachments= @fileattachments end i want call result set query each row passing in paramaters required, i.e. @to a simplified version of result set query, returning 4 columns: set rowcount 0 select s.email_address, s.date,s.code,s.description #tempmydetails contactinfo s from table doing following: declare @subject nvarchar(200) set @subject = 'my email' declare @sql nvarchar(max); set @sql = n''; select @sql = @sql + ' exec spsendemail ''' + t.email_address + '''' + '

ruby - Conditionally render partials in application layout -

in rails 3 application layout include partial flash messages. while ok in cases, there view need flash messages appear in place; there way in layouts/application.html.erb <%= render 'layout/messages' unless somecondition %> where somecondition able detect in 'myview/index'? sure is, use params[:controller] , params[:action] should use controller_name , action_name per rails documentation <%= render 'layout/messages' if controller_name == 'myview' && action_name == 'index' %>

android layout with dynamic content? -

hi sorry searched didnt find best answer use :( here description: have android project in there 55 activities 55 layouts .(each activity has layout) . many of these activities have same style , mean contents change (for example 1 of them has picture of fish , 1 has picture of lion , on) edit: have included picture matter more exact want do: http://i45.tinypic.com/biqmv8.png so here question: how can create app less xml layouts? there way have dynamic contents? if please me or show me required tutorial achieve end? thanks. you can have generic layout dynamically filled generic activity receiving image url or resourceid in parameter

sqlplus - SQL AVG function: -

what avg columns null values if compute avg on column? compute average considering null zeroes or computes average excluding null values? can creating demo table, i'm in hurry , need quick answers. whole assignment revolving around point. see here: "null values ignored" http://msdn.microsoft.com/en-us/library/ms177677.aspx if want make sure not averaging null , not want research, add on where mycolumn not null

css - How to print on a specific paper -

Image
i'm having problems printing text on a4 paper has 24 labels. basically, in every row there 3 labels in comes name, surname , adress of person , label used mails ( it's sticky label sticked on mail). so paper. characteristics: there 10 rows . the first , last row smallest , have height:0.5mm; . in first , last row there no cells. all rest rows have height:36mm; . all cells have width:70mm; , height:36mm; . in every cell comes text text-align:center; , vertical-align:middle; . i'm using normalize.css css reset . css html,body,table{ width: 100%; height: 100%; } .first, .last{ width: 100%; height: 5mm; } .row{ width: 100%; height: 36mm; } .cell{ width: 70mm; height: 36mm; text-align: center; vertical-align: middle; } i'm using chrome , turned off margins on printing. but still, last 2 rows printed on next page . need 10 rows on same page , position fixed ( doesn't shift ) in case if there multiple pages.

java - Audio Player Worked, Now it Doesn't -

i modified audio player , posted new (and not duplicate) question here: bigclip won't play .wav file i wrote audio player, , worked, doesn't. here's code: package me.pogostick29.audiorpg.audio; import java.applet.applet; import java.applet.audioclip; import java.io.file; import java.net.malformedurlexception; public class audioplayer { private audioplayer() { } private static audioplayer instance = new audioplayer(); public static audioplayer getinstance() { return instance; } public void play(string name) { audioclip clip = null; try { clip = applet.newaudioclip(new file("audio/" + name + ".wav").touri().tourl()); } catch (malformedurlexception e) { e.printstacktrace(); } clip.play(); } public void playdialogue(string character, string name) { play("people/" + character + "/" + name); } } however, when try play audio file located here ( h

php - Redirect to subdirectory only if not only in that subdirectory -

i facing (probably) quite simple problem plain old php application. have website simple directory structure: www.domain.com /blog /some_subdirectory /some_other_subdirectory i redirect user /blog directory everytime visits folder/any file in application except except if in /blog directory. i have come following snippet inside .htaccess file: redirect 302 / http://www.domain.com/blog but of course redirect if inside /blog directory, causing infinite loop of redirects deeper /blog directories don't exist. how can exclude /blog directory redirect statement? use mod_rewrite instead because can create negative condition: rewriteengine on rewritecond %{request_uri} !^/blog rewriterule ^(.*)$ /blog/$1 [l,r] this, of course, changes what's in browser's url address bar. if don't want bar change, remove ,r flag square brackets.

bat file run with C# Process does not have PATH information -

i have code runs command window run batch script outputs file. part works fine, when running batch script not seem proper path information. filename() function location saving data. process proc = null; string targetdir = string.format(@filename()); proc = new process(); proc.startinfo.workingdirectory = targetdir; proc.startinfo.filename = "cmd"; proc.startinfo.arguments = string.format("/c " + filename() + "script.bat > " + filename() + "script_output.txt"); proc.startinfo.createnowindow = false; proc.start(); proc.waitforexit(); when run batch script out of c#, works fine , can find java. when run through c#, reports cannot find java, , not in path variable.

can't find why loop don't go inside my condition in my java serrvlet -

@override protected void service(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub worlddbmanager db = new worlddbmanager(); string choices = request.getparameter("selectchoice"); list<worlpopulationinfo> country = new arraylist<>(); country = db.getresultasarraylist("world", "select * country"); stringbuffer strb = new stringbuffer(); for(int i=0;i<country.size();i++){ if(country.get(i).countryname == choices){ strb.append("<option selected='selected'>" + country.get(i).countryname+"</option>"); system.out.println(choices + " pareil " + country.get(i).countryname); }else if(country.get(i).countryname != choices){ strb.append("<option>" + country.get(i).countryname+"</option>");

handles - Matlab GUI Attempt to reference field of non-structure array -

i have gui menu on matlab 4 buttons (menu.fig). have 4 .fig file want open when click on buttons. here it's ok, when open .fig menu , insert value plot error: ???? attempt reference field of non-structure array. if try open 1.fig directly, works perfectly. i read problem eval(), can't solve it. i changed variable names on each .fig file one 1.fig: function pbutton1_callback(hobject, eventdata, handles) a1=get(handles.edtsamp,'string'); f1=get(handles.edtsfreq, 'string'); fi1=get(handles.edtsfase, 'string'); t1=get(handles.poptipo, 'value'); a1=str2double(a1); f1=str2double(f1); fi=str2double(fi1); sinalsinusoidal(a1,f1,fi,t1); i got error on 1st line. i guess matlab gui not handled well. know used work, when tweaking ui or ui related code bit , accidentally modified area matlab told not touch, kind of issue begin happen. the workaournd start gui m editor clicking run i know works, originally, when directly lau

Is there a way to get the "Watch Later" playlist using YouTube API v3? -

i wondering if available in v3 (i know it's possible v2)? i've tried using watch_later id , mine=true in playlist request. watch_later playlist not returned in generic playlists list results when specifying mine=true . you can ids of special private playlists authenticated request to get https://www.googleapis.com/youtube/v3/channels?part=contentdetails&mine=true&key={your_api_key} one of these watchlater playlist. note playlist id , use in authenticated request list of items on watchlater list: get https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&playlistid={your_playlist_id}&key={your_api_key}

java - FileNotFoundException when reading file - No such file or directory -

i wondering if me catch wrong code? path: src/dictionary.txt code: bufferedreader reader = new bufferedreader(new filereader("src\\dictionary.txt"));` error: exception in thread "main" java.io.filenotfoundexception: src\dictionary (no such file or directory) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(fileinputstream.java:120) @ java.io.fileinputstream.<init>(fileinputstream.java:79) @ java.io.filereader.<init>(filereader.java:41) @ p26.wordreconstruction.generatedictionary(wordreconstruction.java:13) @ p26.wordreconstruction.main(wordreconstruction.java:24) /src/dictionary.txt not same src/dictionary.txt . first in root second relative current directory.

facebook - Is it possible for one person to like an object multiple times? -

the number of likes shown facebook determined number of likes, comments , shares mean 1 person can increase counter more one? thanks. a person can once, can unlike it. it's on/off switch people can flick many times they'd like.

wordpress - FTP access required to update WP plugins and permalink issue -

on server site located, trying update plugins requires ftp username , password. the post shows correctly when using default permalink page=x, not when permalink structure changed http://domain.com/2013/04/09/sample-post/ .httaccess seems okay. wordpress informs permalink structure updated when changing permalink structure, trying access blog page using new structure gives 404 error. i changed permissions on wp-content/ , ran: $ sudo chmod -r a+rx /var/www/* the document root located @ /var/www/domain/public but nothing results if helps, noticed existing images on uploads/ not loaded wordpress since not show in media library any idea? i had issue, comes ftp user running different user apache. 1 user had access files, while other user doesn't. (when ideally both have access). here how overcame it: 1). talked host , made changes. 2). tired adding wp-config.php following code: define('fs_method', 'direct'); this partially fixe

C string from GetString() when strlen produces segmentation fault -

i running program in c. when run program segmentation fault error. in gdb when backtrace tells me program received signal sigsegv, segmentation fault. __strlen_sse2_bsf () @ ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.s:51 51 movdqu (%edi), %xmm1 i believe has strlen. the time use strlen is: string s = getstring(); int stringlength = strlen(s); when change strlen sizeof error stops. what wrong code? documentation of getstring /* * reads line of text standard input , returns * string (char *), sans trailing newline character. (ergo, if * user inputs "\n", returns "" not null.) returns null * upon error or no input whatsoever (i.e., eof). leading * , trailing whitespace not ignored. stores string on heap * (via malloc); memory must freed caller avoid leak. */ string getstring(void) { // growable buffer chars string buffer = null; // capacity of buffer unsigned int capacity = 0; // numbe

html - deleting the parent div using jquery -

i have jquery scripts aimed @ deleting parent div. however, delete button doesn't appear button , won't delete parent div. using jquery mobile. here jquery: $(".delete_content").click(function() { $(this).closest(".content_container").remove(); }); here html: <div class='content_container'> <a class='delete_content' data-role='button' data-icon='delete' data-inline='true' data-iconpos='right'> delete </a> </div> $(".delete_content").click(function() { $(this).parents(".content_container").remove(); }); you need use .parents , not .closest

mysql - PHP not displaying data -

any ideas why simple php code won't display results when trying echo data. <?php { mysql_connect("localhost" , "" , "") or die (mysql_error()); mysql_select_db("") or die(mysql_error()); $pid=intval($_session["user_id"]); $query = "select `car`, `details`, `price` `car``"; //executes query on database $result = mysql_query ($query) or die ("didn't query"); //this selects results rows $num = mysql_num_rows ($result); while($row=mysql_fetch_assoc($result)) { $_session['car'] = $row['car']; $_session['details'] = $row['details']; $_session['price'] = $row['price']; } } ?> <?php echo $_session['car']; ?> <?

azure - How to run webapp on Auzre with classic mode -

i want run app classic mode, in azure how should that? idea can figure startup script? right? you have deploy website in a webrole , , not website . doing so, have ability run a startup task in elevated mode. put following line in startup task script: appcmd.exe set config -section:system.applicationhost/applicationpools /applicationpooldefaults.managedpipelinemode:"classic" /commit:apphost and trick.

c++ - Keeping track of count in my recursive function(Collatz) -

i'm having trouble trying figure out how keep track of amount of times recursive function calls while performaing collatz function. have function definition: template<class mytype> mytype recursionset<mytype>::collatz(mytype n) { if(n == 1) return 1; else { if(n%2 == 1) return collatz(3*n+1); else return collatz(n/2); } } how can keep track of number of times function calls itself? cannot seem life of me come solution. thanks! reference collatz function: http://www.xamuel.com/collatz-recursion/ you trying compute length of collatz chain, aren't you. realise return 1 ? should modify code return count instead. means adding current iteration recursive call: template<class mytype> mytype recursionset<mytype>::collatz(mytype n) { if(n == 1) return 1; else { if(n%2 == 1) return 1 + collatz(3*n+1); else return 1 + collatz(n

vb.net - Ghostscript Pdf printing to network printer issues with formatting -

i use windows 7 64 bit. have .net application , trying print pdf network printer using below code: dim startinfo new processstartinfo() startinfo .arguments = string.format("-dprinted -dbatch -dnopause -dnosafer -dnocancel -dquiet -q -dnumcopies={0} -spapersize={1} -dpdffitpage -dfixedmedia -sdevice=mswinpr2 -soutputfile=""\\spool\{2}"" ""{3}"" ", numberofcopies, _papersize, _printername, _pdffilename) .filename = ghostscriptpath '"c:\program files\gs\gs9.07\bin\gswin64.exe" .useshellexecute = false .redirectstandarderror = true .redirectstandardoutput = true .windowstyle = processwindowstyle.hidden end gs = process.start(startinfo) the pdf printing editable pdf , has text italic formatting. however, italic formatting not applied in printed output. kindly let me know how can resolved. thanks :)

java - How do I add a value to a hash set? -

i'm working on practice problem requires me add value hashmap. can't figure out why keep getting error message on line coursename.add(student); here code: public class studentdatabase { // add instance variables private map<string, hashset<integer>> datacontent = new linkedhashmap<string, hashset<integer>>(); // prints report on standard output, listing courses , // students in each. if map empty (no courses), prints message // saying instead of printing nothing. public void report() { if (datacontent.isempty()) { system.out.println("student database empty."); } else { (string key : datacontent.keyset()) { system.out.println(key + ":" + "\n" + datacontent.get(key)); } } } // adds student course. if student in course, no change // if course doesn't exist, adds database. public void add(string co

php - How can I not upload sqlite db to heroku through git? -

i creating facebook app migrating on heroku due lack of ssl security on site hosting before. using sqlite db php in app. new git , don't know it. basics of how push local repo heroku's servers. have question not uploading file. in future may need make changes app, when re-push repo heroku, database gets wiped out , refreshed data have stored locally in db. have looked both ".gitignore" file , "git update-index --assume-unchanged filename.ext". neither of these methods work. i'd appreciate suggestions guys experienced git , how go uploading sqlite database. thank you, bryce git update-index --assume-unchanged filename.ext really should work long don't explicitly re-add file (like using git add . ). use git status make sure file isn't marked modified before commit. another option deploy different database file in production; way changes dev database isn't important.

export - Mathematica not exporting gifs properly -

i'm trying export image .gif file in mathematica (version 7). let's take basic example: export["pic.gif",graphics[{circle[]}]] there no error messages, , pic.gif file in fact created, file's totally blank; 4 kb size, 0x0 dimensions, if open file no window appears. i've tried messing format, such as export["pic.gif",graphics[{circle[]}],"gif"] and export["pic.gif",graphics[{circle[]}],"image"] but no avail. export works other file-types (tried .jpg , .png no trouble), i'm not sure problem is. version 7 several years old on version 9.01 (the newest) mac os x works fine yehuda

android - Confusion between OpenCv4Android and C++ data types -

i trying write applications using opencv4android android devices. earlier, using android ndk , c++ native codes. technique wasn't lucid. switched on latest java api coming along opencv 2.4.4 version. i able write simple programs , run samples. but, while tried write codes advanced problems - model pose estimation, camera calibration routines etc, came across strange confusion. of data types names intuitive in c++ api doesn't fit in in java counterpart. hence, facing terrible difficulty port functionality c++ java. facing utter confusion in these functions point2f (in c++ ) - matofpoint2f (in java) point3f (in c++) - matofpoint3f (in java) point2 (in java) point3 (in java) please me understand terms used in opencv java , analogy c++. also, please suggest me reference where, clear , crisp description of these terms given (i tried watching provided along, didn't me much, similar both c++ , java). quoting andrey pavlenko: matofxxx classes (e.g. ma

apache - ColdFusion server configuration -

following instructions in adobe link below have reinstalled cf9 multiserver config , apache web server. link so root localhost points c:/program files (x86)/apache software foundation/apache2.2/htdocs. works great. so here question. i'm trying organized. play few sites. can set /htdocs folder below , have each site has own root. ie htdocs ---site1 ---site2 ---site3 up till have been moving needed site htdocs equivalent (i using built in server prior this. ) when need work on etc. surely isn't solution? handle in cf admin or apache or both. do manage multiple sites? what need search virtualhosting in apache httpd. virtualhosting setting apache host different domain names in different directories. i suggest taking @ acme guide. can't find link right now, should able google it. walks through setting development environment apache, coldfusion, mysql, , eclipse.

c++ - How do I let my self-written iterator support ->? -

i writing own iterator in c++: class my_iterator { entity operator*() { ... } my_iterator& operator++() { ... } } i can dereference entity using * operator. however, can let custom iterator support -> operation (followed property or method of dereferenced entity)? is there operator can implement support -> ? yes, overload -> if want special behavior, otherwise it's standard behavior on pointers. for case you'll have like entity* operator->() { return ptr_to_entity; } this odd because -> overload returns pointer object , -> used on that. eg above makes: my_iterator_instance->foo === ptr_to_entity->foo

twitter - Not able to send the direct message -

i got error while sending direct message using mgtwitterengine in app error domain=http code=401 "the operation couldn’t completed. (http error 401.)" i have searched lot not getting proper solution. please me rid of problem. the 401 error appear indicate have permissions problem. body of response contains helpful information identifies issue. are other parts of application working correctly? if not, problem may related oauth.

System.out.err & System.out interleaving in Java -

to work out how time taken perform algorithm, in main method, not print time gets interleaved system.print. long starttime = system.currenttimemillis(); a1.print(2); long endtime = system.currenttimemillis(); system.err.print(endtime - starttime); and if class this: public class a{ public void print(int n){ for(int = 0; <=n; i++){ system.out.println(i) }} it prints 0 1 2 and in line amount of time supposed go through loop, won't, won't print this: 0 1 2 1 here last line or 1 millisecond taken algorithm. textbook says must use system.err. , figure out way prevent interleaving. you like system.seterr(system.out); so output in same stream. use 2 different streams that's why interleaving. for code be: long starttime = system.currenttimemillis(); system.seterr(system.out); a1.print(50); long endtime = system.currenttimemillis(); system.err.print(endtime - starttime);

php - Text sanitization Issue -

i added code site have text sanitization: var re = /(<([^>]+)>)/gi; (i=0; < arguments.length; i++){ arguments[i].value=arguments[i].value.replace(re, ""); } but somehow people able use tag , still able post pics on website through text area. please let me know if have code wrong. ps: users getting away tags well. never trust input data. user can use curl or else , send http post request data in body want server. therefore have rule validate data @ server side before saving database. you can introduce client-side validation though improve user experience anyway have validate input @ server side when request received. update: i see tagged question php tag, if server-side application written in php, can use html purifier sanitize input data , avoid xss, etc. if use php framework have own wrapper html purifier. example yii framework has it.

perl - Test::MockObject::Extends with 'fields' gives error -

so trying upgrade old test modules written other people support newer perls. of tests using test::mockobject::extends, i've found running following code errors out. #!/usr/bin/env perl package mymodule; use strict; use warnings; use fields qw(field1 field2); sub new { $self = shift; unless (ref $self) { $self = fields::new($self); } return $self; } package main; use strict; use warnings; use test::mockobject::extends; use data::dumper; $var1 = mymodule->new(); print data::dumper::dumper($var1); $var2 = test::mockobject::extends->new($var1); error: $ perl $var1 = bless( {}, 'mymodule' ); modification of read-only value attempted @ /usr/local/share/perl/5.14.2/test/mockobject/extends.pm line 31. i've looked @ changelog test::mockobject , perl 5.10 , can't see directly looks causes this. suspect been broken while , new 5.10 illuminated it. i think what's happening here result of using fields::new. perldoc page:

Visual Studio 2012. Load testing. How to determine the maximum number of virtual users? -

i have 2 gb of ram , 1.8 ghz processor. conduct load testing site using visual studio 2012. how determine maximum number of virtual users based on capacity of computer (ram , cpu), tested , width of internet channel (8 megabits per second)? the number of virtual users depends on tests , on target web site. in tests, virtual user needs execute simple request whereas in others tests can invoke multiple pages , services. sometimes, target web site slow. personnaly, prefer use goal based pattern. resembles step pattern adjusts user load based on performance counter thresholds versus periodic user load adjustments. so, run load tests cpu on web server between 40% , 60%.

c# - how to get a blank date in Crystal report instead of 12/30/1899 -

i using crystal report , using date parameter. in cases not returning date database. system tracking default date 12/30/1899. in case want bind report blank date. need show other fields blank date. pls this thanks in advance jidheesh use format in select query select isnull(datecolumn,''),column2 table

Android DeviceDefault Switch button -

Image
i need device default switch (api lvl 14) button. have switch buttons in app, want them device default switch buttons, not android. how can that? tried change theme of application have custom 1 used custom title bar , if try change theme (e.g. theme.devicedefault) force close because of custom title. highly appreciated. this how switch looks (for device): may looking togglebutton (api lvl 1), or swith (api lvl 14)? update: okay, can use imageview , can handle clicks. , in xml: <imageview android:layout_width="100dp" android:layout_height="100dp" android:background="@drawable/my_swich" /> in my_swith.xml in drawable folder: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/selectedimage" /> <item android:drawable="@drawable/normalimage" /> </selector&

html - webkit-animation is not working -

<style> .abc .abc-animation { position: relative; margin: 0 auto; width: 632px; height: 460px; overflow: hidden; background-position: 50% 50%; background-repeat: no-repeat; background-color: transparent; background-image: url("http://zacharybrown.files.wordpress.com/2008/05/7-indians-chief.jpg"); } .abc .ready .mouse { -webkit-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -moz-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -ms-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -o-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -webkit-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -moz-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -o-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -ms-animation-timing-function:

C++ programing code counts[s[i] - '0'] ++; -

for (int = 0; < s.length(); i++) { if (isdigit(s[i])) counts[s[i] - '0'] ++; } what code means, 1 can able explain code " counts[s[i] - '0'] ++;" exact opertion counts ten-element array, being used count how many times each digit appears in s . specifically: s[i] - '0' turns '0' 0 , '1' 1 etc. counts[...]++ increments corresponding element of array.

Do there exist ways to consume Android memory such that the VM will offload other apps? -

we want test, in our android app, behaviour when vm closes app due other applications consuming memory. is there app simulate sort of memory-hog behaviour correctly induces right actions in android vm? alternatively: there way cause equivalent signal while using eclipse force system pretend there's huge memory hog of app out there? no, every application has own heap size limit , killed if oom thinks malfunctioning. if want seize memory, try in native code, out side dvm management.

unix - check if file is empty or not -

how check if file empty in korn script i want test in korn script if output csv file empty or not , if not empty should give count of values. thanks. the test(1) program has -s switch: -s file file exists , has size greater 0

sqlite - sqlite3 method access exception in wp7 while storing database in isolatedstorage -

Image
i'm developing database app wp7& 8 in wp8 sdk target os 7.1.when run application in wvga,wxga,720p emulator working fine,but when run on 7.1 emulator,an unhandled exception of type 'system.methodaccessexception' occurred in community.csharpsqlite.winphone.dll exception thrown @ sqlite.cs file in return code (result)sqlite3.sqlite3_open_v2(filename, out db, flags, null); .help me solve problem for reference have @ not sure if useful you, fixed problem in end by, well, switching csharp-sqlite :) you may peek sqlite-net sources , remove offending call, csharp-sqlite project has more activity , less problems.

java - When to create a Panel for CardLayout? -

i use cardlayout mvc , try understand, when should create panels used cardlayout. for example: a detailpanel view , edit details of dataitem shown, when select dataitem on listpanel. should create , show detailpanel when select dataitem, or should create detailpanel @ start of application , call load method, when select dataitem, , show detailpanel? currently i'm using cardlayout stack. add panel when need , remove when i'm done editing. try avoid replacing view components. initially, create of detailpanel possible , update component models in listselectionlistener . use cardlayout variable portion of each detailpanel . it's unlikely creating view have perceptible performance impact; profile see. if find constructing model introduces significant latency, consider swingworker , illustrated here , here .

python - Hiding the console window -

problem i started designing gui applications using python , tkinter. when freeze script using cxfreeze when run exe file on machine. first console window (a black dos shell in case of windows xp) opens , main window(tk() instance) gets initialized. goal the console window must not appear. tk() instance should appear. code root = tk() label(root,text="hey").pack() root.mainloop() specs windows xp sp 3 python 2.7 tkinter 8.5 when using py2exe use windows=['main.py'] instead of console=['main.py'] when creating setup.py for cx_freeze answer might you: https://stackoverflow.com/a/11374527/2256700

java - How to iterate through each xml file in root of a jar -

during runtime of app need iterate through each xml file lies in root of jar. i know can access concrete file this inputstream in = this.getclass().getclassloader().getresourceasstream( "filename.xml" ); but how can receive list of files in root of jar? thanks try this . java: listing contents of resource directory the classloader.getresource() function can handy way load files in java. files can loaded folder or jar file on classpath. however, api disappointingly lacks way list files in directory. (no, getresources() not it.) utility function comes rescue!

c# - VirtualizingPanel acts weird with many many Children -

hiho, im facing serious issues implementing horizontal virtualizingpanel right way. virtualization works far , items positiones @ right positions when scroll though items, items start overlapping(for me @ item 671090) , following items start creating gaps between each other. effect increases depending on horizontal offset. tried locate problem watching itemposition in debug intends be. different implementations found in internet have same problem. tried virtualizingtilepanel implementation provided dan crevier , staggeredpanel described in "sams wpf control development unleashed". both seem have same problem when add lot of items. steps reproduce: 1. download example http://blogs.msdn.com/b/dancre/archive/2006/02/16/implementing-a-virtualizingpanel-part-4-the-goods.aspx or sample code from http://www.informit.com/store/wpf-control-development-unleashed-building-advanced-9780672330339 add example 1000000 items virtualization. scroll through data problem starts

colors - Why do I get java.lang.StackOverflowError when using Flood Fill algorithm? -

my program supposed fill in non-regular shape color (black , white beginning) specify in boundaryfill4 method. here link myimage.png: https://dl.dropbox.com/u/41007907/myimage.png use simple flood fill algorithm, not work somehow... here full code: import java.awt.color; import java.awt.container; import java.awt.image; import java.awt.image.bufferedimage; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jlabel; public class mypolygon extends jframe { private jlabel my; public mypolygon() throws interruptedexception { createmy(); } private void createmy() throws interruptedexception { container contentpane = getcontentpane(); contentpane.setbackground(color.white); contentpane.setlayout(null); contentpane.setsize(1000, 700); = new jlabel(); my.seticon(new imageicon("myimage.png")); my.setbounds(50, 50, 300, 300); contentpane.add(my); setsize(1000, 700); setvisible(true);

c++ - Qt binary reading error in qDatastream -

i reading binary file produced sensor. having problem in reading float different precision (32 or 64). can read them in matlab (64 bit version) qt (32 bit version on windows) giving wrong values. can read till dtmth (please ref structure below) . after getting value inf baseline . value 0 in fact. can see, changed msb (littleendian). if keep bigendian, 0 baseline others values wrong then. desktop 64 bit. i have checked number of bytes , correct. think problem machine precision. qdatastream in(&file); in.setbyteorder(qdatastream::littleendian); params p; in >> p.filetype; in >> p.projectid; in >> p.datamin; in >> p.dtyear; in >> p.dtmth; in >> p.baseline; in >> p.startfrequ; where p structure defined as: struct params { quint8 filetype; quint16 projectid;

c# - How to call back parameter? -

i want set textbox.text class1 , when press button nothing happens. what's wrong? namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } class1 c; private void button1_click(object sender, eventargs e) { c = new class1(); c.x(); } } } and code class1 namespace windowsformsapplication1 { class class1 { public static form1 f; public void x() { f = new form1(); f.textbox1.text = "hello"; } } } i change textbox1 modifier public. when f = new form1() create new form. if have instance of form1 open give 2 instances of form1 . calling method on 1 of them won't affect other. have pass reference of form instance of class1 , call method on reference. there different ways this. 1 pass reference argument x method: public

swing - Problems with Java's Paint method, ridiculous refresh velocity -

i'm developing simple version of r-type work university, despite works, craft velocity lot of slow, movement ugly , clumsy. use method repaint refresh screen, there others methods or ways best it? video of movement paint method @ main panel @override public void paint(graphics g) { super.paint(g); graphics2d g2 = (graphics2d) g; g2.setrenderinghint(renderinghints.key_antialiasing, renderinghints.value_antialias_on); g2.drawimage(fondo, 0, 0,1200,600,this); pj.paint(g2); g2d=g2; } pj's paint method public void paint(graphics2d g) { g.drawimage(imagen,x,y,this); } pj's move method public void move (keyevent e) { int dx = 0; int dy = 0; int code = e.getkeycode(); switch (code) { case keyevent.vk_q: dy-=1; break; case keyevent.vk_a: dy+=1; break; case keyevent.vk_p: dx+=1; break; case keyevent.vk_o: dx-=1; break; } int x = (getx()<maxx&&getx

java - Using JOptionpane to create an object -

i want add person or firm object arraylist, type of vehicle using joptionpane or other option available. there anyway this? use joptionpane call method, , add arraylist along type of vehicle? joptionpane not meant object creation, you'll have create objects before calling joptionpane visibility.

.net - get original content of a pdf signed with itextsharp -

i'm trying original document of signed pdf in order compare it's hash stored doc. this easy when document has several signatures, acrobat reader can go previous revision of document save , that's it. surprisingly not work first signature, there no straight forward way original data. as not possible reader have tried programatically itextsharp. although have googled have not found how it. relevant post found one no solution offered. has faced problem , found solution? thanks in advance. edit: put here code extracts data based on response of mkl. read comments of response beware of problem unfixed length of non signed pdfs. string soriginaltext = file.readalltext("filesigned.pdf", encoding.default); int strailernumberposition = soriginaltext.lastindexof("]/prev ") + "]/prev ".length; int strailernumberendposition = soriginaltext.indexof(">", strailernumberposition); string strailerindex = soriginaltext.substring(st

How to properly implement a drop-down box using <SelectListItem> and repository pattern in ASP.NET MVC -

i know how implement drop-down box using <selectlistitem> type in asp.net mvc. have not used method before, , i've been advised best way go if have perform 'required' validation on drop-down. i've created drop-down using viewbag, , don't think find approach effective. my example here simple. small app allows user enter customer name , choose country drop-down. should check user selects country , enters value in name textbox. please have @ code below. incomplete , template, please me how implement approach. please feel free use repository if using effective. i'm still struggling understand how use repository pattern, , explanation needed on well. thanks customer view model public class customer { public int id { get; set; } [required] public string name { get; set; } [required] public country countryid { get; set; } } public class country { public int countryid { get; set; } public ienumerable<selectlistitem>

sql - Alter auto-generated sequence -

i use create auto-incremented id columns: id bigserial -- psql id bigint generated default identity -- hsql now in unit tests i'd reset sequences between tests. is possible? target postgresql , hsqldb truncate table restart identity; http://www.postgresql.org/docs/9.2/static/sql-truncate.html http://hsqldb.org/doc/guide/dataaccess-chapt.html#dac_truncate_statement

php - using concat select firstname and lastname search -

this sql query. need search first name , last name using search. $result = 'select * resume (first_name "'.$skeyword.'%" or last_name "'.$skeyword.'%" or concat(first_name," ",last_name) "'.$skeyword.'%" or email "'.$skeyword.'%" or phone "'.$skeyword.'%" or zip_code "'.$skeyword.'%" or find_us "'.$skeyword.'%" )'; fetch result simple query , display result using concatination... $seresult='select * resume (first_name "%'.$skeyword.'%" or last_name "%'.$skeyword.'%" or email "%'.$skeyword.'%" or phone "%'.$skeyword.'%" or

javascript - set CheckColumn as checked programmatically -

i using 'checkcolumn' in 'gridpanel' , using window contain chart. in window, when click on values in chart, have set corresponding check box checked in grid. question how set check box checked programmatically? got row id of corresponding value need not know how use check it. thanks lot! // in code below, searching specific row how contain value grids.getstore().each(function(rec){ var rowdata = rec.data; if (rowdata['value']==value) { var record = grids.getstore().getat(rec.index); // can now? // } }); i found need , just: add rec.set('myfield', true); thanks

oracle9i - How to Sum the Values from current date to previous year in oracle -

can body me solve this: value date 1000 01-jan-12 ............ 1000 01-apr-13 my aim calculate sum of marks secured current month , year april-13 previous 1 year current month , year. your example data shows more 1 year apr 2013. assuming wanted go apr-2012 select sum(value) your_tab date >= add_months(trunc(sysdate, 'mm', -12) -- 1st apr 2012 , date < trunc(sydate, 'mm');-- anytime end of mar 2013 if wanted go jan of prior year, select sum(value) your_tab date >= trunc(add_months(trunc(sysdate, 'mm', -12), 'yy') -- 1st jan 2012 , date < add_months(trunc(sydate, 'mm'), 1); -- anytime end of apr 2013

java - Modifying line numbers in Javassist -

so have been using javassist bit lately, , have run question haven't been able find answer to. insertat method of ctmethod allows insert code @ specific line number, overwrite line or keep it, , how make opposite of default? have application modifies source before runtime javassist, based on 'hooks' in xml file. want make line can overridden, or line can placed above line instead of overriding it. there hackish ways that, i'd rather use proper way. the easy part the method insertat(int linenumber, string src) present in ctmethod object allows injecting code written in src before code in given line. for instance, take following (simple) example program: public class testsubject { public static void main(string[] args) { testsubject testsubject = new testsubject(); testsubject.print(); } private void print() { system.out.println("one"); // line 9 system.out.println("two"); // line 10 system.out.pr