Posts

Showing posts from July, 2010

Encrypt data using c# and decrypt it using openssl api, why there are lots of trashy padding at the end of decrypted data? -

i using rsa(1024) encrypt/decrypt strings. encryption implemented using public key , written in c#, , decryption implementation c. encrypt string: 86afaecb-c211-4d55-8e90-2b715d6d64b9 and write encrypted data file. then, using openssl api read encrypted data file , decrypt it. however, got output as: 86afaecb-c211-4d55-8e90-2b715d6d64b9oehebjq8fo1amdnor1d3blupyq9wjbaov+m/wvnyzyr pjbkoskoj+4lanpt+spkfk81nsnqebhbjgao4ehnu+pmwl9 it seems there trashy padding @ end of original string. why occurs? , how solve problem? some code snippet shown below: // encrypt { string plaindata = “86afaecb-c211-4d55-8e90-2b715d6d64b9”; rsacryptoserviceprovider rsa = new rsacryptoserviceprovider(); rsa.importparameters(parapub); byte[] testdata = encoding.utf8.getbytes(plaindata); byte[] encrypteddata = rsa.encrypt(testdata, true); filestream pfilestream = null; string filename = "encrypteddata.dat"; pfilestream = new filestream(filename, fi

java - How to display ArrayList items in a JComponent -

i have this: arraylist lovely = new arrylist(4); lovely.add("tall, short, average"); // line 1 lovely.add("mangoes, apples, bananas"); // line 2 lovely.add("this, that"); // line 3 lovely.add(“1, 2, 3, 4, 5, 6”) // line 4 i'd have array list displayed in such way each category shows in own line, how google list search results. know how this? i'd such displayed in jcomponent, not sure of 1 use, nor how this. java programmers use jtextfields , jtextpanes, or use. help here appreciated. java programmers use jlist . can constuct this: new jlist(lovely.toarray()) it displays each item in separate line in list.

hibernate - Grails - DuplicateKeyException -

