Posts

Showing posts from April, 2012

How to flatten a table using SQL Server? -

i'm using sql server 2012. project want flatten table, need help. table. | applicationname | name | value | createdon | contoso | description | example website | 04-04-2014 | contoso | description | nothing | 02-04-2014 | contoso | keywords | contoso, about, company | 04-04-2014 | contoso | keywords | contoso, company | 02-04-2014 i want last modification record name application name. result want. | applicationname | description | keywords | contoso | example website | contoso, about, company i don't temp tables. knows how this? thanks lot. jordy here's more complete solution: declare @collist nvarchar(max) set @collist = stuff((select distinct ',' + quotename(name) table -- table here xml path(''), type ).value('.', 'nvarchar(max)') ,1,1,'') ...

Ada: linked list example in Naiditch's book -

in chapter 11: access types of book: rendez-vous ada naiditch (1995) , naiditch gives rather complete example on how create linked list contains information restaurant. understand largely data structure following book's example. can understand information user entering in linked list exist during lifetime of program. author not storing information restaurant text files. what's use of linked list example if information entered user not stored after user exits program? does make sense store user entered information in text file , read them linked list further operations on them? doing operations such adding or deleting entries disturb original text file linked list read @ start. thank you. ps: might have noted, trying real-life example of linked list , new data structure well. as discussed here , 1995 example predates addition of containers predefined library of ada 2005. textbook example may guide understanding of concrete implementations encountered particul...

c# - Global variable won't work in searching in one function -

i made program gets info in textbox1 , textbox2 after pressing button1. if type in textbox3 , if wrote there same textbox1 ,after pressing button2 puts textbox2's text in label2.text. but problem won't put textbox2.text label2.text. why? here's code: public partial class form1 : form { public form1() { initializecomponent(); } ozv[] = new ozv[5]; int = 0; private void button1_click(object sender, eventargs e) { a[i] = new ozv(); a[i].name = textbox1.text; a[i].id = int.parse(textbox2.text); i++; } private void button2_click(object sender, eventargs e) { (int j = 0; j < 5; j++) { a[j] = new ozv(); if (a[j].name == textbox3.text) { label2.text = a[j].id.tostring(); } } } } and here's class made: class ozv { public string name; public int id; } remove l...

How to change language Google Map V2 android -

Image
i using google-play-service-lib . how can change language of google map i.e. show locations in korian language or hindi language. you can change location google maps use google map api v2 using locale object. language needs supported on device being used though. here full list of supported languages . with code below able change language on map chinese: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string languagetoload = "zh_cn"; locale locale = new locale(languagetoload); locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); setcontentview(r.layout.activity_maps); setupmapifneeded(); } result, language set chinese in code (no manual changes) on u.s. based phone: i able show korean, use locale...

javascript - RoR: escape_javascript and render :partial -

while updating rails application ruby 1.8 2.1, ran following problem. code used before in controller: def upload_partial() escape_javascript(render :partial => "plupload_partial") end doesn't seem working anymore. routes.rb: match 'items/upload_partial' => 'items#upload_partial', :via => [:get, :post] the view contains html along javascript. i'm getting following error: nomethoderror (undefined method `gsub' #<array:0x00000003f35590>): app/controllers/item_controller.rb:31:in `upload_partial' when remove escape_javascript(), code executes correctly. guess function expects string , uses gsub() function escape js, render :partial doesn't return proper string (anymore) of ruby 2.x anyone had similar problem?

C++ DirectX11 Setting elements in the same vector to different positions in the same update loop -

i want set 2 elements in vector 2 different positions in same update run. at moment have: //set position of bullet ship if trigger pressed if ( projectilesnumber % 2 == 0) //even number bullet { playerbullets[projectilesnumber]->setposition(vector2(ship->returnposition().x - 20.0f, ship->returnposition().y - 70.0f)); } if ( projectilesnumber % 2 == 1) //odd number bullet { playerbullets[projectilesnumber]->setposition(vector2(ship->returnposition().x + 7.0f, ship->returnposition().y - 70.0f)); } what want have both , odd numbered bullet set these positions @ same time, @ moment code runs through number bullet, in next update loop goes through odd numbered bullet , on. playerbullets vector , projectilesnumber integer. projectilesnumber gets incremented 1 each time goes through end of code , starts again. this sets them "at same time". otherwise need clarify m...

html5/css- Element li not allowed as child of element div in this context. (Suppressing further errors from this subtree.) -

