Posts

Showing posts from April, 2012

xml - wxga android layout >600dp -

i have andoid layout want display on tablets , phones. i've created folders , layouts layout layout-land, layout-sw600dp, layout-sw600dp-land, layout-sw720dp, layout-sw720dp-land,... screens works ok until load 4.7 wxga screen understand relationship between density , size supposed build consistent layout when wxga screen wants run use sw720dp layouts ? if specify text size based on dp specific folders xml layout can not want. missing fundamentally simple . how can make layout work on small screen high pixel density , large screen same number of pixels? here's looks like edit : not enough reputation points post images ;( post pointless now it know device it. dp resolution. if know can create layout-swxxxdp folder it. if don't know propose put in layout files , check loaded on device. e.g. in layout folder put textview text "layout normal", in layout-sw600dp put textview text "layout sw600dp" , on. please note can use other number...

python - How can I account for identical data points in a scatter plot? -

i'm working data has several identical data points. visualize data in scatter plot, scatter plotting doesn't job of showing duplicates. if change alpha value, identical data points become darker, nice, not ideal. is there way map color of dot how many times occurs in data set? size? how can assign size of dot how many times occurs in data set? as pointed out, whether makes sense depends bit on dataset. if have reasonably discrete points , exact matches make sense, can this: import numpy np import matplotlib.pyplot plt test_x=[2,3,4,1,2,4,2] test_y=[1,2,1,3,1,1,1] # generating test x , y values. use data here #generate list of unique points points=list(set(zip(test_x,test_y))) #generate list of point counts count=[len([x x,y in zip(test_x,test_y) if x==p[0] , y==p[1]]) p in points] #now plotting: plot_x=[i[0] in points] plot_y=[i[1] in points] count=np.array(count) plt.scatter(plot_x,plot_y,c=count,s=100*count**0.5,cmap='spectral_r') plt.colorba...

java - How can I ignore spaces in a substring? -

i have textbox gives out suggestions based on user input , 1 of textboxes location based. the problem is, if user types in chicago,il , works, if type in chicago, il , suggestions stop. difference between 2 space after comma. how can fix this, if user puts in 2 or 4 spaces after comma still shows same results first case? this code: if (location.contains(",")) { // city works correctly string city = location.substring(0, location.indexof(",")); // state problem if user puts space after comma // throws off string state = location.substring(location.indexof(",") + 1); string myquery = "select * zips city ilike ? , state ilike ?"; } i have tried this: string state = location.substring(location.indexof(",".trim()) + 1); the string variables used make calls database; why have eliminate spaces. how can fix this, if user puts in 2 or 4 spaces after comma still shows same results first cas...

android - How to divide large string data in multiple pages or activity or fragments or flips -

i trying task after wasting time still didn't solution. problem: working on news application, flip effect. application shows news content on first page, when user swipes bottom top on screen new flip opens , remaining news text content shown on next flips. the problem is, set initial text news on first screen on text view, when user swipe more news, unable detect how text data have shown on first text, , how have remaining text data set on next flip. i searched many times there function visible text on text view, there no solution that, logics there not working me. thanks. public int getellipsisstart (int line) return offset of first character ellipsized away, relative start of line. (so 0 if beginning of line ellipsized, not getlinestart().) this means can find out if text has been ellipsized or not this: int ellipsisstart = mtextview.getlayout().getellipsisstart() > 0; if (ellipsisstart > 0) { // text has been ellipsized // t...

c# - Session sets the value successfully but gets null in MVC 5 -

i developing mvc 5 application , have specific controller session variables in application has 6 sessions, , working fine. wanted use session, have declared in session controller follows: public int tempresult { { return convert.toint32(session["tempresult"]); } set { session["tempresult"] = value; } } now have controller inherits session controller , setting session variable tempresult in method as: [httppost] public jsonresult coacodelength(mst m) { var s = (from sets in db.abcs sets.name == "name" && sets.pre.tostring() == m.house select sets.id).single().tostring(); tempresult = convert.toint32(s); } now controller b inherits session controller calling method of controller , in method trying access session value of tempresult as: [httppost] public actionresult new([bind(include = "id,name,house,number")] mst tr) { tr.name = r.ccode(tr); // r instance of controller db.msts.add(tr); ...

sql - In Report Builder 3.0 to group the two columns in one cell? -

i have report , there column: date begin date end ----------- ---------- [date_begin] [date_end] now need combine them single cell , rename date: result should be: date ------------ --------- begin end ------------ --------- [date_begin] [date_end] how it, tried through 'add group'-->'parent group'? report builder 3.0 you shouldn't bother merge these cells. simply create additional row above "date begin" , "date end". can done right clicking on top row , select insert row. then merge 2 cells above "date begin" , "date end" cells , type description "date" in merged cell. this should output seem require. unless there reason why require these in same cell?

user interface - Android UI design: multiple icon sizes for multiple screen sizes -

i'm using xamarin , visual studio 2012 developing application. have main menu screen contains 5 image views. have created following folders in resources folder: drawable-mdpi, drawable-hdpi, drawable-xhdpi , drawable-xxhdpi , created 4 sets of icons these drawables proper sizes. when test application on nexus 7, icons sizes same on nexus 4. added these lines manifest file: <compatible-screens> <!-- small size screens --> <screen android:screensize="small" android:screendensity="mdpi" /> <screen android:screensize="small" android:screendensity="hdpi" /> <screen android:screensize="small" android:screendensity="xhdpi" /> <!-- normal size screens --> <screen android:screensize="normal" android:screendensity="mdpi" /> <screen android:screensize="normal" android:screendensity="hdpi" /> <screen and...

How to Add validation for div tag using JQUERY unobtrusive? -

i using "jquery unobtrusive" java script validation. using 1 label , 1 text box control inside div tag. when click on submit button need mark background color of entire div(divname) red. <div class="form-group" id="divname"> <label for="your-name-id">your name:</label> <input type="text" name="yourname" id="your-name-id" placeholder="please enter name" </div> you have called highlight , unhighlight option in jquery validation plugin can use highlight element 's closest parent below: highlight: function(element, errorclass, validclass) { $(element).addclass(errorclass).removeclass(validclass); $(element).closest('.form-group').addclass(errorclass).removeclass(validclass); //errorclass class have background-color red css , validclass have background-color green css }, unhighlight: function(element, errorclass, validclas...

javascript - Select dynamically created element -

i created div dynamically , attached div. i'm trying add data query , load text field. but, i'm unable select dynamically created elements because not visible in dom, since loaded. have fiddle <div id="parent"> <input id='childbutton' type="button" value="add"/> <div id="child" data-row="0"> <input type="text" value="" /> </div> </div> var rownum = 0; $('#parent').on('click', '#childbutton', function() { var clone = $('#child').clone().attr('data-row', ++rownum); $('#parent').append(clone); console.log($('#child[data-row=1]').length); }); the problem id selector, return first element given id. in case creating multiple elements id child. #child return first child element, applying data-row rule filter out selected element getting 0 result. the solution u...

sql server - Why i can not delete user log in in my database? -

Image
i connect sql server windows authentication , create simple database , table on it,and define new log in user , set sql server authentication,every thing fine,but connect database windows authentication too,i want delete windows authentication,and want connect database sql server authentication,this picture problem: when connect sql server authentication,i define rajabi user log in. but want rajabi user can connect database.how can solve that?thanks. what if roles have granted new user? granting reader role new user should allow said user connect. right click on user -> properties -> membership -> checked? check db_datareader allow user connect.

javadoc - Add copyright at the end of Java class while writing documentation? -

i'm writing documentation java file. in documentation, want add html links @ end of each generated file. that, have use while writing java documentation? if using eclipse ide, can use plugin jautodoc: http://jautodoc.sourceforge.net/ to add default text @ beggining of each text file.

scala - Getting NullPointerException from Play framework -

i have been using play framework 2.2.4 version. while executing particular action getting nullpointerexception , if code can fix has come play library. could on this?? # action # public static result getoverviewpage(final string errormsg){ string autobillstatusmsg = ""; //business logic here logger.info("final auto-pay status message : "+autobillstatusmsg); return ok(rave_customer_index.render()); } we able see above logger statement. after getting nullpointerexception exception stacktrace info | jvm 1 | 2015/09/18 15:15:24 | [info] application - final auto-pay status message : info | jvm 1 | 2015/09/18 15:15:24 | [error] play - cannot invoke action, got error: java.lang.nullpointerexception info | jvm 1 | 2015/09/18 15:15:24 | [error] application - info | jvm 1 | 2015/09/18 15:15:24 | info | jvm 1 | 2015/09/18 15:15:24 | ! @6nfm0a093 - internal server error, (get) [/] -> info ...

ios - button image not changing after click in swift -

i created buttons rating purpose var distance : cgfloat! = 0.0 var = 1 ;i <= 5;++i { var profratebtn = uibutton.buttonwithtype(uibuttontype.custom) as! uibutton profratebtn = uibutton(frame: cgrectmake(235 + distance,266,20,20)) profratebtn.setimage(uiimage(named: "star.png"), forstate: uicontrolstate.normal) profratebtn.tag = profratebtn.addtarget(self, action: "doprofrate:", forcontrolevents: uicontrolevents.touchupinside) self.view.addsubview(profratebtn) distance = distance + 25.0 cgfloat } its when button display image set normal state whenever click on it, not change image star filled i find on different question , apply different solutions given can not change button image after selected button action method func doprofrate(sender : uibutton){ println("btn selected : \(sender.tag)") sender.setimage(uiimage(named: "star_fill.png"), forstate: uicontrolstate.selected) } try send...

c# - Check for any of the property is null -

i deserializing xml class model , want check if there xml nodes not deserialized correctly. my class looks this: class { public a1 pop1; public a2 prop2; // n number of classes } class a1 { public string item1{get;set;} public string item2{get;set;} public string item3{get;set;} // n number of classes } class a2 { public string item1{get;set;} public string item2{get;set;} public string item3{get;set;} // n number of classes } is there way check if of objects a1 , a2 , etc null , of properties inside object null or empty? if true deserialization failed. you use reflection walk on classes , values. what in case though make custom method called validate in interface ivalidateable . let every class implement interface , write method validation inside. makes easier deviate 'all properties can't null' rule have now.

playframework - Play authentication error -

getting error--at line 73 in {module:secure}/app/controllers/secure.java (around line 73) 69: // check tokens 70: boolean allowed = false; 71: try { 72: // deprecated method name 73: **allowed = (boolean)security.invoke("authenticate", username, password);** 74: // allowed = true; 75: } catch (unsupportedoperationexception e ) { 76: // official method name 77: allowed = (boolean)security.invoke("authenticate", username, password); 78: } 79: if(validation.haserrors() || !allowed) { i tried debugg application not find proper reason error.[![enter image description here][1]][1] please tell me how authentication happens in play framework can debugg. not understand code flow. java version mismatch issue. application required 1.6 , mine java 1.8

python - numpy contour plot with cost function -

a = np.array(x) b = np.array(y) a_transpose = a.transpose() a_trans_times_a = np.dot(a_transpose,a) a_trans_times_b = np.dot(a_transpose,b) def cost(theta): x_times_theta = np.dot(a, theta) _y_minus_x_theta = b - x_times_theta _y_minus_x_theta_transpose = _y_minus_x_theta.transpose() return np.dot(_y_minus_x_theta_transpose, _y_minus_x_theta) n = 256 p = np.linspace(-100,100, n) q= np.linspace(-100,100, n) p, q = np.meshgrid(p,q) pl.contourf(p, q, cost(np.array([p,q])) ,8, alpha =0.75, cmap = 'jet') c = pl.contour(p,q, cost(np.array([p,q])), 8, colors = 'black', linewidth = 0.5 ) hi, i'm trying make contour plot using cost function on 2 parameters, involving matrix multiplication. i've tested cost function , works in interactive session. however, running on linspace makes error "valueerror: objects not aligned". understand has how structure p,q. solution involve writing loop explicitly array of outputs? how write this? edi...

android - can't test app on my mobile : Failure [INSTALL_FAILED_OLDER_SDK] -

i new android studio , made app not running on physical device htc 1 m8 giving , error failure [install_failed_older_sdk] htc 1 m8 android version: 5.0.2 android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.example.darab.crazy_tip_calc" minsdkversion 22 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } just set minsdkversion 15 instead of 22 android:minsdkversion an integer designating minimum api level required application run. android system prevent user installing application if system's api level lower value specified in attribute. android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid ...

c# - How to select only OData child elements -

i'm building odata application , i'm struggling on how retrieve results , include (child properties). first, let me show registration in builder: builder.entityset<aggregatedarticlessearchmodel>("search").entitytype.haskey(x => x.name); now, on model i'm returning query: <entitytype name="aggregatedarticlessearchmodel"> <key> <propertyref name="name"/> </key> <property name="name" nullable="false" type="edm.string"/> <property name="values" type="collection(zevij_necomij.mobile.app.api.models.occurenceviewmodel)"/> </entitytype> <complextype name="occurenceviewmodel"> <property name="value" type="edm.string"/> <property name="count" nullable="false" type="edm.double"/> <property name="articles" type="col...

amazon sqs - Connecting to SQS with JMS using Java 1.6 -

i "unsupported major.minor version 51.0 error" when connecting sqs using aws's jms sqsconnectionfactory in java 1.6. works in java 1.7 i have not found documentation says imcompatible 1.6 has managed? suggestions? it looks it's compiled java 7. you can download source code , compile java 6. https://github.com/awslabs/amazon-sqs-java-messaging-lib you need few changes in source code, example remove diamond operator <> tests. when open page mentioned above, there minimum requirements in readme.md specify minimum version of java 7.

mp3 - Remove all tags except APIC with TagLib in C++ -

i wrote function supposed remove tags mpeg file, except apic tag(s), i'm getting mixed , unpredictable results. sometimes, tags except "year" correctly removed (this happens of time), sometimes, 1 or more other tags stay additionally "year" tag. i'm doing wrong. here function: void striptags(const char* path) { mpeg::file m(path); m.strip(mpeg::file::id3v1 | mpeg::file::ape, true); //i added because otherwise, tags stay first time executed striptags(). second time execute tags gone (except "year" mentioned) bytevector handle = "apic"; id3v2::tag *t = m.id3v2tag(); if (t) { (id3v2::framelist::constiterator = t->framelist().begin(); != t->framelist().end(); it++) { if ((*it)->frameid() != handle) { t->removeframes((*it)->frameid()); = t->framelist().begin(); //since doc says removeframes invalidates pointer returned framelist, update pointer af...

c# - How do I authenticate with an API using Digest authentication? -

i'm new areas of api's, need integrate api using digest auth. i have username , password has been provided format should sent in? i'm confused why can't find anywhere on internet... if can provide generic example client code in c# incredibly useful.

c++ - How to modify properties while proceeding BFS in Boost Graph Library? -

i'm using bundled property graph. definitions follows: class node { void assignplane(plane& p) plane* dp; double errors; } void node::assignplane(plane& p) { dp=&p; errors=p.a+p.b+p.c;// simplified } typedef adjacency_list<vecs,vecs,bidirectionals,node,float> ngraph; //... struct nvisitor: default_bfs_visitor { void discover_vertex(vertexdesc u, const ngraph& g) const { // can't modify g } } but can't call g[u].assignplane(p) modify vertex, nor can pointer vertex, both vital me. though question may seem stupid, novice of boost, , have fought 2 weeks adapt convoluted style of boost codes, need help. not try answer "you need use other bgl", please, can find nothing support work other bgl. , must say, official documentation not intended explain great work in simpler way. since have read documentation dozens of times, not suggest me reread documentation. appreciate useful help, , thank in ad...

PHP is variable not working as expected -

i have php variable $username , following script: <?php echo '<a href="#">'.$username.'</a>'; ?> if $username contains something <b bolds text. how can prevent that? use htmlspecialchars echo '<a href="#">'.htmlspecialchars($username).'</a>'; see documentation: http://php.net/manual/en/function.htmlspecialchars.php

android - Force popup to copy paste -

Image
on devices when long click text popup can copy or past. while on other devices getting toolbar, similar options. is there default popup can use replace toolbar? popup toolbar

reflection - How can I generate a Java factory at compile time? -

i have interface has been implemented maybe 50 times , app keep on evolving new implementations. these implementations should loaded depending on name (which constant available in each implementation). i want avoid using reflection @ runtime (because reflections lib pulls 3mb of dependencies , need keep jar small possible) , avoid having add entry factory each time implementation added. so wondering: how can automatically @ compile time ? need build map of implmentation.name => implmentationconstructor thanks edit: i'm looking here not have care writing code load classes. mean having factory generated automatically on compile (full code generation) or using kind of serviceloader-like tool supports auto-generating required files , supporting constructors arguments. easiest solution come use reflection in unit tests check implementations accessible through constructor , if not, output in console code needs put in factory are. the java serviceloader can used...

php - Symfony UrlGeneratorInterface::ABSOLUTE_URL -

symfony 2.6.11 need base url use urlgeneratorinterface::absolute_url $base_url = urlgeneratorinterface::absolute_url; and have true, need url how can base url? you can generate url request $baseurl = $request->getscheme() . '://' . $request->gethttphost() . $request->getbasepath(); urlgeneratorinterface interface url generator classes must implement (within symphony). , absolute_url constant trivially used in parameters point method generate absolute url

How to embed Facebook share on iOS like at attached pic -

Image
i came across app love know did used sharing on facebook. the app shows share button opens window (see below image). share parameters of share dialog image , url meaning when post wall ever tap on go entered url. does know how it? you can native slcomposeviewcontroller . add social media framework. import in project add following lines: - (ibaction)facebookpost:(id)sender { if ([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { slcomposeviewcontroller *myslcomposersheet = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook]; [myslcomposersheet setinitialtext:@"social framework sharing test!"]; [myslcomposersheet addimage:[uiimage imagenamed:@"myimage.png"]]; [myslcomposersheet addurl:[nsurl urlwithstring:@"http://stackoverflow.com/questions/32692493/how-to-embed-facebook-share-on-ios-like-at-attached-pic"]]; [myslcomposersheet set...

Record level security in MS Dynamics -

Image
we want implement 'record level security' in ms crm dynamics. on user , case entity have optionset has below values, optionset has lot of values, below simple values: category 1 category 2 we want restrict category 1 users see category 1 cases , restrict category 2 users see category 2 cases. what have done far? i thinking should possible through retrieve plugin, after wrote code.. found retrieve plugin triggering 5 times when tried open case record. not throw custom error. public void execute(iserviceprovider serviceprovider) { itracingservice tracer = (itracingservice)serviceprovider.getservice(typeof(itracingservice)); ipluginexecutioncontext context = (ipluginexecutioncontext)serviceprovider.getservice(typeof(ipluginexecutioncontext)); iorganizationservicefactory factory = (iorganizationservicefactory)serviceprovider.getservice(typeof(iorganizationservicefactory)); iorganizationservice service = factor...

Database Operation Failed: Azure SQL and Azure Data Factory -

database operation failed on server 'worker.database.windows.net,11146' sql error number '40197'. error message database execution : service has encountered error processing request. please try again. error code 4815. severe error occurred on current command. results, if any, should discarded.. i'm getting following error. error code 4815 mean? couldn't find documentation regarding error code. the error 4815 means sql server engine received invalid column length bcp client colid. might want check parameters again , try task again. here documentation on error codes. hope helps. https://technet.microsoft.com/en-us/library/cc645613(v=sql.105).aspx

ios - AnyObject does not have a member named generator -

i don't have enough reputation post images the problem when did following for object in objects { eg: .... // [anyobject] not have member named generator - shows me error } and after search in stackoverflow , other sites did this: if objects?.count > 0 { object in objects! { self.resultsusernamearray.append(object.username) -> error "cannot invoke append argument list of type (string?!)" } } else { } [anyobject] not have member named generator || cannot invoke append argument list of type (string?!) import uikit var username = "" class usersviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { @iboutlet weak var resultstable: uitableview! var resultsusernamearray = [string]() var resultsprofilenamearray = [string]() var resultsimagefiles = [pffile]() override func viewdidload() { super.viewdidload() let thewidth = view.frame.size.width let theheight = view.frame.size.height ...

ios - EXC_BAD_access code=1 address 0x8 -

i working on xcode 6.1, getting exception , application crashed. thread 1: exc_bad_access code=1 address 0x8 and redirected appdelegate file. error , don't know why? try debug no information crash. read zombies , enabled going product->edit schema->diagnostic->enable zombie object. after didn't helpful. i try exception breakpoint check not successful. app terminates before without giving exception. any way out of it? in advance.

android - User Authentication with mobile number and OTP -

at outset let me state not expert in django , appreciate help. building simple e-commerce application backend in django. clients web-app , android app. i don't want have user defined passwords automatically generated otps sent users whenever attempt login. have derived user model classes permissionsmixin , models.model classes , using django rest framework write apis. i had @ django-otp library think built two-factor authentication not suitable me. one easy solution thought first obtain username (which mobile number in case) , randomly generate otp @ server. otp can stored password particular user (in password field). then after user enters otp can work normal username / password would. can please suggest if idea, or there better means of doing this? a similar question has been asked earlier has not been answered in detail.

python - Usage of BoundsEditor in TraitsUI -

i want use boundseditor (in traitsui) range selection. how access high , low values? testing use rangeeditor - works expected (on moving slider current value printed). cannot values out of boundseditor. pointers appreciated. i use following (simplified code): from traits.api \ import hastraits, button, range traitsui.api \ import view, item, group, rangeeditor traitsui.qt4.extra.bounds_editor import boundseditor class parameters(hastraits): rgb_range = range(0.,1.0) range1 = rgb_range range2 = rgb_range eval_button = button("eval") traits_view= view( item('range1')), #editor=rangeeditor() item('range2', editor=boundseditor()), item('eval_button')) def _range1_changed(self, value): print(value) def _range2_changed(self, *arg, **kwargs): print(arg) def _range2_changed(self, *arg, **kwargs): print(arg) def _range2_low_changed(self, *arg, **kwargs):...

progress bar - Android How to make step Progressbar -

Image
i want make progress bar step bar below. can please me how achieve this.

selfupdate for Macports, install packages via macports -

` macports selfupdate failing on mac os 10.9.5 installed xcode(6.2) , commandline tools.i have tried 2 versions of macports, 2.3.0 , 2.3.3. $ port -v macports 2.3.0 1. error rsync fails connect sources on macports.org. have firewall turned off on mac machine though. looking https://rsync.macports.org/release/tarballs/base.tar on browser, path not exist. may sources not available rsync sync them local system. please advise on how perform port selfupdate. $ sudo /usr/bin/port -v selfupdate ---> updating macports base sources using rsync rsync: failed connect rsync.macports.org: connection refused (61) rsync error: error in socket io (code 10) @ /sourcecache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9] command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs exit code: 10 error: error synchronizing macports sources: command execution faile...

python - Django won't detect changes in models -

i outsourcing models packages in order have better overview. models.py of app main looks like from django.db import models models import * and actual models in models/user.py, ... so when go prepare migration: python manage.py makemigrations main django won't detect changes. why? i had same problem migrating models. changed import methodology , instead of from models import * i tried this from models.user import user, device, ... and worked

tilemill - Mapbox Studio transparent water -

i have problem mapbox studio. i'd make water layer appear transparent , land area in color. when remove or modify map {} background transparent, change transparent except water remains color set to. if try adding fox example, #countries { polygon-fill: #ff0000 }, nothing fill land covered area. i have failed find reference work current version of mapbox. things work tilemill not seem work mapbox studio. pointers or advises appreciated. thanks! in mapbox studio classic (desktop application), map refers of land, , (if you're using mapbox-streets-v5 or mapbox-streets-v6 data source) #water has own selector. if set map color value, of land color. if set #water color value, of water color. keep in mind rivers , streams can styled via #waterway selector.

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

i trying parse date 2014-12-03t10:05:59.5646+08:00 using these 2 formats: yyyy-mm-dd't'hh:mm:ss yyyy-mm-dd't'hh:mm:ssxxx when parse using yyyy-mm-dd't'hh:mm:ss works fine, when parse yyyy-mm-dd't'hh:mm:ssxxx parseexception thrown. which correct format parse date , difference between these 2 formats? note : cannot use joda :( those valid formats: yyyy-mm-dd't'hh:mm:ss.sssz >>> e.g.: 2001-07-04t12:08:56.235-0700 yyyy-mm-dd't'hh:mm:ss.sssxxx >>> e.g.: 2001-07-04t12:08:56.235-07:00 edit: btw, "x" refer (iso 8601 time zone)

Ruby on Rails Ckeditor loses paperclip image assets on deploy -

i got ruby on rails website use ckeditor gem. https://github.com/galetahub/ckeditor i have setup paperclip can upload images in editor. works without problems. the problem when deploy cloud66 server ckeditor. makes it, uploaded images trough ckeditor deleted. (the links still same, images gone) how solve this? code: model > ckeditor > assets.rb module ckeditor class asset < activerecord::base include ckeditor::orm::activerecord::assetbase include ckeditor::backend::paperclip end end model > ckeditor > attachment_file.rb module ckeditor class attachmentfile < ckeditor::asset has_attached_file :data, url: "/ckeditor_assets/attachments/:id/:filename", path: ":rails_root/public/ckeditor_assets/attachments/:id/:filename" validates_attachment_presence :data validates_attachment_size :data, less_than: 100.megabytes do_not_validate_attachment_file_type :data ...

c# - Update or Insert records in database based on result set -

Image
i've table this i've table sections in there 6 sections id 1 6 . list of section id user gives information current active section of user. suppose list returned me has section ids follows {2,3,4,5} user id 1 . question how can pass list of section ids stored procedure i want update active flag of record section id 1 , user id 1 since list of section ids doesn't have entry of 1 i want insert new record of section id 5 user id 1 in same table returned in list of section ids. can please tell me how achieve this? i can total section id's following query select id sections but don't know iterate between total list of section id's , compare list of section ids returned c# to answer complete question. 1. said in comment: table valued parameters first create udtt store sections ids input stored procedure. create type [dbo].[sectionidudtt] table( [id] int not null ) use udtt parameter stored procedure: alter procedure [...

ios - duplicate symbol _OBJC_CLASS_$ in paypal -

i getting error in paypal sdk 2.8.2 . duplicate symbol _objc_class_$_paypalpayment in: ...libpaypalmobile.a(paypalpayment.o) ...libpaypalmpl.a(paypalpayment.o) duplicate symbol _objc_metaclass_$_paypalpayment in: ...libpaypalmobile.a(paypalpayment.o) ...libpaypalmpl.a(paypalpayment.o) ld: 2 duplicate symbols architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) when removed -objc in other linker flags error solved . after app crashes on pay button log : -[paypalpaymentviewcontroller paypalservicemanager]: unrecognized selector sent instance 0x7ff2b5a38240 i have spent whole day solve helpfull. any can solve day.....

SQL Server 2008 r2 Management Studio problems -

Image
i've been using management studio no problems on current machine 2 years, , migrated windows 10 few weeks back. last week started hanging on open following error: microsoft.sqlserver.management.registeredservers.registeredserverexception: unable read list of registered servers on system. re-register servers in 'registered servers' window. after doing research, managed around following advice found in this post , object explorer refuses expand. program acts world if not responding, i'll following error: value cannot null. parameter name: viewinfo (microsoft.sqlserver.management.sqlstudio.explorer) after that, can open new query window , responds, cannot use object explorer. i've looked @ this thread , doesn't seem solve me. is there any chance don't have reinstall ssms? update: attempted reinstall, failed error "the specified account exists" . i received same error message did, yesterday, sept. 30, 2015, when tried openi...

ios - How to change button colour alternate selection of button? -

Image
this code using , selectindex bool if(!selectindex) { click.backgroundcolor=[uicolor colorfromhexstring:@"#ffc400"]; selectindex=yes; } else { click.backgroundcolor=[uicolor graycolor]; selectindex=no; } my problem when user select button changing colour properly,when user try select button continue previous bool value. ->my requirement when user click button colour have change. ->second when user select same button colour have change. ->button placed inside tableview each button have tag, tried change using tag value failed.any 1 please me.... third party tableview header section: - (uiview *)mtableview:(tqmultistagetableview *)tableview viewforheaderinsection:(nsinteger)section { uiview *viewheader=[[uiview alloc]initwithframe:cgrectmake(0, 0, tableview.frame.size.width,tableview.frame.size.height)]; uibutton *btnclick; lblhead=[[uilabel alloc]initwithframe:cgrectmake(50,3,150, 50)];...

python - Get nth byte of integer -

i have following integer: target = 0xd386d209 print hex(target) how can print nth byte of integer? example, expected output first byte be: 0x09 you can of bit manipulation. create bit mask entire byte, bitshift mask number of bytes you'd like. mask out byte using binary , and bitshift result first position: target = 0xd386d209 n = 0 # 0th byte goal = 0xff << (8 * n) print hex((target & goal) >> (8 * n)) you can simplify little bit shifting input number first. don't need bitshift goal value @ all: target = 0xd386d209 n = 0 # 0th byte goal = 0xff print hex((target >> (8 * n)) & goal)

visual studio - Show error shortcut -

Image
i have error in code shown in picture. can see error when move mouse on it. how make same short key? show error short key? ide visual studio 2012 in visual studio there window called error list can show using ctrl + w + e or in menu view --> error list .

java - How do I make Apache HttpClient respect the Path in a Set-Cookie header? -

i have local server running endpoints under /server/public , /server/saml , , i'm using httpclient (v4.4.1) interact it. requests endpoint trigger (if client doesn't have session) header set-cookie: jsessionid=abc123; path=/server/ , client should have 1 session. however, if debug , @ contents of basiccookiestore , saved cookies have paths /server/public , /server/saml , resulting in 2 cookies being saved, , different session cookies being sent depending on endpoint. i'm using standard cookiespec , , see same behaviour standard strict. any ideas what's happening or how can fix it? it seems issue caused this bug caused path headers not respected. instead, client strip after last forward slash in url response retrieved from, , use cookie's path. relevant comment scott blum: namely, mixed-cased cookie attributes not being handled properly. example, if set-cookie header being parsed contained "path=/foo" attribute, path not respecte...

php - Call to a member function fetch() on boolean -

i receive error: fatal error: call member function fetch() on boolean in c:\xampp\htdocs\repo\generator\model\database.php on line 34 when run code: class database { private $user = 'root'; private $pass = ''; public $pdo; public function connect() { try { $this->pdo = new pdo('mysql:host=localhost; dbname=generatordatabase', $this->user, $this->pass); echo 'połączenie nawiązane!'; } catch(pdoexception $e) { echo 'połączenie nie mogło zostać utworzone: ' . $e->getmessage(); } } public function createtable() { $q = $this->pdo -> query('select * article'); while($row = $q->fetch()) { echo $row['id'].' '; } ...

Adding list element in HTML using jQuery -

Image
this question has answer here: dynamically appending elements jquery mobile listview 5 answers i trying use jquery add list item format has been used. however, first element (the top one) has right format 1 below (added after pressing "add entry") doesnt have same format. whole code below have extracted function creating entry. <button onclick="myfunction()">add entry</button> <script> function myfunction() { $("#mylist").append('<ul data-role="listview" data-input="#myfilter" data-inset="true"><li id="contact1"><a href="#">testcontact</a></li></ul>'); } </script> the whole code: <!doctype html> <html> <head> <meta name="viewport" content="width=device-widt...

iphone - diff: /../Podfile.lock: No such file or directory -

am new iphone app development.when running application getting bellow error. diff: /../podfile.lock: no such file or directory diff: /manifest.lock: no such file or directory error: sandbox not in sync podfile.lock. run 'pod install' or update cocoapods installation. the error message shows solution, no pods built. open terminal, go root of project, run: pod install if don't have cocoapods installed, first run sudo gem install cocoapods then repeat previous command

Wordpress wp-admin/install.php is not opening properly on windows 10 -

so, have worked wordpress 3 or 4 times , last time had problem opening install.php due me not knowing how work "wamp-server". today going start new project it´s not working properly. i have set-up wp-config.php , tried open wp-admin/install.php showing code install.php. i working wamp time again, had trouble starting due skype using port80, fixed that. i have, since friday, uppgraded computer windows 10. i´m hoping thats not problem @ same time dreading is.. hope can give me hand. i'm not expert @ all. sweden, on computer in english shouldn't problem. are trying use microsoft edge? microsoft edge runs network isolation default security reasons. to enable loopback , debug localhost server, launch edge , type in address bar : about:flags then there options this: developer settings x use microsoft compatibility lists x allow localhost loopback (this may expose device risks) these 2 options must checked.

javascript - How to go on a specific element on a page -

Image
yes, there link "how go on specific element on page" followed, before mark duplicate, read this. i tested every bit of code given on link , none of them worked. i have search field gives user option search. if search button clicked element should scrolled to. logged in console element, retrieved , shown in console, of given functions in link not work. way, bootstrap panel filled accordions, maybe why problem exists, should send me accordion atleast. //search button click $("#searchbutton").click(function() { var searchinfo = document.getelementbyid("search"); console.log(searchinfo.value); var playernamer = findplayerby(playerlst,searchinfo.value,null); if (playernamer == false){ //do nothing, if search fails } else{ console.log(document.getelementbyid("id_"+playernamer.pos)); window.scroll(0,findpos(document.getelementbyid("id_"+playernamer.pos))); } }); function findpos(o...

regex - Detecting sequencing using regexes -

imagine have multiple character strings in list this: [[1]] [1] "1-fa-1-i2-1-i2-1-i2-1-ex-1-i2-1-i3-1-fa-1-" [2] "-1-i2-1-tr-1-" [3] "-1-i2-1-fa-1-i3-1-" [4] "-1-fa-1-fa-1-nr-1-i3-1-i2-1-tr-1-" [5] "-1-i2-1-" [6] "-1-i2-1-fa-1-i2-1-" [7] "-1-i3-1-fa-1-qu-1-" [8] "-1-i2-1-i2-1-i2-1-nr-1-i2-1-i2-1-nr-1-" [9] "-1-i2-1-" [10] "-1-nr-1-i3-1-qu-1-i2-1-i3-1-qu-1-nr-1-i2-1-" [11] "-1-nr-1-qu-1-qu-1-i2-1-" i want use regex detect particular strings substring precedes substring, but not directly preceding other substring. for example, let's looking fa preceding ex . need match 1 in list. though fa has -1-i2-1-i2-1-i2-1- between , ex , fa still occurs before ex , hence mat...

php - Sorting A Multi Dimensional Array (Understanding Usort and MultiSort) -

i have array multiple database tables merged array of information needed. want sort information alphabetically name , id if same name. i viewed of following topics , not able produce working result. sort multi-dimensional array in php sorting multi-dimensional array sort multi-dimensional array in php http://php.net/manual/en/function.usort.php my array sudo dump array(3){ [0] => array(3){ ['id'] => "1", ['name'] => "slippery sasha", ['type'] => "electric eel" }, [1] => array(3){ ['id'] => "2", ['name'] => "viscious vipers", ['type'] => "snake" }, [2] => array(3){ ['id'] => "3", ['name'] => "finnic fox", ['type'] => "rabid fox" }, } code attempt // sort ...

AngularJS Array of Promises -

can me angular promises? have following functions should take in array of file objects, iterate on them, , upload each one. during each iteration, promise object pushed array of promises . within upload function have cycle function .then() attached, should not called until promise objects have resolved. think code looks correct, it's not working right. images upload, cycle(files).then() being called immediately, rather once promises array resolves. function upload(files) { var uploadcount = files.length; function cycle(files) { var promises = []; (var = 0; < files.length; i++) { var deferred = $q.defer(); promises.push(deferred); var file = files[i]; upload.upload({ url: '/photos.json', file: file }).success(function(){ $scope.progresscurrentcount += 1; deferred.resolve(); }); }; return ...

java - Regex for a formatted convention -

i want check if string conforms particular format. example of correctly written string 12/kmy(naing)056503 . first part number either 1 digit or 2 digit less or equal 15. followed stroke. second part 3 letter code. next part (naing) has spelled way texts written in format. last part 6 digit number. can regex written check if input conforms pattern? try following: (1[0-5]|[0-9])/[a-z]{3}\(naing\)[0-9]{6} i've tested against example @ http://regexpal.com/ , seems work fine.

python - Tkinter canvas not scrolling -

tkinter experts, i'm having trouble getting canvas scroll. second gui, , i've done similar before, don't know i'm doing wrong. i'd appreciate can offer. here's minimal version of i'm trying do. i'm using python 3.4.3 on windows 10. import tkinter tk import tkinter.font tk_font import tkinter.ttk ttk import random def get_string_var(parent, value=''): var = tk.stringvar(parent) var.set(value) return var class summaryframe(ttk.frame): def __init__(self, parent, **kwargs): ttk.frame.__init__(self, parent, **kwargs) var_names = ['label_'+str(num) num in range(1, 20)] self.vars = {} name in var_names: self.vars[name] = get_string_var(self) self._add_summary_labels(self, self.vars, 1) @staticmethod def _add_summary_labels(frame, vars, start_row): current_row = start_row name in vars: tk.label(frame, text=name, anchor=tk.n+tk...