i have got following piece of code adds new object database. firstly takes object db , add final object. few lines of code classc c = classc.findbyname(cname) classd d = new classd( name: "whatever", classc: c ) print "aaa\n" classc.withtransaction { c = c.merge() // c.save(failonerror: true, flush: true) } print "bbb\n" // classd.withtransaction { // d = d.merge() // } // print "ccc\n" classd.withtransaction { d.save(failonerror: true, flush: true) } print "ddd\n" i have got following error: aaa bbb 2013-07-31 13:57:14,279 error jobrunshell - job default.1 threw unhandled exception: org.springframework.dao.duplicatekeyexception: different object same identifi

c++ - Storing path from A*, using operator::new with boost::multi_array -

i'm trying use dynamic memory allocation first time. want allocate memory 2 dim dynamic array, store paths a* function. think array job boost::multi_array. problem seem able allocate memory can't change or access of elements. #include <iostream> #include "boost/multi_array.hpp" typedef boost::multi_array<int, 2> array_type; int main() { array_type *a = new array_type; a->resize( boost::extents[2][2] ); a[1][1] = 2; std::cout << a[1][1] << std::endl; delete a; return 0; } compiler says : c:\coding\code projects\c++\source files\console\main-read.cpp|14|error: no match 'operator<<' in 'std::cout << boost::multi_array_ref<t, numdims>::operator[](boost::multi_array_ref<t, numdims>::index) [with t = int; unsigned int numdims = 2u; boost::multi_array_ref<t, numdims>::reference = boost::detail::multi_array::sub_array<int, 1u>; boost::multi_array_ref<t, num

highcharts - how to display both the series value in plotoptions mouseover event -

using tooltip formatter can display both series name , value when same done using plotoptions event mouseover not able series name , value tooltip: formatter plotoption: mousover mouseover: function () { $.each(this, function (i, e) { $reporting.html('x: ' + this.x + 'category: ' + this.series.name + ', y: ' +highcharts.numberformat(math.abs(this.y))); }); } example of using in mouseover mouseover: function () { console.log(this); var series = this.series.chart.series, x = this.x, y = this.y, output = 'x: ' + x + 'y: ' + highcharts.numberformat(math.abs(y)); //loop each serie $.each

How to prevent loading of knockout.js by requirejs? -

i'm using requirejs loading majority modules, need load single script knockout.js old-fashioned manner using: <script src='/path/to/knockout.js' ></script> i have trouble it, when page rendered see markup: <script async="async" type="text/javascript" src="knockout.min.js"></script> but don't want load knockout using require.js. how disable loading using require.js specified script? i found solution: after digging sources of knockout , found interesting pice of code, determine existance of require.js , automatically registers module in require , here guilty chunk of code: // support 3 module loading scenarios if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { // [1] commonjs/node.js var target = module['exports'] || exports; // module.exports node.js factory(target); } else if (typeof d

sql - Check if variable can be cast against a dynamic datatype -

i creating import application in vb.net sql server 2008 database. trying make import generic possible reduce maintenance in future. therefore gets available columns preset list of tables in can import into. the main problem have gotten point doing error trapping. try check see whether value being imported castable data type of field in database. example, if want import date database mistakenly put address field instead, want pick , alert user. so, have vb datatable same schema database table , value go datatable. below have (which not alot): private sub setvalue(targetdatatable datatable, columnname string, value string) dim dbtype type = targetdatatable.columns(columnname).datatype ???? end sub i have done research reflection still requires me define datatypes. there other ways of doing this? don't think there way automatically type, according msdn there 18 types supported should manageable. private sub setvalue(targetdatatable datata

sql - Ratings query - percentage of ratings for specified id over ratings for ALL ids -

i have inherited following query, gets average rating specified "try" (rugby jargon touchdown). can still work it. select i.id, i.title, ( case when count( r.rating ) > 0 ( sum( r.rating ) / count( r.rating ) ) else 0 end ) rating, coalesce( er.id, 0 ) has_existing_rating ( select 1 id, 'try 1 – israel dagg v chiefs.' title union select 2 id, 'try 2 – israel dagg v chiefs.' title union select 3 id, 'try 3 – leilia masaga v crusaders.' title union select 4 id, 'try 4 – israel dagg v chiefs.' title union select 5 id, 'try 5 – fred flintstone v hurricanes.' title union select 6 id, 'try 6 – israel dagg v chiefs.' title union select

sql - Grouping of top 80% categories -

i need sql query grouping category present quantities of groups in total contain @ least 80% of categories, other rare categories (containing 20% of total) should represented "other". so result of such query grouping apples category color should this: red 1118 44% ) yellow 711 28% > @ least 80% green 229 9% ) other 482 19% how that? i combination of aggregation , analytic functions. colors put in "other" category when cumulative sum of rarest under 20%: select (case when cumcntdesc < totalcnt * 0.2 'other' else color end) color, sum(cnt) cnt (select color, count(*) cnt, sum(count(*)) on (order count(*) asc) cumcntdesc, sum(count(*)) on () totalcnt t group color ) t group (case when cumcntdesc < totalcnt * 0.2 'other' else color end) here sql fiddle.

php - Javascript error: Object #<HTMLFormElement> has no method 'getElementById' -

i'm getting javascript error: object # has no method 'getelementbyid'. i'm trying have button transfers selected element select box in html. have looked everywhere nobodies solution seems work me =\ javascript <script language="javascript"> function adddivision() { var selected = document.frmsubmit.getelementbyid("selecteddivisions"); var div = document.frmsubmit.getelementbyid("divisions"); var divid = div.options[div.selectedindex].value; var divtext = div.options[div.selectedindex].text; var newoption = document.frmsubmit.createelement(divid); newoption.text = divtext; selected.add(newoption,null); } </script> html <div id="content"> <form id="frmsubmit" name="frmsubmit" action=""> <div id="step1content"> <h2 style="float:left">step 1:</h2><p style="float:left; padding-top:10px; pa

python - Django Nonrel Groups Issue -

django nonrel groups issue django nonrel branch version 1.4 of django being used. groups from: https://github.com/django-nonrel/django-permission-backend-nonrel the admin section works fine. able create groups, assign them users. now adding them template throws error. {% group in user.groups.all %} {{group.name}} {% endfor %} the error getting is: this query not supported database. i believe user.groups list of keys groups. don't think djangotoolbox or djangoappengine generate query list of keys. can try updating djangotoolbox handle case, or more easily, can issue query outside template group.objects.filter(id__in=user.groups) , , pass template.

Sending Post data to a webserver - Android -

this question has answer here: what apache-httpclient/unavailable error (android, google app engine)? 2 answers i send post request webserver. used webhosting service before , changed managed server. message in log file of webserver: xxx.xx.xxx.xx - - [31/jul/2013:14:26:47 +0200] "post /phpscript.php http/1.1" 200 59622 "-" "apache-httpclient/unavailable (java 1.4)" "www.wpxxxxxxx.server-xx.xx" the script should send mail never received mail. post request sent android application. hope can give me clue solve problem. take @ answers on thread - android http user agent . it looks post getting received (you wouldn't have log statement server side if not). user-agent automatically set if not explicitly changed.

android - Tons of errors when starting a virtual device -

i'm starting android (having programmed java in text editor) , appreciate input. downloaded adt bundle suggested, packages sdk manager. next set nexus 4 virtual device, default ram value of 1907mb. after reducing ram 768mb suggested, still dozens of errors in logcat when launching virtual device. however, using different device not errors? so here questions: did wrong? nexus series particularly bad program (the nexus10 virtual device shows black screen...not errors, though nexus7 seem work)? i have 16gb ram, i7-2500k@4ghz, samsung 830 ssd, clean win7 x64, yet emulator quite slow. normal (would totally understandable) or virtual device smooth else me? is adt bundle way go or should have downloaded eclipse , sdk separately? thank in advance help! edit: posting first , last few of errors (the log file errors ~45kb, 362 errors in total) 08-01 05:42:42.007: e/batteryservice(292): usbonlinepath not found 08-01 05:42:42.007: e/batteryservice(292): wirelessonlinepath not

Fusion Table layer dropdown query pan and zoom not working -

i trying google map pan , zoom selected dropdown option. dropdown query working new coding , can't figure out wrong code map pan , zoom query results. column heading "query" on google fusion table, getting confused. here example of want map do: http://www.geocodezip.com/geoxml3_test/www_advocacy_ucla_edu_assembly_mapc.html and got sections of pan/zoom code from: http://www.geocodezip.com/geoxml3_test/v3_so_fusiontables_pan2marker.html and, here code: <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <!-- <link href="style.css" rel="stylesheet" /> --> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var tableid = '15woskaehc0gcpu_n6

sql - how to run tsql from a remote system in command prompt -

i wanted know how run tsql statement remote system connecting other system , run tsql statement through command prompt. i have tried following code code doesnt run on other system. ps: other system doesnt have sql server installed compulsory use command prompt run system. sqlcmd -s 100,1433\mssqlserver -u sa -p abc -i c:\table.sql -o c:\output.txt sql server 2000 - osql utility there's file called osql.exe using job. file comes sql server 2000 (52 kb). can run in cmd simmiliar arguments sqlcommand. remember use go after each batch example select * sales [enter] go [enter]

javascript - How to tell if square reader is encrypted or not -

my company purchased old square reader, seller claims unencrypted. trying develop web application uses reader. reader supposed fire hard return keypress event after registering swipe - has never done (using javascript event listeners). time reader using ios square register app - app recognize reader , swipe (though terrible job, asking me 'retry swipe faster' few dozen times before registering swipe) the fact works in app leads me believe encrypted reader. there way tell if assumption correct? without taking apart. also, tips on troubleshooting appreciated. thanks i think you're pretty lucky able detect @ javascript event listeners seem imply.... imagine privacy intrusions we'd have on (maybe already) if javascript stealthily downloaded web site gain access microphone and/or microphone jack want do. might possible, phone 'ifrastructure' designed 'resist' this. i think you're going have write app installs user permissions acc

java - How to implement Single Sign On using Spring and Active Directory -

i have spring based web app implement single sign on solution on. the basic flow be: 1) user logs in windows workstation/desktop pc (authenticating against organisation's active directory) 2) user opens browser , navigates spring web app. 3) spring web app somehow confirms user authenticated against ad , seamlessly lets them in. i.e. no challenge username , password. infact, spring web app never show login form. obviously it's step 3 having trouble with. i have looked @ spring security, kerberos, spnego think i've confused myself. if makes difference using java 6, running on jetty spring 3. jetty instance running on *nix machine. i have implemented same thing client. using spring-saml in our spring based web application (acts service provider) , adfs identity provider(idp). you can take this link configuration part. out if face problem related implementation or setup issue. basically web-app act sp , adfs treated idp. need exchange both met

jquery - Ajax update return a view or just demical? -

i have shopping cart summary table view: <tbody> @foreach (var line in model.cart.lines) { <tr> <td>@line.product.name </td> <td style="text-align: center; padding: 0">@html.dropdownlist("quantity", new selectlist(viewbag.items system.collections.ilist, "value", "text", line.quantity), new { data = line.product.productid, @class = "quantity" })</td> <td>@string.format("{0:00,0 vnĐ}", line.product.price)</td> <td>@string.format("{0:00,0 vnĐ}", (line.quantity * line.product.price))</td> <td style="text-align:left"><a href="@url.action("removefromcart","cart",new{proid= line.product.productid, returnurl= request.url.pathandquery})"><img src=&q

iphone - UITableView scrolling problems when inside a UIScrollView -

i have uiscrollview (with paging) add 3 uiviews. each of these uiviews has uitableview inside. so, user should able scroll horizontally page wants , scroll vertically in corresponding table. however, of tables don't receive scrolling gestures. first 1 behave good, other ones not. can't select cells nor scroll table or down. i used default settings uiscrollview, except these ones defined in viewdidload: - (void)viewdidload { [super viewdidload]; //load view controllers [self loadviewcontrollers]; //configure scroll view self.scrollview.pagingenabled = yes; self.scrollview.contentsize = cgsizemake(cgrectgetwidth(self.scrollview.frame) * viewcontrollers.count, cgrectgetheight(self.scrollview.frame)); self.scrollview.showshorizontalscrollindicator = no; self.scrollview.showsverticalscrollindicator = no; self.scrollview.scrollstotop = no; self.scrollview.delegate = self; //configure page control self.pagecontrol.numberofpa

javascript - how to access the elements which created using the jquery insertAfter method -

i have select tag when change i'm showing input user , when user change select tag multiple times element insert after each other want remove old input after changing select tag , insert new related input. just keep track of reference element then... var element; $("#sel").change(function () { var sel = $(this); if(element)//check if input has been created element.remove();//remove old input dom element = $("<input/>").val(sel.val());//create new input , store reference element.insertafter(sel);//insert new input dom }); $("#sel").change(); here working example because insertafter function of element creating, must creating reference in current code anyway. need store reference globally. each time change select, can check if reference has value , remove dom.

install4j - How to avoid application start after cancel auto update on startup? -

today need deactivate auto startup of main application after abort update process. update triggert automatically during startup used "silent version check" template. can't find option deactivate automatic startup. it necessary update version if there newer installed 1 before starting main application. using version 5.1.5. in advance hardie if requirements more complex, cannot use automatic launcher integration. on launcher integration tab of updater, click on "start integration wizard". wizard give code snippet can invoke in main method of application in order start updater. surround code snippet with if (updatechecker.getupdatedescriptor(update_url, applicationdisplaymode.gui).getpossibleupdateentry() != null) { // code snippet integration wizard launch updater } so updater invoked if update available. then, if not receive call prepareshutdown, can display warning , close application.

Updating Bootstrap to version 3 - what do I have to do? -

i'm new bootstrap , have older version 2.3.2. version 3 has been released. replace css , javascript files if want use latest version? download latest version http://getbootstrap.com/ or replace css , js files newest versions or use cdn ( http://www.bootstrapcdn.com/ ) migrate html, yes indeed read http://bootply.com/bootstrap-3-migration-guide . try http://twitterbootstrapmigrator.w3masters.nl/ or http://code.divshot.com/bootstrap3_upgrader/ (provide checklist too) images not responsive default in twitter bootstrap 3? styling twitter's bootstrap 3.x buttons change navbar color in twitter bootstrap 3 remove html5shiv cause tb drops support ie7 , firefox 3.x add html5shiv.js add support of html5 elements ie8 add respond.js ( https://github.com/scottjehl/respond ) media query support in ie. note won't work cdn, see: ie8 issue twitter bootstrap 3 if use glyphicons, have add them http://glyphicons.getbootstrap.com/ ( icons have been moved separate

java - Hibernate criteria: dto as entity -

i have query built hibernate criteria (i show "main" part): criteria criteria = sessionprovider.get().createcriteria(user.class); // add other stuff query joins, group-bys, order-bys etc. // in projection list add "id" of user. projectionlist.add(projections.property("id"), "id"); // using same entity class user dto criteria.setresulttransformer(transformers.aliastobean(user.class)); so can do: list<user> users = criteria.list(); problem comes when try load values entities. example: users.get(0).getfirstname(); returns null. entities created "dtos" transformers.aliastobean have received "id" projection not working normal entities loaded get/load/etc. is there way make these dto "working" entities? seems passing argument in projectionlist wrong, need modify projectionlist this. criteria criteria = sessionprovider.get().createcriteria(user.class); //add other stuff query joins, group

javascript - Why is this script only work on double click rather than single click? -

code: <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script> $(document).ready(function () { $('.click1').click(function () { $(".show1").fadein(400); }); $('body, .click1').click(function() { $('.show1').hide(); }); }); </script> the script above works in order fadein needs clicked twice. how can change shows when clicked once? for use case, can apply event listener body of document (in case, you're listening when click happens anywhere on page). once event occurs, can see clicked (evt.target) , there conditionally fire functions. http://codepen.io/snypelife/pen/fcjiw $(function () { $('body').on('click', function (evt) { if($(evt.target).hasclass('click')){ $('.show').toggle('fade'); } else { $('.show').fadeout(); } }); });

Oracle sql group by then sort -

i'm trying split query results 2 groups, ones have flag of y , ones have flag n. need sort groups based on 2 things. here's query i've tried doesn't work group bit: select location, country web_loc_info flag = 'y' or flag = 'n' , available_online = 'y' group flag order country, location_desc any great in advance replies it might worth clarifying "group" in oracle (from group by operation) 1 or more rows of raw data has been consolidated single row in result. recall that: select flag web_loc_info group flag order flag is equivalent to select distinct flag web_log_info order flag (if flag column contains y , n values, both queries return 2 rows.) so, in future, when think "group" ask if mean "summarize data there's 1 row each group value" (in case "y"/"n" values in flag column) in case group by

javascript - Array doesn't keep content, maybe something with declaration -

this question has answer here: how return response asynchronous call? 21 answers i have array declared in else structure var days = new array(); $.ajax({ url: 'someurl', datatype: 'jsonp', success: processjson }); i process data ajax call in processjson function function processjson(jsondata) { var weather = jsondata.data.weather; for(var key in weather) { var day = weather[key]; days.push(new array(day.tempmaxc, day.type)); } } i add other arrays days-array. if check in console (in processjson-function), length three/ then when want use variable in code under the ajax-call, nothing works , when check length it's 0. guess it's declaration? is code under ajax call happening after processjson function? call processjson function asynchronous , happens after ajax call finishes. co

Export both Image and Data from R to an Excel spreadsheet -

it simple print image , save on disk just: fit <- lm(some ~ model) png(filename="your/file/location/name.png") plot(fit) dev.off() write data excel spreadsheet just write.csv(rnorm(10),"some file",sep=",") my question how 1 redirect both above in spreadsheet. word, output graph paired withs image/plot on excel workbook? thanks, i use xlsx package. check out addpicture function , adddataframe function. found package easy work with.

jquery marquee-like animation for a div with overflow:hidden and nowrap? -

i have block element song-title (an absolutely positioned h1 max-width, nowrap , overflow:hidden) needs limited 650px wide. if width of h1 650px, need start animation scrolls div horizontally, , forth, in ping-pong-like manner. how go animating scroll? i know not efficient or best way solve problem, ended creating 2 jquery functions, accomplish task: $.fn.pingpongscroll = function () { var delay = 30; $(this).wrapinner('<span>'); var contentwidth = $(this).children('span').width(); var boxwidth = $(this).width(); if (contentwidth > boxwidth) { var startindent = parseint($(this).css('text-indent')); var currindent = startindent; var left = true; $(this).pingpongscrollstep(contentwidth, startindent, currindent, left, delay); } }; $.fn.pingpongscrollstep = function (contentwidth, startindent, currindent, left, delay) { if($(this).length != 0) { thisdelay = delay;

promise - AngularJS: Creating a $http service -

i'm little new angular, , i'm trying set simple rpc implementation uses angulars $http service (factory) work. here's have service far: 'use strict'; angular.module('xxx') .factory('rpcservice', function ($http) { return { request: function(method, params, callback) { var service = method.split('.'); params = params || {}; params.method = service[1]; return $http.post('/services/' + service[0] + '.sjs', params).then(function (response) { return response.data; }); } } }); then when want use service, call following: rpcservice.request('users.facebooklogin', { token: response.authresponse.accesstoken }) .then(function(response) { debugger; $rootscope.user = response.user; console.log($rootscope.user); $rootscope.loggedin = true; $rootscope.$apply(); }); the code never gets lines after debugger; in fact, code n

javascript - Scrolling effect on click on a image -

i'm trying make scrolling effect menu. precise want click on image , when click menu scroll down 1 fade effect or ever effect next link. ahhh...like windmill wheel if u understand mean.:) , couldn't find info. here code : <div class=".img-fade"><img src="http://www.lahondafire.org/nest/volunteer%20manual/signs%20and%20forms/arrow.gif" width="180" height="170"><br> when click on arrow links below start scrolling down 1 , contact top , me to bottom...</div> <div class="menu"> <a href="#">about me</a><br> <a href="#">portofolio</a><br> <a href="#">contact</a> </div> http://jsfiddle.net/wctqn/242/ so when click on arrow move links top bottom or bottom top,dosen't matter. thank you. you can try this method . reorders list elements when arrow clicked $('.img-fad

asp.net mvc 4 - c# given instance of base class, update base class properties of derived class -

i have view model (using mvc4) inherits base class public class timetaskviewmodel : timedetailtask { public string tasktypedescription { get; set; } } i have method convert view model class, given instance of class. i'd able not have explicitly set every property of base class, update additional properties of view model: public timetaskviewmodel convertclasstoviewmodel(timedetailtask entity) { timetaskviewmodel viewmodel = new timetaskviewmodel(); viewmodel.base = entity; viewmodel.tasktypedescription = entity.tasktypes.tasktypedescription; return viewmodel; } anyway that? or way off base here? note: need flat class result view model used in ienumerable format pass kendo ui grid on front end , can't handle complex classes. it sounds you're looking easy way mapping information 1 class entirely different class happens have of same properties. don't think inheritance answer you're looking for. sounds want automapper , allo

java ee - war file failed to deploy in Apache tomcat manager -

i have made maven project , has war file. now when go localhost:8080 , click on deploy war file shows me following message: fail - deploy upload failed, exception: c:\program files\apache software foundation\tomcat 6.0\webapps\simplej2ee-0.0.1-snapshot.war (access denied) what reason? you have access denied error witch means, well, cannot deploy war tomcat due access issues. the chances you've installed tomcat program files under user admin privileges launched under non-privileged user (that has no permissions write program files\blahblah ). try (1) run tomcat admin or (2) fix permissions on webapps folder.

Apache CloudStack with MySQL Cluster (NDB Engine) -

i've set tested , verified mysql cluster 7.1 , tested , verified 4.x version of cloudstack on regular mysql database. now, i'm trying move db new cluster database. exported , removed of constraints in cloudstack databases , imported schema/data cluster database. however, when point cloudstack cluster's ip address, shows login screen when try log in, cloudstack management server crashes. has installed cloudstack on mysql cluster? capture log file info when mgmt server crashes. info on cloudstack logs post message cloudstack user mailing list .

asp.net mvc - When connecting to SQL Server what are the values for the datasource? -

basically i'm developing website using asp.net mvc4, when creating model, need establish connection database first when selected database name 7ch3lm1 (default in drop down list), said: cannot connect database but when wrote 7ch3lm1\sqlexpress , let me through that reminded me of question: what's real difference behind that? what's meaning of 7ch3lm1 , what's point adding sqlexpress ? any ideas welcomed! 7ch3lm1 machine name, , helps identify instance of sql server you're connecting to. in case, connecting named instance of sql server running express edition, , instance name sqlexpress . machine can run multiple instances of sql server concurrently, , can have 1 default instance , 0, 1 or multiple named instances. connect default instance, use 7ch3lm1 , , connect named instance, use 7ch3lm1\<instance name> , have 7ch3lm1\sqlexpress . i typically rename machines little more memorable , meaningful, can make things easier, that

python 2.7 - ReshapeError while trying to pivot pandas dataframe -

using pandas 0.11 on python 2.7.3 trying pivot simple dataframe following values: studentid questionid answer daterecorded 0 1234 bar 2012/01/21 1 1234 foo c 2012/01/22 2 4321 bop 2012/01/22 3 5678 bar 2012/01/24 4 8765 baz b 2012/02/13 5 4321 baz b 2012/02/15 6 8765 bop b 2012/02/16 7 5678 bop c 2012/03/15 8 5678 foo 2012/04/01 9 1234 baz b 2012/04/11 10 8765 bar 2012/05/03 11 4321 bar 2012/05/04 12 5678 baz c 2012/06/01 13 1234 bar b 2012/11/01 i using following command: df.pivot(index='studentid', columns='questionid') but getting following error: reshapeerror: index contains duplicate entries, cannot reshape note same dataframe without last line 13 1234

AES Encryption Output Hex vb.net -

i figured pretty straight forward have issue getting aes encryption function return hex string. can work when convert base64 cannot string hex values. here code. appreciated. dim aes_encryption new system.security.cryptography.rijndaelmanaged dim code_aes new system.security.cryptography.md5cryptoserviceprovider dim encrypted string = "" try dim hash(31) byte dim temp byte() = code_aes.computehash(system.text.asciiencoding.ascii.getbytes(pass)) array.copy(temp, 0, hash, 0, 16) array.copy(temp, 0, hash, 15, 16) aes_encryption.key = hash aes_encryption.mode = ciphermode.ecb dim aes_encryptor system.security.cryptography.icryptotransform = aes_encryption.createencryptor dim buffer byte() = system.text.asciiencoding.ascii.getbytes(input) encrypted = (conversion.hex(aes_encryptor.transformfinalblock(buffer, 0, buffer.length))) catch ex exception end try return encrypted i've tried example, , i've got nothing either. so

javascript - AngularJS: Can't get a value of variable from ctrl scope into directive -

hostingctrl: function hostinglistctrl($scope, hosting) { hosting.all().success(function(data) { $scope.hostings = data; }); } html template: <pagination items-count="{{hostings.length}}" current-page="currentpage" items-per-page="{{itemsperpage}}"></pagination> directive: admin.directive('pagination', function() { return { restrict: 'e', replace: true, templateurl: "<%= asset_path('angular/templates/ui/pagination.html') %>", scope: { currentpage: '=', itemscount: '@', itemsperpage: '@' }, controller: function($scope, $element, $attrs) { console.log($scope); console.log($scope.itemscount); }, link: function(scope, element, attrs, controller) { } }; }); i&#

java - Populate ListView with SQL database ERROR -

im new android, , im trying display data sql database listview seems able retrieve data de database, way of inserting listview seems incorrect. log cat throws me following error: caused by: android.content.res.resources$notfoundexception: string resource id #0x2 if please @ code , give me advice of how can fix it, apreciate :), in advance this main activity code public class mainactivity extends listactivity { string key_id = "_id"; string key_hole = "hoyo"; string key_par = "par"; string key_handicap = "handicap"; string key_yards = "yardaje"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); databasehelper mydbhelper = new databasehelper(this); arraylist<hashmap<string, string>> menuitems = new arraylist<hashmap<string, string>>(); try { mydbhelper.createdatabase();

android - Called unimplemented OpenGL ES API -

i've checked several posts on sof, i'm using real device instead of emulator, galaxy nexus(android 4.2). , set : mglsurfaceview.seteglcontextclientversion(2); mglsurfaceview.setrenderer(new myrenderer(this)); still, crazy logs of "libegl called unimplemented opengl es api". any help? thank you! this problem caused incomplete egl or opengl es 2.0 driver android. should try find updated driver, if available. other option change app's code not use seteglcontextclientversion(2). there sample in android sdk named hello-gl2 works without using seteglcontextclientversion(2). or, use opengl es 1.1 or native code instead. article details this: http://software.intel.com/en-us/articles/porting-opengl-games-to-android-on-intel-atom-processors-part-1

Unit testing an AngularJS directive that watches an an attribute with isolate scope -

i have directive uses isolate scope pass in data directive changes on time. watches changes on value , computation on each change. when try unit test directive, can not watch trigger (trimmed brevity, basic concept shown below): directive: angular.module('directives.file', []) .directive('file', function() { return { restrict: 'e', scope: { data: '=', filename: '@', }, link: function(scope, element, attrs) { console.log('in link'); var converttocsv = function(newitem) { ... }; scope.$watch('data', function(newitem) { console.log('in watch'); var csv_obj = converttocsv(newitem); var blob = new blob([csv_obj], {type:'text/plain'}); var link = window.webkiturl.createobjecturl(blob); element.html('<a href=' + link + ' download=' + attrs.filename +'>export csv</a>'); }, true); }

jQuery validation to accept only three letters in a textbox -

this code. want add form validation accepts 3 letters. can 1 help? if ( unitbrief === "" ) { $("#divvalidationmessageconfigurationtab").css('display' , 'inline'); $("#spnvalidationtext").text("unit brief required."); $(".unitbrief").focus(); return; } did mean this? if( ! /^[a-z]{3}$/i.test(unitbrief) ) { ... not 3 letters ... }

Writing Python ctypes for Function pointer callback function in C -

i trying write python code call dll functions , stuck @ function below, believe related typedef callback function or function pointer thing. i have tested code below, when callback function called, python crashes (window notification-- python.exe has stop responding) no debug msg. i confused, appreciated :) thanks! c: #ifdef o_win32 /** @cond */ #ifdef p_exports #define api __declspec(dllexport) #else #define api __declspec(dllimport) #endif // #ifdef p_exports /** @endcond */ #endif // #ifdef o_win32 // type definition typedef void (__stdcall *statuscb)(int nerrorcode, int nsid, void *parg); //function void getstatus(statuscb statusfn, void *parg); python: from ctypes import * def statuscb(nerrorcode, nsid, parg): print 'hello world' def start(): lib = cdll.loadlibrary('api.dll') cmpfunc = winfunctype(c_int, c_int, c_void_p) cmp_func = cmpfunc(statuscb) status_func = lib.getstatus status_func(cmp_func) your callb

android - Service and Chronometer Synchronization -

i need able start chronometer, close activity, after through notifications, activity, , see right time in chronometer. what i've done a part of activity: public void doclick(view target) { switch(target.getid()) { case r.id.buttonstart: { mchronometer.setbase(systemclock.elapsedrealtime()); mchronometer.start(); intent intent = new intent(recentactivity.this, chronometerservice.class); intent.putextra("task_name",task_name); intent.putextra("task_id",task_id); intent.putextra("ellapsedtime",mchronometer.getbase()); log.d("base",""+mchronometer.getbase()); startservice(intent); break; } case r.id.buttonstop: { stopservice(new intent(recentactivity.this, chronometerservice.class)); mchro

Is there any way to get the list of all users who are currently logged into Quickbooks in C# .NET? -

i trying integrate quickbooks our company application. want list of users logged quickbooks. possible? how list using c# .net? know possible quickbooks accessing company->users->view users. there way list display in our application? no, none of available quickbooks apis support this.

Remove spacing between certain items of ListView - Android -

i have custom adapter, uses cursor data input. filter entries in order not display them, because think it´s best way in case. i make them disappear setting layout visibility gone, anyway, spaces between items stay there, means if filter out 10 sequenced items, have gap of 10 * space-height between prior 1 , following behind. in case, it´s useless set spacing via xml, seem possible read. set spacing zero, not intent. how remove single spacing or make invisible? i don't think can that. remove general listview spacing , add margin each row. way, if row view gone, spacing well.

database - Select equally distant rows based on a timestamp column in MySQL -

how can select fixed number of rows table, in timestamp column, , return rows equally distant each other. need these points sample points use plot timeseries. aware of other techniques solve problem such crossfilter, etc, want able using server, now. for example, table below: (timestamp simplified clarity) id key val timestamp 1 'a' 100 1am 2 'b' 120 2am 3 'c' 130 3am 4 'd' 140 4am 5 'e' 130 5am 6 'f' 135 6am 7 'g' 136 7am 8 'h' 139 8am 9 'i' 149 9am 10 'j' 140 10am 11 'k' 140 11am 12 'l' 135 12pm so want able run query return sample of size 3, example, , should return rows 1, 5 , 9. i dont want use id, because table more complicated this, , applying clauses, etc query, , using id not going work. from working other rdbss aware of rank, doesnot seem exists in mysql, s

Set display block JQuery Toggle as default / CSS positioning -

this first time asking on great website (that i've been learning long time now). i'd grateful if me this: im working on free html5 template called "proximet". on website : i know how make toggles display block default. tried adding style="display: block; " somehow display:none; default. toggles open default. on other hand, know how make website occupy whole height of browser window. on 21 inch display, , website doesnt seem fulfill whole height of display. footer div placed on bottom of website if content area not filled content. the display set "none" here: // toggle box //########################################## $(document).ready(function(){ $('.toggle-trigger').click(function() { $(this).next().toggle('slow'); $(this).toggleclass("active"); return false; }) .next().hide(); }); remove .next().hide() code , elements stay visible

jquery - javascript error TypeError: scr is null http://widgets.amung.us/classic.js Line 1 -

i getting error typeerror: scr null http://widgets.amung.us/classic.js line 1 in firebug console, using wordpress few basic plugins , simple theme, have searched templates didn't find comes from,i need find , fix it. body please help. thanks it easier if can post url live site can see what's going on. if not, if can indicate plugins, theme, etc. you're using.

imagej - Adding ROI outlines and labels to a grayscale stack and creating montage -

i have grayscale image stack ~100 slices. in selected slices, have indicated rois using freehand tool , added label measurement. what generate montage contains selected slices rois , labels indicated overlay. tried make substack, add overlays roi manager , generate montage montage doesn't show overlays. tried 'flatten' command requires rgb image. if convert grayscale image rgb, overlaps rois on top of first image rather placing them on right slice. any ideas on how can this? thanks! the following macro code creates montage of flattened views of every roi in roi manager: mytitle = gettitle(); (i=0; i<roimanager("count"); i++) { selectwindow(mytitle); roimanager("select", i); run("select none"); run("duplicate...", "title=single-slice"); run("restore selection"); run("flatten"); rename("ready-for-stack"); } run("images stack", "nam

sql - Swapping MySQL Data between Rows -

the goal run mysql query swaps around table id's. the table id tableid car 1 1 ford mustang 2 1 ford focus 3 1 ford ranger 4 2 toyota 4runner 5 2 toyota celica 6 3 chevy camaro 7 4 cadillac escalade 8 4 cadillac cts 9 6 dodge charger 10 6 dodge ram 11 6 dodge caravan if run these queries update table set tableid='2' tableid='1' update table set tableid='1' tableid='2' update table set tableid='5' tableid='6' so idea i'd swap tableid's 1 , 2. however, happen after first query of tableid 1 merge tableid 2. second query update of tableid 2 (which includes old tableid 1 , tableid 2) tableid 1. the last query have no issues there no conflict. however, how write query swap 2 tableid's in instance without tables getting messed (joining)? just in 1 query, using case statement: upda