Posts

Showing posts from January, 2012

ios - AFNetworking JSONRequestOperation -

ios - AFNetworking JSONRequestOperation - afjsonrequestoperation has successblock block when request succeeds, there no way set "authentication block" other on operation itself, if fails there no way send caller of afjsonrequestoperation . correct, or missing something? i expect able tell caller whole operation failed because authorization failed. actually method takes 2 block parameters success , failure afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:successblock failure:failureblock]; so in failure block should able notify caller of failure ios objective-c afnetworking

unit testing - Is it possible to change Rspec output on objects? -

unit testing - Is it possible to change Rspec output on objects? - given next spec: describe person describe "scopes , class methods" let!(:sixty_older) { factorygirl.create :person, birthdate: 60.years.ago } describe ".senior" subject { person.senior } { should include(sixty_older) } end end end its output in cli using format --documentation: person scopes , class methods .senior should include #<person person_id: 466, gender: "m", birthdate: "1953-02-07 19:44:22", birthdate_estimated: 0, dead: 0, death_date: nil, cause_of_death: nil, creator: 0, date_created: "0002-11-30 00:00:00", changed_by: nil, date_changed: nil, voided: 0, voided_by: nil, date_voided: nil, void_reason: nil, uuid: "key_4"> is possible me alter #<person person_id: ....> else? say, display person_id, birthdate , uuid? also, if can customized on per test basis , not on class-le...

jquery mobile: what is proper way to programatically fire event on a jqm Select Menu -