in html document, have <div class="text"> formated place text block, lists(ordered/unordered) validator found error: element li not allowed child of element div in context. (suppressing further errors subtree.) what should change? class text formated in css , used on every subpage. changing <p> or <article> didnt validate. thx4help *edit-not article div an <li> element has inside an <ul> or <ol> like this: <ul> <li>list item</li> <li>list item</li> </ul> ul unordered list, while ol ordered list.

c# - Get Direct Reports from Logged in user from Exchange -

i need direct reports logged in user (mvc 4) don't need names of direct reports need email addresses including proxy addresses. reason need search through exchange. have never attempted search exchange in past , find out there tells me how step 8 finish line says nothing how go step 1 8. i can current users user name user.identity.name.replace(@"yourdomain\", "") and have found example far best example have found http://msdn.microsoft.com/en-us/library/office/ff184617(v=office.15).aspx but example line outlook.addressentry currentuser = application.session.currentuser.addressentry; is not getting current user logged site. i hope out there familiar , can me past point. i reworked sample url following linqpad 4 query. i've found linqpad great way experiment because scripty, allowing quick experimentation, , can view data using dump() extension method. purchasing intellisense support totally worthwhile. also, noticed there l...

c# - Convert datetime in MVC4 view causes an error -

i have content entity model in project created ef6. public partial class content { public content() { this.comments = new hashset<comment>(); } public int id { get; set; } public string subject { get; set; } [datatype(datatype.multilinetext)] public string brief { get; set; } [uihint("tinymce_full"), allowhtml] public string maintext { get; set; } [datatype(datatype.datetime)] public system.datetime dateofpublish { get; set; } [datatype(datatype.imageurl)] public string smallimageurl { get; set; } [datatype(datatype.imageurl)] public string bigimageurl { get; set; } public string keywords { get; set; } [datatype(datatype.datetime)] public system.datetime dateofexpire { get; set; } public string autherusername { get; set; } public long visitvcount { get; set; } public string visible { get; set; } public int contentgroupid { get; set; } public long likecount { get;...

svn - PHPStorm how to create new branch without new project? -

i working phpstorm 7.1.3 , svn version control system. since current project grows, want start working branches , wondering whats easiest way this. right checked out project consists of trunk. create new branches tried out little bit , came creating new branch in svn , create new project in phpstorm check out branch. works expected, leads lot of projects find quite annoying. so tried create project consisting of complete svn repository, trunk + repositories. correct settings of trunk , repository location, can not merge trunk branch or vice versa, merge start wasn't found what have create working branch in project consisting of whole svn repository? did check out whole repository single project, project root parent trunk , branches? way make metging branches work such project configuring vcs mappings trunk , each of branches separately, have not single working copy, several ones, , configure branches each of them separately , merge using 'merge from...

c# - How to detect shift+tab when overriding ProcessCmdKey -

so had override processcmdkey in order detect tab pressing in winform. see this question context. successful in fixing tabbing issue had realize need check shift+tab logic allow user go backwards. can't seem figure out. below of have tried , hasn't worked far. private bool istab = false; private bool isshifttab = false; private stringbuilder shifttab = new stringbuilder(); protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == keys.tab) { istab = true; shifttab.append("tab"); } else { istab = false; } if (keydata == keys.shift) { shifttab.append("shift"); } if (shifttab.tostring() == "tabshift" || shifttab.tostring() == "shifttab") { isshifttab = true; } if ((control.modifierkeys & keys.tab) != 0) { ...

php read and updating value on file from another file -

i have 2 files (a.vcf , ref1.vcf) a.vcf this: #chrom pos id ref alt qual filter info format 1 5 . c 222 . indel;is=6,0.111111;dp=54;vdb=1.384012e-01;af1=0.5;ac1=1;dp4=2,3,1,4;mq=32;fq=10.8;pv4=1,0.38,0.00012,0.00052 gt:pl:gq 0/1:45,0,147:47 2 7 . g t 222 . dp=106;vdb=1.997151e-13;rpb=-2.402409e+00;af1=1;ac1=2;dp4=1,1,44,58;mq=20;fq=-275;pv4=1,1,0.0029,1 gt:pl:gq 1/1:255,248,0:99 3 15 . g 222 . dp=106;vdb=2.982598e-04;rpb=-2.402409e+00;af1=1;ac1=2;dp4=1,1,44,58;mq=20;fq=-266;pv4=1,1,0.003,1 gt:pl:gq 1/1:255,239,0:99 4 11 . t 222 . dp=85;vdb=3.949915e-01;af1=1;ac1=2;dp4=0,0,29,44;mq=22;fq=-247 gt:pl:gq 1/1:255,220,0:99 ref1.vcf : #chrom pos id ref alt 1 5 ref12345 c 2 15 ref45673 g 3 25 ref67893 c t 4 35 ref66663 c i want change heading of file corresponds reference a.vcf ref1.vcf. thus, initially: id = . ref = alt = c qual = 222 i want this: id = ref12345 ref =...

android - Option menu is not working below api level 11 -

Image
in app have option menu work fine in above api level 11 in below api level 11 menu option not showing. shown in images in version 2.3.3(api level 10) in version 4.2(api level 18)

html - jQuery scrolltop for a submit button -

i have submit button after submitting form should scroll id. there other button in form next , should scroll same id. * jquery * jquery('.scroll').click(function () { jquery("html, body").animate({ scrolltop: jquery('#blog1').offset().top }, 'slow'); return false; }); html * **** ** next , button code * ** * * <input class="send_btn scroll" type="button" value="back" /> * register button code * ** * ** <input class="send_btn" type="submit" value="register" /> the jquery code working fine next , button. if add scroll class register scolling blog1 form not submitting. if dont add scroll class form submitting not scrolling. a jsfiddle useful, try this: <input class="send_btn scroll" type="button" value="register" />

Why can't I retrieve FaceBook profile pic in Android? -

i trying retrieve facebook profile pic using url in android. not able retrieve image. have no error logs such following log. 04-05 04:14:41.005: d/skia(2987): --- skimagedecoder::factory returned null . posting codes. please tell me step step doing wrong. final imageview photoimageview=(imageview)findviewbyid(r.id.imageview1); asynctask<void, void, bitmap> t = new asynctask<void, void, bitmap>(){ protected bitmap doinbackground(void... p) { bitmap bm = null; try { url aurl = new url("http://graph.facebook.com/+"id"+/picture?type=small"); urlconnection conn = aurl.openconnection(); conn.setusecaches(true); conn.connect(); inputstream = conn.getinputstream(); bufferedinputstream bis = new bufferedinputstream(is); bm = bitmapfactory.decodestream(bis); bis.close(); is.close(); ...

python - Pygame 3D Cube translate,move -

i have make follow 3d cube , need make translate function move cube example key move axis x, cube y move in axis y,and right in axis z, search find translate function it's 2d here mind stack , confuse. now want follow please, how can anjust translate function code, or have idea how move,transate cube vertices3 of code below? please help import sys, math, pygame class point3d: def __init__(self, x = 0, y = 0, z = 0): self.x, self.y, self.z = float(x), float(y), float(z) def rotatex(self, angle): """ rotates point around x axis given angle in degrees. """ rad = angle * math.pi / 180 cosa = math.cos(rad) sina = math.sin(rad) y = self.y * cosa - self.z * sina z = self.y * sina + self.z * cosa return point3d(self.x, y, z) def rotatey(self, angle): """ rotates point around y axis given angle in degrees. """ rad = angle * mat...

ios - Snapshot of a AVCaptureVideoPreviewLayer and overlaid Views -

i have avcapturevideopreviewlayer on view camera feed , views above (buttons, reference lines, etc). how can snapshot of app user sees (with camera image , overlays)? the window snapshotviewafterscreenupdates: gets overlaid views, view drawviewhierarchyinrect: of main screen it's blank, , avcapturestillimageoutput camera picture without overlays.

jquery - Security Issue - Allowing user to add his own JavaScript (only during runtime) -

i'm working on content generator , have objects allow users add custom scripts page. i'm concerned preview of plugin. pages cannot saved in preview, can user mess preview page permanently if allow him use dynamically added javascript? i'd mention, javascript sent via ajax php file, appended body. pages cannot saved in preview, can user mess preview page permanently if allow him use dynamically added javascript? not permanently, no. can mess own current page. if custom scripts , pages don't leave client's computer, or can make sure not served other people (which implies they're not stored on server) you're safe xss attacks . however, notice plugin leaves "preview" , allow saving pages shown other visitors, will have problem.

How to get image url from tweets using the Twitter API -

i'm using code: require_once ("twitteroauth.php"); define('consumer_key', 'xxx'); define('consumer_secret', 'xxx'); define('access_token', 'xxx'); define('access_token_secret', 'xxx'); $toa = new twitteroauth(consumer_key, consumer_secret, access_token, access_token_secret); $query = array( "q" => "#misiones", "result_type" => "recent", "include_entities" => "true" ); results = $toa->get('search/tweets', $query); foreach ($results->statuses $result) { $user = $result->user->screen_name; $text = $result->text; to tweets whit hashtag #misiones(the name of place i'm live). works fine i'm trying image url (if tweet have some). tryed $result->media , $result->media->media_url , other convinations without succcess. tweet entities looking access pictures. entities provide st...

for loop - how to make widgets in c# for desktops apps -

i doing desktop application calendars,sticky notes,diary,todolist,reminders , sending , receiving e-mail. want make widget this.wiget should display messages if new mail received. dont know start making widget.let me know there controls in visual studio make widgets or not.from should start. you're looking wpf. it's steep learning curve, you'll able virtually make app want. supports real transparency, can design app way want without borders. you're looking window.windowstyle = windowstyle.none . start here. note won't 'widget' clock widget in windows 7 example. you'll make normal desktop app (.exe) special functionality. bottom line, can (and more) in wpf you'll want comfortable around first.

Different labels for input file types in PHP/HTML -

i've simple problem can't seem fix :( . i have following php variable: $nrofattachments="2"; and in html code i've show number of file upload fields: <?for($i=1;$i <= $nrofattachments; $i++) {?> <div class="form-group"> <label for="attachments" class="control-label">attachment(s)</label> <input name="attachment[]" type="file" id="attachments" size="30"/> </div> <?}?> what want achieve different labels each input file type... <? for($i=1;$i <=$nrofattachments; $i++) { echo '<div class="form-group"> <label for="attachments['.$i.']" class="control-label">attachment '.$i.'</label> <input name="attachment['.$i.']" type="file" id="attachments['.$i.']" size="30"/...

asp.net mvc - mail server requires authentication when attempting to send to a non-local e-mail address when using MVCMailer -

i want send newsletter emails users. i have done this: public actionresult sendnewsletter() { _usermailer.newsletter().send(); return view(); } and in usermailer class: public virtual mvcmailmessage newsletter(string useremail) { //viewbag.data = someobject; return populate(x => { x.subject = "newsletter"; x.viewname = "newsletter"; x.to.add("hello@mydomain.mobi"); x.bcc.add(useremail); }); } i add submitted newsletter emails bcc. but when send encounter issue: bad sequence of commands. server response was: mail server requires authentication when attempting send non-local e-mail address. please check mail client settings or contact administrator verify domain or address defined server. if remove bbc can send email normaly because have provided authenticatio...

python - select rows with duplicate observations in pandas -

i working on large dataset , there few duplicates in index. i'd (perhaps visually) check these duplicated rows , decide 1 drop. there way can select slice of dataframe have duplicated indices (or duplicates in columns)? any appreciated. use duplicated method of dataframe : df.duplicated(cols=[...]) see http://pandas.pydata.org/pandas-docs/stable/generated/pandas.dataframe.duplicated.html edit you can use: df[df.duplicated(cols=[...]) | df.duplicated(cols=[...], take_last=true)] or, can use groupby , filter : df.groupby([...]).filter(lambda df:df.shape[0] > 1) or apply : df.groupby([...], group_keys=false).apply(lambda df:df if df.shape[0] > 1 else none)

How to write into a json file in Android -

i using bundled json file in application. want read , write data json file. have listview displays available data in json , edittext user enters data. data has written json. how this? this code... public class mainactivity extends activity { string myjsonstring; arraylist<data> web = new arraylist<data>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); jsonparser(); } private void jsonparser() { // reading text file assets folder stringbuffer sb = new stringbuffer(); bufferedreader br = null; try { br = new bufferedreader(new inputstreamreader(getassets().open( "single.json"))); string temp; while ((temp = br.readline()) != null) ...

android - Running multiple instance of a service -

is possible start service multiple times. means calling startservice multiple times. know if call startservice , it'll call oncreate() -> onstartcommand() . on startservice , calls onstartcommand() without oncreate() . happens service ? creating multiple instance of service ? no, service run in 1 instance. however, every time start service, onstartcommand() method called. @ this documentation .

html - How can I increase the width of a panel using jQuery mobile? -

<div><a href="#overlaypanel"> search</a> </div> <div data-role="panel" id="overlaypanel" data-theme="a" data-display="overlay" data-position="right" style="width:100%"> <h2>overlay panel</h2> <a href="#pageone" data-rel="close"> close panel </a> </div> i tried above code using jquery mobiles, increasing size closing automatically when click in panel set data-dismissible property false in panel. <div data-role="panel" id="mypanel" data-dismissible="false" style="width:100%"> refer fiddle demo

objective c - Problems linking NSTableView handler class -

i have strange problem in cocoa-app. have main window nstableview in controller class ( propvaltablehandler ). have made connections between nstableview , propvaltablehandler, when 'numberofrowsintableview' method called looks not 'propvaltablehandler' initialized in 'adddelegate' used, since 'propman' field not initialized (it normal init used, has instance of class). doing wrong? have nstableview handler in window, works, not have custom init method. source codes: appdelegate #import "appdelegate.h" @implementation appdelegate @synthesize propvaltablecontroller = _propvaltablecontroller; -(id) init { self = [super init]; if (self) { _propman = [[ocpropertymanager alloc]initwithpath:"./data/"]; _propvaltablecontroller = [[propvaltablehandler alloc] [initwithpropmanager:_propman]; } return self; } propvaltablehandler @interface propvaltablehand...

ProGet performance issues -

my company looking hosting nuget packages on private server. have started play around proget, seems have performance issues. hosting around 6500 packages (120 unique ones + different version of them) , searching takes approximately 30s. seems doesn't use underlying database indexing @ all. suggestions? we having same issue around same time, turns out nuget.org problem. slow during days... suggest disable connectors. have 100k+ packages, , use proget no issues.

php - Check if in a set of numbers, a number n is equal to sum of its subset -

i have array : $permissionvals = array (1,2,4,8,16,32); and variable $effectivepermission = 13; i need check whether variable equal sum of subset of given array of numbers in optimized way. subset sum doesn't seems work me here. assuming $permissionvals contains powers of 2, can use bit comparison: $permissionvals = array(1,2,4,8,16,32); $target = 13; $res = array(); foreach ($permissionvals $val) { if ($target & $val) $res[] = $val; } if (array_sum($res) == $target) print_r($res); else echo 'the message want'; a variant stop foreach loop when sum reached. (useful if $permissionvals big): $sum = 0; $message = 'the message want'; foreach ($permissionvals $val) { if ($target & $val) { $res[] = $val; $sum += $val; } if ($sum == $target) { $message = ''; print_r($res); break; } } echo $message;

excel - Cannot select range from another workbook -

i'm writing code on 1 workbook prompts user select data in workbook. dim rng range set rng = application.inputbox(prompt:="please select range", title:="range select", type:=8) dim ws worksheets: set ws = worksheets("working") the problem input dialog box when move other workbook select range remains behind in first workbook , cannot select range. to select range in different workbook other active workbook, must first activate workbook , activate or select range .

php - How user can login to custom group in phpfox -

i new php fox , have problem in user group module, understand how create user group module , settings of group problem not able go custom user group, going registered user . please me , me add custom user group model in registration process. you can change user group of user admin panel . admincp>>users>>browse users>>(click on down arrow appering in users list)>>edit user for user groups on registration have create subscriptions. admincp>>modules>>subscribe>>create new package . if trying implement user group select option or default user group registered users please change default registered user group according need , create separate user group special users.

c++ - Wrapped reference-counting, questions about move-semantics -

i'm working on class acts scope helper reference-counted objects. interface should allow use class follows: { handle<string> s = handle<string>::new("hello, world!"); s = s->concat(handle<string>::new(" name peter")); } while string class contains reference-count. i not familar move semantics , unable find concrete paper sates conditions apply move-semantics. basically, wondering is: can this object initialized in move-constructor? because if case, can't tell apart if member in handle class points string contains garbage value or pointing real string . i guess it's possible using placement construction, doing asking trouble. don't know why mentioned it. short answer: no, cannot. move constructors differ other constructors in type of values accept.

Update selected tag values in XML file using shell script -

i have xml file similar below format: <name>property1</name> <fullname>property1</fullname> <info> #property info# </info> <value> <current>true</current> <default>false</default> </value> <name>property2</name> <fullname>property2</fullname> <info> #property info# </info> <value> <current>true</current> <default>false</default> </value> <name>property3</name> <fullname>property3</fullname> <info> #property info# </info> <value> <current>true</current> <default>false</default> </value> the xml file contains hundreds of such properties. want update value of current tag of few properties (say property2) true false. how can using unix commands? i'm new unix , i'm looking wr...

ruby - What's gone wrong with my Capistrano configuration? -

i'm trying execute capistrano deploy via jenkins , running following build error: cd ~/sites/myproject ~/.rvm/gems/ruby-2.0.0-p0/bin/cap production deploy /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in 'report_activate_error': not find rubygem capistrano (>= 0) (gem::loaderror) from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in 'activate' from /system/library/frameworks/ruby.framework/versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in 'gem' from ~/.rvm/gems/ruby-2.0.0-p0/bin/cap:22 from ~/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14 build step 'execute shell' marked build failure there's suspicious-looking switch ruby 2.0 ruby 1.8 there don't know enough ruby know start looking... ideas? cap production deploy works fine command line of course. i able jenkins wor...

mysql - Can not modify header information, what is wrong with this php code -

this question has answer here: how fix “headers sent” error in php 11 answers i new programming, website else had built me has stopped working. trying find out be. did read explanations complicated me dont know enough programming. warning: cannot modify header information - headers sent (output started @ /home/username/domain/index.php:3) in /home/username/domain/controllers/register.php on line 31 the code register.php header("location: ".url."register-missing"); // line 31 exit(); } header("location: ".url."register"); exit(); } the code index.php <?php class index extends controller { // line 3 function __construct() { parent::__construct(); } function index() { $this->view->render('index/index'); } } ?>...

Why do original paypal IPN (sandbox) requests not get sent to my listener -

i've created ipn listener , have tested out simulator. works fine. 1 of sandbox accounts place order through app (using mpl this). ipn listener logs nothing. login sandbox account , @ ipn history. ipn has failed, there no response code. after 8 retries able manual resubmit. when listener receives request fine. why original requests fail, resubmit works fine?

debugging - Looking for guidance to get `gist.el` up and running -- errors -

can please steer me in right direction getting gist.el work properly. here error message: debugger entered--lisp error: (wrong-type-argument stringp nil) call-process(nil nil #<buffer *string-output*> nil "config" "github.user") apply(call-process nil nil #<buffer *string-output*> nil ("config" "github.user")) process-file(nil nil #<buffer *string-output*> nil "config" "github.user") apply(process-file nil nil #<buffer *string-output*> nil ("config" "github.user")) (let ((standard-output standard-output)) (apply (quote process-file) git nil standard-output nil args)) (progn (let ((standard-output standard-output)) (apply (quote process-file) git nil standard-output nil args)) (save-current-buffer (set-buffer standard-output) (buffer-string))) (unwind-protect (progn (let ((standard-output standard-output)) (apply (quote process-file) git nil standard-output n...

express - Error: Invalid version: "1.0" in node.js packge.json file -

i created basic package.json , running npm install throwing version error. erroneous package.json { "name": "appone", "description": "first cnp app", "version": "1.0", "dependencies": { "express": "3.x" } } however on changing version 1.0 0.0.1 working correctly. i new node thought version refers app version can give number. please let me know referring , error. well, can link-hop package.json documentation node-semver doc http://semver.org/ , gist is, valid version strings must have major version, minor version, , patch version: major.minor.patch so 1.0 not valid because doesn't have patch version. 1.0.0 acceptable.

apache - Htaccess url redirect and masking, multiple query strings -

i have tried every redirect , htaccess masking solution problem on stackoverflow, i able redirect urls i.e: a. http://www.autotraderuae.com/news/man-up-/2681 redirects to: b. http://www.autotraderuae.com/news/news_detail/man-up-/?id=2681 but i'd url in browser still show (a) , not (b) without changing php structure ofcourse. code being used is: rewriteengine on options +followsymlinks rewriterule ^news/([a-z0-9-.?]+)/([0-9]+)? news/news_detail/$1/?id=$2 [l,qsa,r] the page redirects because you've included r flag @ end, which indicates redirect . need remove , keep l , qsa flags.

machine learning - How to evaluate a suggestion system with relevant order? -

i'm working on suggestion system. given input, system outputs n suggestions. we have collected data suggestions users like. example: input1 - output11 output12 output13 input2 - output21 input3 - output31 output32 ... we want evaluate our system based on data. first metric if these outputs present in suggestions of our system, that's easy. but now, test how positioned these outputs in suggestions. have given outputs close first suggestions. we single score system or each input. based on previous data, here score of 100% be: input1 - output11 output12 output13 other other other ... input2 - output21 other other other other other ... input3 - output31 output32 other other other other ... ... (the order of output11 output12 output13 not relevant. important ideally 3 of them should in first 3 suggestions). we give score each position hold suggestion or count displacement ideal position, don't see way this. is there existing measure used ? ...

sed - Getting Day Of Week in bash script -

i want have day of week in variable dow . so use following bash-script: dom=$(date +%d) dow=($($dom % 7) ) | sed 's/^0*//' but there message bash: 09: command not found . wished result 2 ( 9 % 7 = 2) in variable $dow . how realize this? code works days 1-8 of c-hex there no number on 8 available , message bash: 09: value great base (error token "09") appears. you can use - flag: dom=$(date +%-d) ^ which prevent day being padded 0 . from man date : - (hyphen) not pad field observe difference: $ dom=$(date +%d) $ echo $((dom % 7)) bash: 09: value great base (error token "09") $ dom=$(date +%-d) $ echo $((dom % 7)) 2

mercurial - Find committed files that should have been ignored -

how can list files in repository committed (explicitly), although ignored because of .hgignore file .hgignore uses glob syntax running on windows it's not necessary take global .hgignore file account my idea: hg manifest > filter using content of .hgignore > result you have learn , use filesets in case list files in .hgignore tracked: hg locate "set:hgignore() , not ignored()"

objective c - MVC in iOS with custom UIViews -

how create custom uiview controls in ios?? lets want radio streamer play/pause buttons , scroller. lets i'll create new model (singleton) streaming. how handle view , controlling? create uiview , add actions (iboutlets) uiview, or need viewcontroller also? or should use viewcontroller + model without uiview? because saw model , view should never communicate dont think idea have uiview , actions in it... i have created model (singleton) , viewcontroller (.xib view 320x50 play/pause , scroller). have implemented model , actions inside controller , when want use controller (so radio streamer) use code: radioplayerviewcontroller *controller = [[radioplayerviewcontroller alloc] initwithnibname:@"radioplayerviewcontroller" bundle:nil]; [controller.view setcenter:cgpointmake(cgrectgetmidx(self.view.bounds), 300)]; [self addchildviewcontroller:controller]; [self.view addsubview:controller.view]; is aproach? thanks. way , implement correct have make mode...

xml - How does dom4j handle <import>? -

i need import xml file xml file. know there tag can use, need know how dom4j handles this. does import , act part of file, or @ all? if doesn't @ all, how can use tag import xml file? since there no pre defined xml tag import xml file, dom4j cannot handle it. might referring "external entities", discussed example here . in "external entities" case, not dom4j resolves references, rather sax parser used xml parsing.

Observable pattern not notify in android -

i have implement observer/observable pattern in android application, when notify, receivers dont call. this code: the observer, class call rest service, if call fails because server off, or other problem, change rest server ip, increase int value observable , observable must call update override method, dont it: public class loginapicall extends apicallbase<object> implements observer { private string team; private string password; private string deviceid; private loginintents loginintents; public loginapicall(context context, string team, string password, string deviceid, apiresponselistener listener) { super(context, listener); this.team = team; this.password = password; this.deviceid = deviceid; loginintents = loginintents.getinstance(); loginintents.addobserver(this); } @override protected void dowork() { logind...

python 2.7 - My code will run without errors but it will not display -

i trying create menu game i'm doing , code menu, when run it, won't display window. can me find error can display menu window? this code: import pygame pygame.locals import * class menu: def __init__(self, options): self.options = options self.font = pygame.font.font("dejavu.ttf", 20) self.select = 0 self.total = len(self.options) self.keep_pressing = false def update(self): k = pygame.key.get_pressed() if not self.keep_pressing: if k[k_up]: self.select -= 1 elif k[k_down]: self.select += 1 elif k[k_return]: title, function = self.options[self.select] print "opciones"%(title) function() if self.select < 0: self.select = 0 elif self.select > self.total -1: self.select = self.total -1 self.keep_pressing = k[k_up] or k[k_down] def texto(self, screen): total = self.total indice = 0 opti...

authentication - Cakephp Auth multiple login redirect -

within cakephp app, have users table, fields username, password, , role. role determines controllers , actions can access. 2 types of main roles have: admin , customer. hence admins , customers should allowed access respective controllers , actions. however under appcontroller, has single redirect non logged in users leads same controller , action login page, regardless of whether user trying access admin page or customer page. i have 2 different login pages, 1 admins , 1 customers. how can achieve this? class appcontroller extends controller { public $components = array( 'debugkit.toolbar', 'session', 'auth'=>array( 'loginredirect'=>array('controller'=>'access', 'action'=>'login'), 'logoutredirect'=>array('controller'=>'access', 'action'=>'logout'), 'autherror'=>'you ca...

How do I draw a rectangle on an existing png image using java -

i have png image saved in local pc. want open(load) image , draw rectangle on image @ specified location (x, y, width, height) using java. can me this... equivalent c# code below. want java version same image oriimage = // load file rectangle rect = new rectangle(0, 1824, 1080, 96); bitmap eleimg = new bitmap(oriimage, (int)(oriimage.width / rate), (int)(oriimage.height / rate)); graphics g = graphics.fromimage(eleimg); g.drawrectangle(new pen(color.red, 5), rect); you make use of 2d graphics api bufferedimage img = imageio.read(...); graphics2d g2d = img.creategraphics(); g2d.setcolor(color.red); g2d.drawrect(0, 0, 100, 100); g2d.dispose(); take @ reading/loading image 2d graphics for more details

java - Subtraction of date and time from file contents containing dates line by line -

while((str=br.readline())!=null) { string line1=str; string line2=br.readline(); int datedifference=integer.parseint(line2.substring(8,10))-integer.parseint(line1.substring(8,10)); int yeardifference=integer.parseint(line2.substring(11,15))-integer.parseint(line1.substring(11,15)); int hourdifference=integer.parseint(line2.substring(16,18))-integer.parseint(line1.substring(16,18)); int minutedifference=integer.parseint(line2.substring(19,21))-integer.parseint(line1.substring(19,21)); int seconddifference=integer.parseint(line2.substring(22,23))-integer.parseint(line1.substring(22,23)); int lastthingdifference=integer.parseint(line2.substring(24,28))-integer.parseint(line1.substring(24,28)); system.out.println(hourdifference);} after excuting getting error this exception in thread "main" java.lang.numberformatexception: input string: " 1" @ java.lang.numb...

javascript - Will Node.js get blocked when processing large file uploads? -

will node.js blocked when processing large file uploads? since node.js has 1 thread, true when doing large file uploads other requests blocked? if so, how should handle file uploads in nodejs? all i/o operations handled node.js using multiple threads internally; it's programming interface i/o functionality that's single threaded, event-based, , asynchronous. so big upload of example performed separate thread that's managed node.js, , when thread completes work, callback put onto event loop queue. when cpu intensive task blocks. let's have task compute() needs run continuously, , cpu intensive calculations. answer main question " how should handle file uploads in nodejs? " check in code (or library) save file on server, dependent on writefile() or writefilesync() ? if using writefile() asynchronous; if writefilesync() synchronous version. updates: in response comment: "the answer "no, won't block" correct e...

c++ - Function call different behavior in main and library -

i met strange thing, 2 days ago try debug code. i'm running code on windows 7 64bit os. in main calculate mathematical model knowing input signal, applied in control algorithm soop . calculation ok in main, in soop function while doing same thing have close not identical results. why? tired float , got same result. does double rounded if calculate in function not in main? main: #include <unistd.h> #include <iostream> #include <windows.h> #include <fstream> #include <math.h> #include "model.h" #include "soop.h" using namespace std; int main( void ) { ofstream myfile; myfile.open ("modeltest.txt"); statee current_state; // = new statee; initstatee(current_state); current_state.variables[0] = 0.0; current_state.variables[0] = -3.0*pi/2.0; cout << "program init" << endl; // ==============model testing myfile << current_state.variables[0] <<...

How to increase time duration of taking a video of Android Studio -

i know how increase time duration of taking video of android studio? developed application , explain function using video it's 3 mins take video default , it's not enough me. please kindly advice me. android studio's screen record , screen recording via command line using adb seems have maximum limit of 3 minutes. here adb screen record documention states --time-limit sets maximum recording time, in seconds. default , maximum value 180 (3 minutes). you might want @ recording 2 separate videos, putting them in video editing program.

python - Sympy factor out from a matrix -

i have matrix dk =matrix([[op],[0],[-o]]) dk*2 i cannot factor out factor 2 using factor(dk*2) or simplify(dk*2) no luck. i not quite sure in context using these expressions. greater problem trying solve? looking along lines of: >>> op,o = symbols('op o') >>> dk =matrix([[2*op],[o+op**2],[-op/o]]) >>> print([[cell.as_coeff_exponent(op) cell in row] row in dk.tolist()]) [[(2, 1)], [(o + op**2, 0)], [(-1/o, 1)]] i assume not trying achieve, maybe it's start?

javascript - Chrome 34 confirm message PERSISTENT -

my web site uses persistent storage. http://spinlock.idletime.tk/web/ffmpeg_pnacl/ chrome 33 confirm persistent storage,only 1 time. chrome 34 confirm every time! chrome 34 bug? or javascript wrong? (function openfs() { navigator.webkitpersistentstorage.requestquota(1024*1024*100000, function(bytes) { window.webkitrequestfilesystem(window.persistent, bytes, function(fs) { fs = fs;}, onerror); }); })(); why??? thank you. my answer (function openfs() { navigator.webkitpersistentstorage.queryusageandquota(function(used, remaining) { if(used+remaining < 1) navigator.webkitpersistentstorage.requestquota(1024*1024*100000, function(bytes) { webkitrequestfilesystem(window.persistent,bytes, function(fs) { fs = fs;}, onerror);}); else webkitrequestfilesystem(window.persistent,1024*1024*100000, function(fs) { fs = fs;}, onerror); }, onerror ); })();