jquery mobile: what is proper way to programatically fire event on a jqm Select Menu - edit a: not jquery question, rather jquery mobile question. edit b: changed title ... asked how fire 'click' event specifically, apparently 'click' event not proper event utilize if want re-create jqm:select menu choice. how programatically fire event on jquery mobile select menu? <select id = 'my_select' name = 'my_select' onchange = 'gf_handle_change( this.value );' > <option id = 'option_a' value = 'a'> </option> <option id = 'option_b' value = 'b'> b </option> </select> <script> function gf_fire_event( args_val ) { alert( 'test : ' + jquery( '#option_' + args_val ) ) ; jquery( '#option_' + args_val ).trigger( 'click' ) ; } function gf_handle_change( args_val ) { alert( args_val )...

facebook graph api - auto share links using php curl -

facebook graph api - auto share links using php curl - i want auto share links in facebook wall using script : $attachment = array( 'email' => 'mail', 'password' => 'password', 'access_token' => 'my token', 'message' => "my message", 'name' => 'name', 'link' => 'my_url', 'description' => "my description" ); $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://graph.facebook.com/me/links'); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_verbose, true); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_connecttimeout,5); curl_setopt($ch, curlopt_useragent, 'mozilla/5.001 (windows; u; nt4.0; en-us; rv:1.0) gecko/25250101'); curl_setopt($ch, curlopt_postfields, $attac...

android - FragmentManager NullPointerException when trying to commitAllowingStateLoss -

android - FragmentManager NullPointerException when trying to commitAllowingStateLoss - context: have activity fragment , 3 innerfragments . when fragment ondestroy() called, want remove inner fragments fragmentmanager . code ondestroy() below. problem: fragmentmanager throws nullpointerexception , when commitallowingstateloss() called. don't understand why. @override public void ondestroy() { super.ondestroy(); if (getfragmentmanager().findfragmentbyid(r.id.fragment_framelayout_left) != null) { fragmenttransaction fragmenttransaction = getfragmentmanager().begintransaction(); fragmenttransaction.remove(mleftfragment); fragmenttransaction.commitallowingstateloss(); } } stack trace: 02-11 12:15:14.162: e/androidruntime(25911): fatal exception: main 02-11 12:15:14.162: e/androidruntime(25911): java.lang.nullpointerexception 02-11 12:15:14.162: e/androidruntime(25911): @ android.support.v4.app.fragmentmanagerimpl.execpe...

jquery - How can I expand a div to compensate for removing the bordering div's margin? -

jquery - How can I expand a div to compensate for removing the bordering div's margin? - i'm using bootstrap's responsive grid layout. need adjust 1 spot on page there's no margin between 2 columns; left column has bottom border need bring right left border of right column. how can expand div compensate removing right-bordering div's left margin? things i've been able do: i'm able dynamically set height of left div drop bottom border want it: $('#indented_block .border-bottom').height( $('#indented_block').height()-3 ); i'm able determine original width of left div: $('#indented_block .border-bottom').width() i'm able determine left-margin of right div: $('#indented_block .border-side').css('margin-left'); i'm able set left-margin of right div: $('#indented_block .border-side').css('margin-left',0); i'm not able utilize jquery .width() method add together original wi...

sql - Replace Left Outer Join Null values with a string -

sql - Replace Left Outer Join Null values with a string - i want show null values returned left outer bring together string " unregistered". when value integer or bool, write: isnull(returnedvalue, 0) returnedvalue but how can create it: isnull(returnedvalue, 'unregistered') returnedvalue i utilize ms sql server. since need varchar value in same field int/bool, need create sure every row of field has same info type. isnull(convert(varchar(50), returnedvalue), 'unregistered') returnedvalue or can utilize case as case when returnedvalue null 'unregistered' else convert(varchar(50), returnedvalue) end returnedvalue sql sql-server left-join isnull

sql - How can I reset a forgotten sa password? -

sql - How can I reset a forgotten sa password? - i using sql server 2008 r2. when installing, had chosen mixed mode of sql authentication. i have given sa user name , given password forgot password. i don't know how alter user password or delete , create new user log-in? try: exec sp_password null, '<new password>', 'sa' run sysadmin user, substituting whatever new password want. sql sql-server sql-server-2008-r2

Java: Detecting if a variable is a String or an Integer -

Java: Detecting if a variable is a String or an Integer - i'm help on bit of homework have. want user come in numerical string, convert integer. want create loop observe if user entered in wrong value such "one hundred" apposed "100". what thinking this: do{ numstr = joptionpane.showinputdialog("please come in year in numarical form:" + "\n(ex. 1995):"); num = integer.parseint(numstr); if(num!=integer){ tryagainstr=joptionpane.showinputdialog("entered value not acceptable." + "\npress 1 seek 1 time again or press 2 exit."); tryagain=integer.parseint(tryagainstr); } else{ *rest of code...* } }while (tryagain==1); but don't know how define "integer" value. want see if number or not prevent crashing if user enters wrong thing. ...

How do you set up a perforce server to work over the internet? -

How do you set up a perforce server to work over the internet? - i setting perforce server , noticed options localhosts , such. i'm trying setup server on desktop machine @ 1 household, , able connect using p4v client access files on net form household. no i'll have forwards ports , stuff set files need this? can find info servers beingness run on same network @ business or nil on internet. i've set team speak server go connect , type in ip address , port , connect server dosn't have options that, i've seen anyway. done on windows 7 64 bit machines. server on desktop , clients on desktops , laptops. help appreciated , i'll posting updates on i'm doing others can follow if needed. the server accepts tcp/ip connections, can client machine has tcp/ip connectivity. perforce server configuration telling ip address , port number hear @ p4port setting: http://www.perforce.com/perforce/r12.2/manuals/cmdref/env.p4port.html since you're on windo...

validation - Rails where to place your Activemodel::validators -

validation - Rails where to place your Activemodel::validators - this 2 part question. part 1 if model writing validations inhering activerecord::base need include activemodel::validations within class?? api rails doesnt here in yehudakatz blog seems hint that? part 2 best place set these validator files? under helpers or new model or in lib? my current validator looks this class gendervalidator < activemodel::validator def validate(record) cred = /(\d{6})(\d{4})(\d{1})(\d{2})/.match(record.id_number.to_s) #breaks id relevent sections namely birthdate, gender, nationality, validator. unless cred[0][/\d{13}/] #checks see if id valid length of numbers if isnt skip validation of gender homecoming true else birthdate = cred[1] #returns 6 digit string 'yymmdd' parsed_gender = cred[2] #returns 4 digit string '0001-4999:female 5000-9999:male' nationality = cred[3] # should homecoming either 1 or 0 1 if person foreign ...

android - The system cannot find the file specified "classes.dex" -

android - The system cannot find the file specified "classes.dex" - i have developed android module project , deployed in titanium project. when run titanium project getting err frequently [info] logfile = c:\ws\testw2\build.log [info] building testw2 android ... 1 moment [info] titanium sdk version: 3.0.0 (12/12/12 18:49 a5894b3) [info] fastdev server running, deploying in fastdev mode [info] copying commonjs modules... [info] copying project resources.. [info] tiapp.xml unchanged, skipping class generation [info] forcefulness including modules... [info] compiling javascript resources ... [info] compiling localization files [error] application installer abnormal process termination. process exit value 1 [error] exception occured while building android project: [error] traceback (most recent phone call last): [error] file "c:\users\administrator\appdata\roaming\titanium\mobilesdk\win32\3.0.0.ga\android\b...

java - Send Maven output to file in Eclipse -

java - Send Maven output to file in Eclipse - i maven output (for illustration during build) written file, console in eclipse clogs up. there way in eclipse, or have resort building project command-line using -doutputfile option? you can extend eclipse console buffer, utilize max value , fine. not utilize eclipse run maven commands. defined aliases in shell. comment seems help have set answer... java eclipse maven

What is the JavaFX TableView's method equivalent to JTable.getSelectedRow() -

What is the JavaFX TableView's method equivalent to JTable.getSelectedRow() - i need access info within tableview in programme can display window (stage) more info of elements in selected rows of table. give thanks much. to selected item table utilize next code: table.getselectionmodel().getselecteditem() selection model has other convenience methods provide info index, multiple selection, etc. jtable javafx-2 tableview

backbone.js - Backbone templates: Using HBS to dynamically switch templates -

backbone.js - Backbone templates: Using HBS to dynamically switch templates - i found this example on here of how utilize hbs plug-in manage templates. seems great solution. @machineghost suggests using requirejs include templates this: define(['template!path/to/sometemplate'], function(sometemplate) { var mynewview = baseview.extend({template: sometemplate}); $('body').append(new mynewview().render().el); } this great, except need dynamically switch templates. here illustration of 1 of views: define([ 'jquery', 'underscore', 'backbone', 'models/tablemodel', 'collections/tablescollection', 'views/tablesview' ], function($, _, backbone, tablemodel, tablescollection, tablesview) { var t = new tablescollection(null, {url: 'applications-lab'}); homecoming new tablesview({ collection: t, template: 'applications-lab-template', url: 'applications-lab...

.net - what is the reason for Multiplicity constraint violated. -

.net - what is the reason for Multiplicity constraint violated. - i having class having list of class b class { public list<b> pointcollection { get; set; } } although other articles tell class b might containing object of class not case. when fill info , seek save role 'a_pointcollection_source' of relationship 'a_pointcollection' has multiplicity 1 or 0..1. exception thrown. .note not defining relationship rather letting entity framework define on own. so, please suggest possible solutions actually, issue due saving approach using, had big code saving purpose, methods tempering pointcollection property , violating relationship of pointcollection navigation property, when debugged code, found error approached other way updating pointcollection navigation property. .net entity-framework orm entity-framework-mapping

wif - Enrich Azure ACS security tokens -

wif - Enrich Azure ACS security tokens - we considering acs our federated sts. can configure our own custom sts ip-sts, "built-in" identity providers such facebook, live , google. claims rather "poor". claims transformation in acs helps in simple scenario's. looking best-practice handle situation of "missing claims". think need place "decorating sts" in front end of acs. when acs comes security token, decorator can "enrich" security token additional claims. if claims missing, can set user interface inquire user (once) finish profile. way, regardless of user comes from, have claims application requires. thought ? "best practice" in case ? (acs doesn't seem allow programmatic extensions.) i think reply depend on exact scenario. acs not meant manage profiles , such can, , should do, regards outgoing claims limited more or less design - man-in-the-middle in all-but-one cases. apart when manag...

knockout.js - Subscribing to values from another viewmodel in knockout js -

knockout.js - Subscribing to values from another viewmodel in knockout js - i'm trying split view models multiple reuseable view models. have 1 view model contains several dropdowns , 1 button. var topview = function () { self.dropdowna = ko.observablearray(); self.selecteddda = ko.observable(); self.dropdownb = ko.observablearray(); self.selectedddb = ko.observable(); $.getjson("someapiurl", function (result) { ko.mapping.fromjs(result, {}, self); }); //this builds dropdowna $self.selecteddda.subscribe(function(newvalue) { $.getjson("anotherapi"+newvalue, function (result) { ko.mapping.fromjs(result, {}, self); }); }; // builds dropdownb $self.buttonclicked = function() { alert("i clicked!"); } } my main viewmodel looks this: var mainview = function () { var self = this; var topview = k...

bash - add new line after number of commas -

bash - add new line after number of commas - i have long line: kvm1.example.corp,18:18:48,x86_64,16,11,11,0,0,0,0,0,11,0,4.6,99056376,4980736,4980736,5450000000,1,s-75-vm,460000000.,0.385304090422,262144,0,0,3,743,0,2,v-30-vm,450000000.,0.376927914543,1048576,1,0,6,7676,4765,3,r-80-vm,430000000.,0.360175562786,131072,0,0,0,208,0,5,i-2-81-vm,10000000.,0.00837617587873,1048576,1,0,0,0,0,6,r-83-vm,430000000.,0.360175562786,131072,0,0,0,156,0,7,i-3-82-vm,710000000.,0.59470848739,524288,0,0,0,0,0,8,r-85-vm,410000000.,0.343423211028,131072,0,0,0,208,0,11,i-3-84-vm,710000000.,0.59470848739,524288,0,0,0,0,0,12,i-2-79-vm,690000000.,0.577956135633,524288,0,0,2,0,0,13,r-87-vm,420000000.,0.351799386907,131072,0,0,0,156,0,14,i-3-88-vm,730000000.,0.611460839147,524288,0,0,2,0,0 i'm trying output 1,s-75-vm,460000000.,0.385304090422,262144,0,0,3,743,0, 2,v-30-vm,450000000.,0.376927914543,1048576,1,0,6,7676,4765, 3,r-80-vm,430000000.,0.360175562786,131072,0,0,0,208,0, 5,i-2-81-vm,1000...

c# - SOAP API with DomainBox in ASP.NET application -

c# - SOAP API with DomainBox in ASP.NET application - i trying integrate asp.net application http://www.domainbox.com/ using soap api. couldn't find examples. thing offer soap resquest , response examples. question how phone call request , how response info utilize in application? request: <soap12:envelope xmlns:xsi=”http://www.w3.org/2001/xmlschema-instance” xmlns:xsd=”http://www.w3.org/2001/xmlschema” xmlns:soap12=”http://www.w3.org/2003/05/ soap-envelope”> <soap12:body> <querydomainrenewalsettings xmlns=”https://sandbox.domainbox.net/”> <authenticationparameters> <reseller>myreseller</reseller> <username>myusername</username> <passwordmy>password</password> </authenticationparameters> <commandparameters> <domainname>atestdomain.co</domainname> </commandparameters> </querydomainrenewalsettings> </soap12:body> </soap12:envelope> response: <soap:env...

How can I de-duplicate repeated characters in a Java string? -

How can I de-duplicate repeated characters in a Java string? - does there exist method in java lets transform string how________are_______you how_are_you , i.e. maintain 1 _ when duplicated. use regexp replacer: string.replaceall("_+", "_")) java string

javascript - Backbone Collection url with dynamic parameters -

javascript - Backbone Collection url with dynamic parameters - i'm writing rails app backbone.js. in rails, have route in config/routes.rb takes argument this: /api/u/foo . gets posts argument, in case foo . output of posts foo. foo user, has many posts. in backbone, need set url attribute on collection take arguments route, this: /u/foo . want go /api/u/foo.json . how this? tried taking user argument on backbone route, could't collection. the relevant part of routes.rb file: scope 'api' "/u/:user", :action => "index", :controller => "posts" end assuming foo parameter, makes sense backbone apply url fetch single user, not collection. i believe routes fine /api/u should homecoming collection , /api/u/123 single user. want send parameters /api/u?foo=bar filter collection. just send these in .fetch() phone call in backbone working. apply necessary changes in controller filter according various parame...

java - How can I align elements in JPanels / JFrames? -

java - How can I align elements in JPanels / JFrames? - i'm new using gui in java, i'm having bit of problem figuring out how align need to. have panels in jframe need align (one left, 1 right) , few buttons in 1 of panels need centered in panel. here code. package application; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.*; import java.nio.*; import java.util.*; public class main extends jpanel { public static void main(string[] args) { //set ui native os seek { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); }catch(classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception e) { } jframe frame = new jframe("application name"); menu menu = new menu(); jpanel iconpanel = new jpanel(); final jpanel grid = new ...

java - JSON, Stomp and ActiveMQ -

java - JSON, Stomp and ActiveMQ - ok, here's deal. reading this tutorial , documentation activemq website. on documentation have, under message transformations, sentence: the transformation message header on send , subscribe messages used instruct activemq transform messages text format of desire. currently, activemq comes transformer can transform xml/json text java objects and activemq uses xstream transformation needs. since it's optional dependency have add together broker's classpath putting appropriate jar lib/ folder. additionally, if plan utilize json transformations have add together jettison json parser classpath. so did this, i've annotated pojo xstreamalias: @xstreamalias("provapojo") public class provapojo implements serializable { private static final long serialversionuid = 1687248536279612587l; @xstreamalias("fieldone") private int fieldone; @xstreamalias("fieldtwo...

python - session error ? using POST using requests or urllib2 -

python - session error ? using POST using requests or urllib2 - trying authenticate website , fill out form using requests lib import requests payload = {"name":"someone", "password":"somepass", "submit":"submit"} s = requests.session() s.post("https://someurl.com", data=payload) next_payload = {"item1":"something", "item2":"something", "submit":"submit"} r = s.post("https://someurl.com", data=next_payload) print r.text authentication works , verified can post forms 1 having problem gives the action not completed, perhaps because session had expired. please seek again attempted in urllib2 , same result -- dont think issue cookie. wondering if javascript on page has giving session error? other form page doesnt have javascripts. thanks input... python python-requests

ajax - Yii upload file from cjuidialog -

ajax - Yii upload file from cjuidialog - why can't upload files cjuidialog in yii? <div class="form"> <?php $form=$this->beginwidget('cactiveform', array( 'id'=>'edit-user-form', 'enableajaxvalidation'=>true, 'htmloptions' => array('enctype' => 'multipart/form-data'), 'clientoptions' => array( 'validateonsubmit' => true, 'validateonchange' => true, ) )); ?> <fieldset> <?php echo $form->errorsummary(array($model)); ?> <div> <?php echo $form->labelex($model,'rubric_image'); ?> <?php echo $form->filefield($model,'rubric_image'); ?> </div> <div> <?php echo chtml::submitbutton('upload'); ?> </div...

C++ program to accept a string according to a particular rule (num opr num) -

C++ program to accept a string according to a particular rule (num opr num) - i have programme accepts particular string according defined rule, i.e., number operator number. example: 2+4-5*9/8 the above string acceptable. when input 2+4-a , 1 time again showing acceptable not acceptable number value should range 0 9 according rule defined. think have utilize ascii values check. refer code below: #include <iostream> #include <ncurses.h> #include <string.h> #include <curses.h> int check(int stvalue) { if(stvalue < 9) return(1); else return(0); } main() { int flag = 0; char str[10]; std::cout << "enter string:"; std::cin >> str; int = 1; int n = strlen(str); for(i = 0; < n - 1; += 2) { if(!check(str[i])) { if(str[i + 1] == '+' || str[i + 1] == '-' || str[i + 1] == '/' || str[i + 1] == '*') flag = 1; else { ...

java - Overriding JTable's DefaultTableCellRenderer to center all the cells in a JTable -

java - Overriding JTable's DefaultTableCellRenderer to center all the cells in a JTable - i've got problem can't rid of. just know, i'm new using jtables, reply might simple, can't find solution :/ so, i've got jtable using abstracttablemodel, overrides public class<?> getcolumnclass(int columnindex_p) method, tell type of each column displayed. 1 of them boolean. when create simple jtable, using table_l = new jtable(new mytablemodel()); everything fine, , boolean values correctly displayed using checkboxes (on/off). now, i'd center text on each cell (and, perchance more options later). so define new defaulttablecellrenderer each column, : defaulttablecellrenderer cellrenderer_l = new defaulttablecellrenderer() { public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { // delegate rendering part default renderer ...

How can I modify this regex to require a specific numeric range and also allow an empty string? -

How can I modify this regex to require a specific numeric range and also allow an empty string? - i have next regex: ^([1-9]){3,5}[1-8]$ it works restrict strings within range, need alter it'll allow empty string. how can this? ^(([1-9]){3,5}[1-8])?$ use (?: if care captured groups, if don't, can remove brackets around [1-9] . brackets around whole sequence must kept, though, ? quantifier still applies correctly (preceding grouping 0 or 1 times). shorter (maybe more correct) version be: ^(?:\d{3,5}[1-8])?$ this homecoming 1 match, input string whole. regex

c# - listView content with directory in windows store app -

c# - listView content with directory in windows store app - i've problem listview. want display files directory , update when appear new file/files(applicationdata.current.localfolder). how do that? my method save xml file public async void executenewfilexml() { var dom = new xmldocument(); xmlelement x; x = dom.createelement("onegoal"); dom.appendchild(x); xmlelement goal = dom.createelement("goal"); xmlelement stepone = dom.createelement("stepone"); goal.innertext = goalofyear; goalstepslist[1] = stepone.innertext; x.appendchild(goal); x.appendchild(stepone); storagefile storagefile = await applicationdata.current.localfolder.createfileasync("goal.xml", creationcollisionoption.generateuniquename); await dom.sa...

google maps - setting language for reverse geocoding Gmaps v.3 -

google maps - setting language for reverse geocoding Gmaps v.3 - do how set language reverse geocoding php response ? (always set en) **here code** <code> $api_key = "***"; $url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=uk'; $data = @file_get_contents($url); $jsondata = json_decode($data,true); if(is_array($jsondata )&& $jsondata ['status']['code']==200) { $addr = $jsondata ['placemark'][0]['address']; } echo $addr; </code> **the output is** "l'va tolstoho street, bila tserkva, kyivs'ka oblast, ukraine" if want english language alter uri variable language 'en' i.e. &language=en $url = 'http://maps.google.com/maps/geo?q=49.8411860,30.1066580&output=json&sensor=true_or_false&key=' . $api_key.'&language=en'; google maps api...

php - Which of these three options would be fastest to populate my DB table? -

php - Which of these three options would be fastest to populate my DB table? - i have (huge: 6.4 1000000 rows) database table 3 columns follows: url title description right url column populated, various urls around web. have add together title , meta description url in each row. there 3 ways see can this: option 1: utilize php , curl go each url , grab title , meta:description. (even using options 2 or 3 i'll have @ to the lowest degree part of urls). option 2: have dmoz xml file has several 1000000 elements this: <externalpage about="http://animation.about.com/"> <d:title>about.com: animation guide</d:title> <d:description>keep developments in online animation skill levels. download tools, , seek inspiration online work.</d:description> <topic>top/arts/animation</topic> </externalpage> <externalpage about="http://www.toonhound.com/"> ...

iphone - How to send a photo to my app from default iOS Camera app? -

iphone - How to send a photo to my app from default iOS Camera app? - i know app can read photos saved in ios photo-library; app can save new photo in default ios photo-library. trying accomplish this: default photos app should able send photo ios app, can share photo facebook or send ios mail service app. i want application listed in screen. note: screenshot of ios6 photo application. possible!!! this thing interesting on ios. you have tell ios kind of files app can open (see pic below) kind of file app can open set conforms to field (see kinds https://developer.apple.com/library/ios/documentation/miscellaneous/reference/utiref/articles/system-declareduniformtypeidentifiers.html) this best sample (http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app) you have implement -application:handleopenurl: in appdelegate -(bool) application:(uiapplication *)application handleopenurl:(nsurl *)url ...

android - Object orientation: Is it a good idea to handle dropbox via static methods in a single class? -

android - Object orientation: Is it a good idea to handle dropbox via static methods in a single class? - restating android based project app handle multiple litesql databases syncs dropbox. thought handle files static methods in single class 'general.class'? i've tried concept before mixed results... have tips? how handle context of calls require? //sverkersbrg android static dropbox

Webstorm 5.0.4 >No code color options -

Webstorm 5.0.4 >No code color options - i using trial version of webstorm 5.0.4 - far know trial not limited in way other 30-day period. under settings > editor > colors & fonts , it's supposed have section each code type (html, javascript etc) 1 can edit code coloring each. mine doesn't have of these. how enable them? screenshot: weird, mine seems fine (also trial). have total listing of options. , yes, trial versions don't have inherent limitations on total release, besides time limit. give eap try: http://confluence.jetbrains.com/display/wi/webstorm+6+eap beta webstorm 6, it's worth seeing if issue goes away. webstorm

jquery ui datepicker - get siblings of input on beforeShow -

jquery ui datepicker - get siblings of input on beforeShow - i using jquery's datepicker , i'm trying set array on beforeshow based on values in sibling select element. here's i've tried, it's neither working or throwing errors. beforeshow: function(input, inst) { $(input).siblings("select.startdates").find("option").each( function() { startdates.push($(this).val()) }); console.log($(input).siblings("select.startdates")) }, the log returns [] the html looks this: <input class="hasdatepicker" id="myinput" /> <div> <select class="startdates"> <option value="2013, 2, 1">01/03/2013</option> .... </select> </div> jquery jquery-ui jquery-ui-datepicker

java - How to get the current file name in plugin action class -

java - How to get the current file name in plugin action class - in intellij thought plugin action class, want java class file name user viewing. how that? in intellij idea, if click analyse -> inspect code , show window take scope, in show current file name also. similar view, want current file name in plugin action class. how that? public class myaction extends anaction { public void actionperformed(anactionevent e) { virtualfile vfile = e.getdata(platformdatakeys.virtual_file); string filename = vfile != null ? vfile.getname() : null; } } java plugins intellij-idea intellij-plugin

sql server - Using KILL with a declared variable -

sql server - Using KILL with a declared variable - i'm trying utilize kill statement declared variable it's giving me syntax error. there anyway not utilize constant , programatically alter spid? for example: declare @spid smallint set @spid = 100 kill @spid btw example. need run kill in loop cursor rid of old persistant user connections. (don't ask) i think you're going need dynamic sql this. read this essential page before doing dynamic sql, please. declare @spid smallint declare @sql nvarchar(1000) set @spid = 100 set @sql = 'kill ' + cast(@spid varchar(4)) exec (@sql) sql-server tsql

iphone - iOS - View Transition open and close -

iphone - iOS - View Transition open and close - in latest expedia app ios, have interesting effect trying wrap head around. when tap on tile flip , zoom animation. can please help me same uiview transition. i've wanted utilize kind of animations in app well, have written simple custom segue - can take between multiple types of flips! it's called ibcellflipsegue, give seek , allow me know think! https://github.com/iblabs/ibcellflipsegue ios iphone ipad animation

How do I simulate hover with Javascript on keydown? -

How do I simulate hover with Javascript on keydown? - first of, i'd utilize native javascript finish task. let's create custom dropdown, , html code looks kind of this. <div class="dropdown"> <span class="dropdown-label" style="display:block">select thing</span> <ul class="dropdownitemcontainer"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> </ul> </div> in css file have close this: ul.dropdownitemcontainer li:hover { background-color: #ff0000; } yeah, there's no dropdownish behavior, it's not point of give-and-take actually. problem couldn't think of decent way enable keyboard command dropdown. desired outcome following: press downwards key, , first alternative highlighted; press again, , sec alternative highlig...

ruby - Speed of a program using 'require' -

ruby - Speed of a program using 'require' - class illustration attr_accessor :test end = example.new if have class want use, example , way of holding in 1 file, faster using 'require' class different file? if so, how important difference talking about? no. isn't faster. honestly, doesn't create difference @ all. the advantage putting in separate file that: other files can utilize using require phone call it's easier maintain track of things , maintain if need to. ruby require

javascript - how to change src of img tag using Jquery -

javascript - how to change src of img tag using Jquery - this question exact duplicate of: how alter src of img using jquery 1 reply this might straightforward, want alter src of img tag within li tag. there 4 li tags , li tag has class active should alter it's img tag's src. <ul> <li><img src="example.jpeg" /></li> <li class="active"><img src="notexample.jpeg" /></li> <li><img src="example.jpeg" /></li> <li><img src="example.jpeg" /></li> </ul> moreover, active class toggles between li tags alter source... ... ... //code changing class ... ... $('li').each(function() { if($(this).attr('class').indexof("active") !== -1) { //active class applied $(thi...

Passing argument to constantly running Python application -

Passing argument to constantly running Python application - i have running python code on linux, every outside info needs fed code python code can alter file. how go structuring python code receives these arguments farther processing? i found stuff on outgoing args, running external programme using pipes , passing arguments in python but looking in coming args flexible how arguments passed down you need kind of inter process communication. for example, can feed program's standard input. can read reading sys.stdin , requires programme started process give handle process. another way create socket of kind. that's far more scalable, allows connecting programme when it's running on machine, , allows non-python processes communicate process. python

javascript - jQuery toggle divs not working -

javascript - jQuery toggle divs not working - i'm trying create 2 divs, , when 1 clicked, hides other. here's code: <head> <script src="jquery-1.9.1.min.js"></script> <script> $("#top").click(function { $("#box").toggle(); }) </script> </head> <body> <div id="top"></div> <div id="box"></div> </body> but when click on top , nil happens. edit: changed to: $(document).ready(function(){ $("#top").click(function { $("#box").toggle(); }) }); and it's still not working edit2: turns out missing brackets in click(function) you missing brackets $("#top").click(function() { ^^ and since jquery above html binding need wrap jquery in document.ready wrapper, example: $(function(){ // code }); alternativ...

How do you register for custom events in Dart using the new streams API -

How do you register for custom events in Dart using the new streams API - i'm trying register customevent (https://developer.mozilla.org/en-us/docs/dom/event/customevent) in dart. old code was: class="lang-dart prettyprint-override"> window.on['foo'].add((e) => print(e.detail)); the new streams api has changed way register events. how register customevents using new api? the thought custom events declared , used same way built-in events. so custom event, you'd along lines of: class="lang-dart prettyprint-override"> class datagenerator { static eventstreamprovider<event> dataevent = new eventstreamprovider('data'); } then listening on elements: class="lang-dart prettyprint-override"> datagenerator.dataevent.fortarget(element).listen(...); this cleaner 1 time element subclassing supported , events fired straight on element, , when event subclassing allows more useful event typ...

how to use omxcodec in android for all version -

how to use omxcodec in android for all version - i want decode , display h264 frame on screen. wanted utilize omx codec decode frames decodes in hardware helps accomplish fps high resolutions. till come know there different way access hardware decoder. come across names stagefright, omxcodec, openmax. these different things. want decode frame frame. , upto knowledge android libraries take file path or url of media. here requirement different. need decode frame frame. can tell me can start digging? come know in latest version of android, have published api decode. want back upwards version of android. suggestion or guidance great. thanks. you right, indeed @ top level libstagefright library has "stream" interface. is, create audio- or video-source, configure codecs, , start process of encoding or decoding. however, using interface omxcodec can obtain access individual frames. unfortunately, not know source of official omxcodec documentations. the source...

java - Why do my programatically added TableRows not float in line with my table-header? -

java - Why do my programatically added TableRows not float in line with my table-header? - my goal: i trying populate table(with headline created in xml) bunch of programmatically added views. plan add together textviews tablerow , add together tablerow final table created. tried follow this tutorial. my problem: the programmatically added views not go inline columns xml-created textviews dictate. please see next screenshot: my code: 1.) xml <tablelayout android:id="@+id/tableviewtable" android:layout_width="match_parent" android:layout_height="wrap_content" > <tablerow android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" > <textview android:layout_width="wrap_content" android:la...

c# - Pass dictionary of data to MVC view from controller "synchronously" -

c# - Pass dictionary of data to MVC view from controller "synchronously" - my view show results multiple cases, have 3 type of results panel and each result should show items match result panel type i create partial view display each 1 item make loop display items in each result panel a view 3 result panel each panel - coded html div - have partial view sub items what i'm thinking find away pass dictionary type string key , list of items - list - , in each partial command phone call pass dictionary item kind of panel like <%= html.partial("mypartialcontrol",mydictionary["kindofpanel"] %> so how pass dictionary view synchronously? there thought issue specially hole view should refreshed each 5 sec ! doing json or ajaxing solution. the word asynchronously. if want update portion of page without reloading whole page, done asynchronously ajax. if in first case have view (based on above) ...bla <div id="my...

c# - Make User Control load before page -

c# - Make User Control load before page - i have 3 parts site, site master, user command (inside site master) , general page. when user logs in redirected general page. user command dropdownlist of different accounts (auto select first account) get's username , runs stored procedure pull info siteid session variable. then in general page set labels users information. code. if (session["siteid"] != null) { siteid = int.parse(session["siteid"].tostring()); populateaccountdata(); populateaccountinformation2(); populatesitenodes(); populatesitemap(); } else { labelsitename.text = "no site selected"; } the problem when page loads first time not have session["siteid"] , have nail refresh load. i new asp.net i'm not sure if i'm doing right, how load first time? use : ispostback look : /...

quantmod - ploting multiple objects from a function in R -

quantmod - ploting multiple objects from a function in R - i'm trying function chart quantmod chart , rect's on top. it's working fine when running cmd when wrapping within function either rect showing , or graph showing, or neither showing. illustration code : f1 <- function() { require(quantmod) s <- get(getsymbols('prgo'))["2012::"] chart_series(s) u<-par("usr") d<-data.frame(buttom=c(100,90),top=c(110,95)) rect(u[1],d[,'buttom'],u[2],d[,'top'],col=rgb(1,0,0,alpha=0.2),border=0) } you might need run plot.new() if homecoming chart object function , print it, works haven't found way of returning both chart object , rect's (the rect list well) i understand functions work in temporary environment - haven't found way of running function in global env. don't know how assign rect chob in global env. the function plotting - want add together more lines, labels etc'. thanks. i...

vb.net - Visual Basic 2010 - Create a class where the user can enter variables in then save it to reference in a table later -

vb.net - Visual Basic 2010 - Create a class where the user can enter variables in then save it to reference in a table later - unfortunately me book brought on visual basic 2010 doesn't cover , can't find solved anywhere else. as part of coursework need create programme , within programme need have used 2 classes. the classes similar if can one, can other. have form lots of info entry boxes when fill in info online. have name, address etc, in different boxes , click save , you're done. i want take different variables entered , save them class, because i'll saving more 1 figured i'd need database each time come in new client client id needs go one, 0001, 0002 etc. want view , able sort entries in table on separate form. can offer step step guide this. if not utilize code , seek , explain help me out hell of lot. understand coding , stuff don't need explain loops , iterations , code means. thank much in advance. what need do: cr...

winforms - Copy gridView rows -

winforms - Copy gridView rows - how can re-create (devexpress) gridview rows other gridcontrol in form? write illustration please. kid form. public partial class frmselectinvoice : devexpress.xtraeditors.xtraform{ public valinorentities valinor; public bindingsource src; public frmselectinvoice() { initializecomponent(); using (this.valinor = new valinorentities()) { this.valinor = new valinorentities(); this.src = new bindingsource(valinor.invoices_head, null); gridcontrol1.datasource = src; src.datasource = valinor.invoices_head; } } private void button1_click(object sender, eventargs e) { this.close(); } } i suffering same pain. able develop solution , works without problem. have provided basic code build own solution. can accomplish goal in 2 steps. step1 : re-create grid-view row(s) clipboard [press ctrl+c] step2 : paste clipboard info (or same) grid-view [press ctrl+v] step 1: sample codes - - -...

parsing - How to get all rows of a column by providing its name using JSOUP in android? -

parsing - How to get all rows of a column by providing its name using JSOUP in android? - i using jsoup library parse html in android app.this column in html page want parse: <td width="9%" rowspan = 2>days</td> now want rows of column.i using next code accomplish goal success far away: stringbuilder s = new stringbuilder(100); document doc = jsoup.parse(htmlpage); elements links = doc.select("table tr.day"); (element link : links) { string linkhref = link.attr("href"); system.out.println(linkhref); s.append(linkhref); string linktext = link.text(); system.out.println(linktext); s.append(linktext); } i searched lot of no avail.please help me.thanks in advance. assuming html looks similar this: <table> <tbody> <tr> <td width="9%" rowspan="2">days</td> <td>a</td> <td>b</td> <td>c...

excel - Error: Unable to get the AutoFilter property of the Range class -

excel - Error: Unable to get the AutoFilter property of the Range class - in next code, receive above-named error, only on sec phone call autofilter(). string filtervalue1 = tbsyscat1.text.filterdoesnotcontain(); string filtervalue2 = tbsyscat2.text.filterdoesnotcontain(); string filtervalue3 = tbsyscat3.text.filterdoesnotcontain(); string[] syscat = new string[6]; // edit: tried object[]; still got error syscat[0] = filtervalue1; syscat[1] = filtervalue1.toupper(); syscat[2] = filtervalue2; syscat[3] = filtervalue2.toupper(); syscat[4] = filtervalue3; syscat[5] = filtervalue3.toupper(); vapplication.activesheet.range[vworkingrange].autofilter(9, missing.value, missing.value, missing.value, true); vapplication.activesheet.range[vworkingrange].autofilter(9, syscat, msexcel.xlautofilteroperator.xlfiltervalues, missing.value, true); note: filterdoesnotcontain() extension method add together excel-specific wildcards "does not contain". from other research, e...

Android - Signal Strength in Level, DBM, and ASU -

Android - Signal Strength in Level, DBM, and ASU - i writing application client wants gather info regarding signal strength @ set intervals. currently using code: private static class myphonestatelistener extends phonestatelistener { @override public void onsignalstrengthschanged(signalstrength signalstrength) { super.onsignalstrengthschanged(signalstrength); telephonymanager.listen(phonestatelistener, phonestatelistener.listen_none); infostore.setsignal(string.valueof(signalstrength.getgsmsignalstrength())); } }; this works fine, client wants signal strength in both level (i guess how many bars?), dbm, , asu. anyone have clue how read signal strengths using different forms? in android 4.x signalstrength class has getasulevel, getdbm, getlevel (bars) methods. if need work older android versions, have @ source code , can re-create implementations of methods over. http://grepcode.com/file_/repository.grepcode.com/java/ext/com.google.andro...

Excel undo button -

Excel undo button - when alter value in cell, undo alternative not available. because have vba programming code in background , how can enable undo? another question. when seek save excel file offers me xltm format. since don't have macro (but have vba code) have saved xlsx. looks works now, vba code in background. difference between xltm , xlsx format if there any? are changing cell value using code? regarding file types, xltm macro-enabled template. 2007 onwards 2 main file types xlsx , xlsm. xlsx, not contain vba, xlsm macro-enabled , can contain vba. excel-vba excel-2010

sqlite - sqlite3 - how to use with C++ -

sqlite - sqlite3 - how to use with C++ - this question has reply here: symbols _sqlite3_open not found error 3 answers i'm finding several sources of illustration code (such found here) suggest including allow library used. doesn't seem work me. right way start project using sqlite in c++? the next error i'm getting back: undefined symbols architecture x86_64: "_sqlite3_close", referenced from: _main in ccjxxmwk.o "_sqlite3_errmsg", referenced from: _main in ccjxxmwk.o "_sqlite3_exec", referenced from: _main in ccjxxmwk.o "_sqlite3_free", referenced from: _main in ccjxxmwk.o "_sqlite3_open", referenced from: _main in ccjxxmwk.o include amalgamation (the sqlite3.c file) in project (and ensure it's compiled c, not c++). alternatively, link sqlite library. c++ sqlite

change img src and unbind hover on menu selection jquery -

change img src and unbind hover on menu selection jquery - first question using stackoverflow! yay! i have site i'm developing. uses images menu options, , on hover, i've changed img src in jquery when click menu want go to, want image on hover remain there. did this: $("#one").click(function(){ $(this).attr('src', 'images/hover1.jpg'); $(this).unbind('mouseleave mousehover'); so successful upon menu click, cant hover image go away, , doesnt hover anymore (cause unbinded it) - binding upon menu click wasnt working. any suggestions? first of all. think recommend create css solution here. i checked out javascript file , did modifications in browser. build possible working solution. $(document).ready(function() { var hoverfuncin = function(){ $(this).attr('src', $(this).attr('src').replace(/(\d)(\.jpg)$/g,'$12$2')); }; var hoverfuncout = function(){ $(this).attr('src', $(this).attr(...