Posts

Showing posts from September, 2012

c# - SQL statement, OleDbException error INSERT -

there no error in code, no information appearing in database. string mysql; mysql = "insert cars(make,model,price,[image]) values ('" + tbmake.text + "','" + tbmodel.text + "'," + tbprice.text + ",'" + fileupload1.filename + "')"; sitedb.insertcommand = mysql; datalist1.databind(); cheers. with access database word image reserved keyword. if want use need encapsulate square brakets "insert cars(make,model,price,[image]) values ......" this resolve immediate problem, john skeet pointed out in comment need use parametrized query because solves problem of proper formatting of text values. what happens handy crafted query if model name (or make) contains single quote? syntax error waiting (and experience bite when have finished code , ready work) just complete answer, feel free test if in way adds record db mysql = "insert ca

Javascript Redirect - Control It with Php -

here script use redirection: <form id="form1" method="post" action="http://yahoo.com"> <script language="javascript" type="text/javascript"> document.getelementbyid('form1').submit(); </script> </form> now have control php code, 1 doesn't work: $redirect = '<form id="form1" method="post" action="http://google.com"> <script language="javascript" type="text/javascript"> document.getelementbyid('form1').submit(); </script> </form>' i guess there syntax error, unable figure out. please help. also let me know ok redirect method keeps script execution page referrer? you getting ' wrong inside getelementbyid $redirect = '<form id="form1" method="post" action="http://google.com"> <script language="javascript" type="text/j

php - Login button not disappearing after login -

i have began learn php , i'm working on facebook app @ moment. problem facing login button remains on screen after user has accessed account. have explination this? here code: <?php if (isset($user_profile)) { ?> user logged in <?php } else { ?> <div class="fb-login-button" data-scope="email"></div> <?php } ?> i included file $user_profile defined $user_profile = $facebook->api('/me'); test output of $user_profile using var_dump( $user_profile ) command. add exit command after var_dump pause execution. code sample else block being run meaning there issue $user_profile variable.

spring - Which classes of method argument may be annotated with @RequestHeader -

i want access time-stamp in if-modified-since header, can implement conditional get. spring controllers can use @requestheader annotation indicate spring should pass value of http header handler method method argument. must argument string ? or other classes permitted? spring documentation implies long values can converted. set of classes permitted? will following work (using date )? @requestmapping(method = requestmethod.get, headers = {"if-modified-since" }) public final void conditionallyretrieve( @requestheader("if-modified-since")final date ifmodifiedsince, final httpservletresponse response) { ... } specifically, in example, think can use datetimeformat drive spring conversion: @requestheader("if-modified-since") @datetimeformat(pattern = "thepattern") final date ifmodifiedsince

android: Listview is not clickable on version greater than 3.0? -

i displaying list in apps. when user can click on list send next activity. list displayed list clickable on version less 3.0 , not clickable on version greater 3.0. don't understand wrong. i'm using listfragment displaying list , override method onlistitemclick. tried solution on stackoverflow not achive goal. please have solution. following onlistitemclick method listfragment. @override public void onlistitemclick(listview l, view v, int position, long id) { // todo auto-generated method stub super.onlistitemclick(l, v, position, id); l.setonitemclicklistener(new android.widget.adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view view, int arg2, long arg3) { intent href = new intent(getsherlockactivity(), projectdetailactivity.class); string projid = ((textview) view.findviewbyid(r.id.projectid)).gettext().tostring()

ajax - Inline support Chat implementation -

we creating live chat support system. if visitor clicks on live chat button, new window opens , user can talk their. trying accomplish open chat window inline link: http://anantgarg.com/chat/sampleb.php please note building support chat system not peer chat system above link intends. the problem facing here how we'll able access database located on different server (our server) , not on server our client's website located. above solution can work fine if on same server. so, please suggest on how overcome hurdle. thanks. i think, solve task may use websockets, support cross-domain connections. in case, may write chat client side , place on cliet's website, request weill processed server db access. extend of course can use json websockets json ajax. websockets transport - json content passed transport. i write code when reserarch websockets (chat lietn side): function connect(){ var socket; var host = window.location

ssl - Sitecore ECM : Message preview gives wrong output -

i have multi site system, version 6.5 ecm 1.3. e-mails sent using ssl/tls on port 587, connections running , tested , able send test-mails. when creating new newsletter in ecm , going message preview, not see (empty) layout of newsletter, instead sitecore displays home page of website itsself?! issue occurs every template except html message. when sending newsletter test mail, receive e-mail more or less layout of website, shown in preview. any ideas? best regards, hessel make sure newsletter branch (i.e.$name under branches >> branch newsletter) , email message root (i.e. email message root under branches >> branch newsletter >> $name) have been assigned custom newsletter template. check email message root clicking on ribbon (you might know .....) select email message root in tree. in ribbon click presentation >> layout >> details , layout details dialog box should give info. simultaneously check content , presentation binding i

linux - How to cut a particular piece of data and store it in a String in Shell Script -

i new @ linux , having problems getting piece of data string. tried is str = $(openssh version) | cut -d" " -f2 this did line not showing error string containing null. when running in console getting required output echo $(openssh version) | cut -d" " -f2 this gives output 1.0.0c (openssl version number)this require when run in shell script want compare other string. did made mistake in syntax or if there other way it. should run both in linux , aix system. you need put "cut" command inside parens, , eliminate whitespace around "=": str=$(openssh version | cut -d" " -f2)

entity framework - Getting POCO classes in DbContext Generator -

are classes generated dbcontext generator in ef4.1 considered poco , persistence ignorant? if so, why getting error: " the entity or complex type '' cannot constructed in linq entities query. "? this code: return searchparam = p in ent.partnerprofiles select new partnerprofile { partnername = p.partnername }.tolist(); yes can consider them pocos , persistence ignorant, because haven't got wiring notifying , tracking changes classes objectcontext generator have. that said, there conditions ef requires lazy loading enabled ( virtual navigation properties) , in persistent ignorant classes won't find primitive primary or foreign key properties. latter not required, convenient @ times (see foreign key associations ). the error design. reason not documented (as far know) has fact ef wants track entities has created itself, not ones generate in projection. many ef u

iphone - NSSetUncaughtExceptionHandler Hijacked by Third Party SDK -

edit: who're wondering sdk is, it's chinese clone of flurry, ==>> umeng. edit 2: there's disable crash log handling option in weird sdk, make uncaughtexceptionhandler called again. still interested in how sdk did trick in first place. i'm playing third party ios analytics sdk. weird discovery: originally (before added sdk), had uncaughtexceptionhandler in appdelegate.m. worked fine. whenever exception occurred when testing on real idevice, printed log console. //worked charm before added weird analytics sdk nssetuncaughtexceptionhandler(&uncaughtexceptionhandler); then added weird analytics sdk (all did drop .a lib project , add 1 line appdelegate.m, mentioned below), of sudden, uncaughtexceptionhandler never gets called. //to make sure uncaughtexceptionhandler not set second time sdk, //i set , reset again, before , after initialized weird sdk nssetuncaughtexceptionhandler(&uncaughtexceptionhandler); [weirdanalyticssdk startwithappkey:

c# - MVC 4, jTable 2.3, Table data isn't rebuilt on second (+) call -

a selection on first table results in change in second table. however, change occurs once. subsequent calls generate valid json html remains unchanged. the controller: [httppost] public jsonresult m1list(int jtstartindex, int jtpagesize, string jtsorting) { try { list<tblm> m1 = new datahelper().getm1(jtsorting, jtpagesize, jtstartindex); int m1count = new datahelper().getm1count(); return json(new { result = "ok", records = m1, totalrecordcount = m1count }); } catch (exception ex) { return json(new { result = "error", message = ex.message }); } } [httppost] public jsonresult m2list(int mid, int jtstartindex, int jtpagesize) { try { list<viewm1a> m2 = new datahelper().getm2form1(mid.tostring(), "mid", jtpagesize, jtstartindex); int m2count = new datahelper().getm2form1count(mid

c# - A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll -

i have windows phone 8 application running on emulator visual studio 2012 environment. implemented logic able send toast push notifications app. when comes code snippet below in mainpage constructor, receive exception outlined in subject line: // try find channel pushchannel = httpnotificationchannel.find(channelname); also, information below given out exception: access push notifications requires id_cap_push_notification defined in manifest. what wrong or missing receive such exception. please note running vs 2012 environment under administrator account full privileges. thanks! in solution explorer of visual studio expand "properties" node of project. open "wmappmanifest.xml" file "properties" panel. navigate "capabilities" tab check button "id_cap_push_notification" if not checked.

android - Life of a member variable in IntentService -

please explain life of member variable in intentservice. deinitialized when intentservice gets killed? once object no longer referenced, becomes candidate garbage collection, , same goes object referenced object. includes intentservice object.

oracle - Date as number in sql -

when type current date in excel cell 08-may-2013 right click on cell , in format when click number category number date-08-may-13 formatted one-41402.00 so there anyway can same number in sql i tried using this. select to_char(sysdate,'j') dual but output 2456421 i understand julian value but can me in getting output getting on excel i.e; 41402 the windows version of excel stores dates serial numbers. 01-jan-1900 1, 02-jan-1900 2, etc. mac version used use different starting date; don't know whether that's still case. the essential data need in simple date arithmetic. select current_date, current_date - date '1900-01-01' dual; that returns 41400.67037037037 current connection. rounding , adding 1 fenceposting return number you're looking for, i'd want test multiple time zones , such before i'd swear it.

indy - How can I install my own copy of Indy10 from source, in Delphi XE4, if I get "not a valid win32 application" error? -

using latest indy10 sources subversion, installing in delphi xe4, error when try install "dclindyprotocols180.bpl": error: can't load package c:\dev\..\comp\indy10\lib\output\bpi\win32\debug\dclindyprotocols180.bpl. %1 not valid win32 application. the bpi\win32\debug folder in question contains these files: dclindycore180.bpl dclindyprotocols180.bpl indycore180.bpi indycore180.bpl indyprotocols180.bpi indyprotocols180.bpl indysystem180.bpi indysystem180.bpl how fix or work around this? not new indy, or delphi, each time there's new delphi release, there interesting surprises of prefer build source code , track subversion rather using random point in time ships delphi xe4 installer. as general side question: there place status of indy project's subversion code, compared whatever embarcadero ships in products noted, or recorded? by default new package in delphi might automatically 64 bit, or may have built dependency 64 bit bpl, not have swit

Issue connection to MySQL through jDBC with saiku -

this file connections: type=olap name=ghapbi driver=mondrian.olap4j.mondrianolap4jdriver location=jdbc:mondrian:jdbc=jdbc:mysql://127.0.0.1/ghapbi;catalog=/opt/django/bi_data/schemaghap.xml;jdbcdrivers=com.mysql.jdbc.driver; username=usrghapbi password=hipersecret connection made exception appears (from catalina.out ): caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: select command denied user 'usrghapbi'@'localhost' table 'alumnes' notice than: error same if drop de table. i can connect , select data table mysql -u usrghapbi -p ghapbi i miss ? open catalog file, in case: /opt/django/bi_data/schemaghap.xml , check right schema in table definition: <table name="alumnes" schema="**** check here ****" alias="">

xamarin.ios - MonoTouch running NSTimer even when app is in background -

in app want run timer when app goes in background. guess there 2 ways using thread capturing time when app goes in background , comes back i dont know way better? if use threading, how long works? work hours in background? thank you if you're app entered background state, have not time stop current threads. you run background task that: ... public partial class appdelegate : uiapplicationdelegate { ... public override void didenterbackground (uiapplication application) { int taskid = uiapplication.sharedapplication.beginbackgroundtask ( () => {}); var task = new thread (new threadstart (() => { // save application's current state. })); task.start (); } thus you'll have 10 minutes . yet ios doesn't allow run app infinite time. see backgroundexecution demo reference.

entity framework - Database First: how should I model Parent references Child references Parent? -

apologies if subject doesn't quite make sense here's issue: in sql server have: create table employee ( id int identity(1,1) , name varchar(50) not null ); create table notes ( id int identity(1,1) ,employee_id int not null , addedbyemployee_id int not null , text varchar(2000) ); alter table notes add constraint pk_notes primary key (id); alter table notes add constraint fk_notes01 foreign key (employee_id) references employee(id) on delete cascade; alter table notes add constraint fk_notes02 foreign key (addedbyemployee_id) references employee(id); so, employee can have 1 or more notes , each note added employee. i've modelled in entity framework in note.cls: public int id { get; set; } public string text { get; set; } public virtual employee employee { get; set; } public virtual employee addedbyemployee { get; set; } and employee.cls: public int id { get; set; } public virtual list<note> notes { get; set; } (i'm assuming have referen

c++ - Creating a highscore system using Vectors -

im learning c++ , directx 9. creating small game want have high score system, have reading , writing of files done, stuck on how sort , insert new value score vector. my method reading files vector below: vector<int> highscore::readfile() { int score; highscorein.open ("highscore.txt", ios::out | ios::binary); if (highscorein.is_open()) { while(highscorein>>score) { scores.push_back(score); } highscorein.close(); return(scores); } else cout << "unable open file"; } i want function check integer passed function against 5 values storing in vector scores, insert right place in vector. on appreciated:) assuming vector sorted largest smallest bool insert( vector<int> &v, int n ) { ( auto = v.begin(); != v.end(), ++it ) { if ( *it < n ) { v.insert( it, n ); v.pop_back()

is there an equivalent to jquery's "closest" in Dart -

jquery has "closest" returns closest matching ancestor in tree. there dart equivalent? i'd make following less fragile: e.target.parent.parent.nextelementsibling.classes.toggle('hide'); perhaps like: e.target.closest('div').nextelementsibling.classes.toggle('hide'); there isn't builtin function far know. it's pretty easy code something. the findclosestancestor() function defined below finds closet ancestor element given ancestor tag: <!doctype html> <html> <head> <title>ancestor</title> </head> <body> <div id='outer'> <div id='inner'> <p></p> </div> </div> <script type="application/dart"> import 'dart:html'; element findclosestancestor(element, ancestortagname) { element parent = element.parent; while (parent.tagname.tolowerc

How To Blank The Page Before Submitting PHP Form To Same Page? -

i'm trying create auto-response script work display form fields required, such name , username , , password . once select submit, want script remove form, , display output corresponding response in stead without having post page. having form.php , result.php each individual scenario want cluttered, hence why i'm trying accomplish this. far form, have: <form action="<?php echo htmlentities($_server['php_self']); ?>" method="post"> <table width="100%" cellpadding="10" cellspacing="0"> <tr> <td style="width:33%"> </td> <td style="width:33%">&nbsp;</td> <td style="width:33%">&nbsp;</td> </tr> <tr> <td colspan="3" style="width:99%"> <label>name</label><span class=&q

java - 3D coordinate rotation lacking Precision in perspective 2D -

so wrote program draw , display 3d cube, using these simple conversion formula's used in isometric graphs: x2 = x*cos(30) - y*cos(30) y2 = x*sin(30) + y*sin(30) + z the coordinate conversion fine , comes out in perspective. the issue rotating, large degree rotations messes coordinates , gives me entire shape. , rotating @ small degrees many many times, (ie 1000 1degree rotation or more) reduces size of cube. public void rotatex(double dg) //cube shrinking along y , z { y = (y*math.cos(dg)-z*math.sin(dg)); z = (y*math.sin(dg)+z*math.cos(dg)); } public void rotatey(double dg) //cube shrinking along x , z { x = x*math.cos(dg)-z*math.sin(dg); z = x*math.sin(dg)+z*math.cos(dg); } public void rotatez(double dg) //cube shrinking along x , y { x = x*math.cos(dg)-y*math.sin(dg); y = x*math.sin(dg)+y*math.cos(dg); } how can solve lack of precision of cos , sin after multiple uses?? here's entire code written in 3 seperat cl

node.js - Prototype / class / public attributes in JavaScript -

i have constructor model (similar backbone model) uses instance of store (e.g. mongodb / redis) passed model factory. inside constructor model, do this.store = options.store; store available this.store once construct instance var model = new model() . then faced situation when model has "public" methods, e.g. model.find() work without instantiating model. because it's not been instantiated, functions inside model can not access store this.store . what did, started adding store constructor model.store = options.store fixes problem. store exposed uses model constructor , not desirable. i guessing doing wrong. appreciate help. if you're saying correctly, think want allow "static" find() method on model without exposing store variable. javascript doesn't have formal private scope classes, can want using closures. here's fiddle: http://jsfiddle.net/52fpy/ edit: updated fiddle demonstrate various ways expose/hide info using

c - why 'Sizeof' value differs from the number of bytes before the flexible-length member of a struct? -

typedef struct { /*has 15 pointers*/ // ==> 15 x 4 = 60 bytes ; uint16_t; // ==> 2 bytes uint16_t array[]; } dummy_struct; case-a) sizeof(dummy_struct) returns 64 bytes case-b) while if try print, ((int) &(((dummy_struct *)(0))->array[0])) prints 62 bytes. this prints 62 bytes well: ((int) &(((dummy_struct *)(0))->array)) i don't understand why there change in value? shouldn't sizeof() return 62 well? if there's padding of 2 bytes, shouldn't happen before flexible-length member in struct? if that's case, shouldn't case-b print 64 instead of 62? edit: typedef struct { uint32_t temp; uint8_t array[][6]; } dummy2; printf("%d %d\n", sizeof(dummy2), offsetof(dummy2, array)); // prints 4 4 printf("%d \n",((int) &(((dummy2 *)(0))->array[0]))); // prints 4 how come same effect not happening previous example? padding doesn't seem happen here. so

c# - username token in soap ws security http -

this first part soap header trying generate <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mhs="http://org/emedny/mhs/" xmlns:urn="urn:hl7-org:v3"> <soapenv:header> <wsse:security soap:mustunderstand="1" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:binarysecuritytoken valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3" encodingtype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#base64binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:id="securitytoken-e00c8062-83d2-4f04-88fc-996218e7bb3d">miicedcc....(emedny signed user mls cert).......</wsse:binarysecuritytoken> <wsse

c++ - My SSE2 Flooring function has some problems -

so wrote function using sse2 floors vector seems work purposes example works fine bi-linear filtering algorithm when used perform modulo comes values off. function works performing conversion integer vector using truncation , converts floating point. both floor , modulo code listed below: inline __m128 floor_simd(const __m128 & a) { __m128i int_val = _mm_cvttps_epi32(a); return _mm_cvtepi32_ps(int_val); } inline __m128 mod_simd(const __m128 & x, const __m128 & y) { return _mm_sub_ps(x, _mm_mul_ps(y, floor_simd(_mm_div_ps(x, y)))); } might have explanation why i'm getting odd values modulo? edit: example when 1 uses mod_simd(_mm_set1_ps(63.6f), _mm_set1_ps(32.0f)) produce faulty answer mod_simd(_mm_set1_ps(23.6f), _mm_set1_ps(32.0f)) produce correct answer. when replace floor function less efficient component wise version works fine. i solved own problem. benefit of here resulting code. subtracts 1 value if greater original value compensa

ruby on rails - Need assistance choosing a image management gem -

i interested in building rails based system handling display , organization of large amounts of photos. sort of flickr smaller. each photo have metadata associated it. photos shown in selectable list , grid view. nice able load images needed (as speed things up). at moment have test version of database working images loading assets/images directory beginning run slow when displaying several images (200-600 images). due way have view setup. using straight loop display images in both list , grid layouts. i manually resized thumbnails , medium sized image full sized source image. investigating other resizing methods. advice appreciated here well. as new handling images way, point me in direction based on experience designing , implementing flickr? i investigating following tools: paperclip http://railscasts.com/episodes/134-paperclip requirements: imagemajick attachment_fu http://clarkware.com/blog/2007/02/24/file-upload-fu#fileuploadfu requirement: 1 of following: im

How to include two static libraries that are almost the same for iOS -

i have 1 static library testing , 1 release. debugging static lib has calls aren't available in release version. in code use preprocessor macro guard around calls available in testing static lib. how include both libs in project , make 1 of them linked during linking process depending on build doing? note: don't have access code static library can't make changes. have access client code making use of lib. in target build settings , under linking , other link flags - can include debugging library in debug , , real 1 in release (deployment, etc). first remove link binary libraries under build phases .

In JQuery Extension Function, how do I access the instance options? -

i have jquery extension functions, not sure how access instance's options: (function ($) { $.fn.myextension= function (methodoroptions) { if (methods[methodoroptions]) { return methods[methodoroptions].apply(this, array.prototype.slice.call(arguments, 1)); } else if (typeof methodoroptions === 'object' || !methodoroptions) { // default "init" return methods.init.apply(this, arguments); } else { $.error('method ' + methodoroptions + ' not exist on jquery.myextension'); } }; var methods = { init: function (options) { var defaults = { testoption: "test" }; options = $.extend(defaults, options); return this.each(function () { // code logic goes here } myfunction: function () { var optionval = options.testoption;

vb.net - TCP listener receives huge data -

i have 2 application 1 server , other 1 client written in vb.net. both of them running on same machine ( using 127.0.0.1 ) client sends 5 bytes data server example: "farid" sever app has tcp listener receives huge data length of 65534 bytes. tried print received data , printed "farid" whith lots of empty spaces in front of sure tcp client sends right data, have no idea happens data when listener receives it. the tutorial using has horrible practices , mistakes in it... =\ the receive loop in getmessage() should more like: private sub getmessage() dim instream(10024) byte serverstream = clientsocket.getstream() while true dim bytesread integer = serverstream.read(instream, 0, instream.length) readdata = system.text.encoding.ascii.getstring(instream, 0, bytesread) msg() end while end sub *using global string "readdata" pretty bad design though! you should read article here closely: a peer-to-peer

java - ListView header -

i create header layout (xml file) take whole 1 screen layout... and created listview , added header_layout listview: layoutinflater inflater = getlayoutinflater(); final view headerl = inflater.inflate(r.layout.header, null); swipelistview.addheaderview(headerl, null, false); the listview under header layout. however, header stretched on whole page , when try scroll header ( scroll down see listview), doesnt scroll down.. the headerview not scrollable , therefore cant reach listview... is there implementation it? or make header scrollable? the listview not empty , checked via debug mode also, if remove headerview listview (my page containes listview, without header) show me listview well thanks alot if wish header scrollable other views, can implement method baseadapter.getitemviewtype , first position, return type of header, , rest, type of normal types. then, in getview method, check type inflate/re-use , , fill needed data when needed. example:

import single column csv file into mysql using phpmyadmin -

i have single column csv file columns mahindra logan mahindra xylo maruti suzuki swift when view file notepad+ shows complete 514 lines when view in notepad , data combined , shown 3 lines. when import in phpmyadmin using csv using load data, , selecting "\n" columns terminated . 3-4 entries imported. please me out if possible it might result of several things: if table has several columns , importing file 1 column, data truncated division e.g. assume have table called mytable 2 columns autoid , fname. file however, has 1 column , 20 rows. autoid auto-increment column in case. if use command: load data local infile 'c:\\myfile.csv' table mydatabase.mytable only ten rows of data imported. reason is, mysql assumes trying import single column of data 2 columns of data. however, since autoid values automatically generated, values inserted discarded. solve such problem, did following. opened csv file in excel , added column left of existing column

junit - Parameterized instrumentation tests on Android -

i'm trying write batched instrumentation test (using activityinstrumentationtestcase2 ) particular activity change intent each time test runs. can single test, , loop through stopping , restarting activity new intent, not want. 1 reason should separate test runs. other reason is, i'm using spoon generate report when tests finish, , report rightly think ran 1 test. what treat single test possibly infinite number of tests, , pass data test each time test runs. unfortunately can't use theories because results in runtimeexception instrumentationtestrunner can't find tests. have luck this? you create "testing" intent. in order simulate relaunching of application, make method or several methods reset static variables between tests. can test classes within testing intent inside application using assert("value", myclass.mymethod); resetstatics(); assert(true, myclass,mymethod); resetstatics(); i don't know how you, if @ all, h

ruby on rails - No route found, even though there is that route specified in routes.rb (RailsAdmin conflict, I think) -

i added cancan authorization railsadmin , when access /admin unauthorized user, error: actioncontroller::routingerror @ / no route matches {:controller=>"home"} this routes.rb looks like: myapp::application.routes.draw mount railsadmin::engine => '/admin', :as => 'rails_admin' mount piggybak::engine => '/checkout', :as => 'piggybak' devise_for :users, :path_names => { :sign_up => "register", :sign_in => "login", :sign_out => "logout", :settings => "settings" }, :controllers => {:confirmations => "confirmations"} devise_scope :user "login", :to => "devise/sessions#new" "register", :to => "devise/registrations#new"

javascript - How to make the margin of an image dynamic -

what have long rectangular image http://www.openstudio.fr/jquery-virtual-tour/img/sculpteur.jpg and 3 buttons move image left, right , pause.. can seen here. trying recreate virtual tour http://www.openstudio.fr/jquery-virtual-tour/ this html content <div class="pan" style="margin-left:-500px"> <img src="sculpteur.jpg" /> </div> <button class="right"> --) </button> // move right >> <button class="left"> (-- </button> // move left << <button class="pause">||</button> // pause x this javascript file. codes after right button clicked $(document).ready(function() { $a=parseint($('.pan').css('marginleft')); $(".right").click(function(){ $('.pan').stop(); $direction = "right"; movepanorama($direction,$('.pan'), $a); }); ... ... });

c - How should I type cast void *? -

i learning c. need define function type cast value of void * desired type. i'm not sure if understand need do. here attempt. can take , let me know if it's correct? if not, how should fix it? thank in advance time. void print_type(type a) { void *v_ptr; v_ptr = &a; } in c, void * implicitly compatible data pointer type. if have posix implementation, it's compatible function pointers well. there's no need typecasting; conversely, it's considered harmful .

jquery - Remove class from parent <td> of unselected radio buttons -

what able highlight parent of selected radio button, have done. thing having trouble removing .sel class unselected radios. have multiple radio groups set in table, 1 group each row. here code now: $(document).ready(function () { $('td.radio').click(function () { $(this).children('input').prop('checked', true); if ($(this).children('input').is(':checked')) { $(this).addclass('sel'); } else { $(this).removeclass('sel'); } }); }); i have jsfiddle set here have managed far: http://jsfiddle.net/asmith/drytp/5/ remove sel class siblings of td clicked, add 1 clicked: $('td.radio').click(function () { var $this = $(this); $this.children('input').prop('checked', true); $this.siblings('td').removeclass('sel'); $this.addclass('sel'); }); http://jsfiddle.net/drytp/6/

android - There is no Options on my list -

im trying set preferences there no options on list here code <listpreference android:title="list" android:key="list" android:summary= "this list choose from" android:entries="@array/list" android:entryvalues="@array/lvalues" /> here code array <string-array name="list"> <item option="1"></item> <item option="2"></item> <item option="3"></item> <item option="4"></item> </string-array> <string-array name="lvalues"> <item>1</item> <item>2</item> <item>3</item> <item>4</item> </string-array> i want option 1 etc next thing is trying do? <string-array name="list"> <item>option 1</item> <item>option 2</item> <item>option 3</item> <item>o

css - inline elements printing on new line -

i have following code: <div class="outsidediv"> <div class="element1">name: </div> <div class="element2">something</div> <div class="element3"> - </div> <div class="element4">this great</div> </div> the outer div display:block , of inside divs display:inline. in browser shows on same line this: name: - great when go print it, 4 divs show on seperate lines this: name: - great i having hard time figuring out how 4 inside divs print on same line. <div class="outsidediv"> <div class="element1" style="display:inline">name: </div> <div class="element2" style="display:inline">something</div> <div class="element3" style="display:inline"> - </div> <div class="element4" style="display:inline">t

c++ - Does a Huffman Binary Tree have to be proper? -

all examples find huffman coding have had number of chars work with. if odd number of chars can last internal node added tree have single child ? or have add null node of sort internal nodes have 2 children ? if later, seems confusing because not sure how have null value char (because values being used valid ascii codes). an odd number of char s no problem. wouldn't lead internal node 1 child. /\ / \ × / \ b c the way tree constructed ensures internal nodes have 2 children, regardless of how many char s there are. one starts list of leaves, , in each step, (the) 2 trees lowest frequency joined making them left resp. right subtree of new - internal - node, until there 1 tree left. each internal node in final result arises joining 2 subtrees, hence has 2 children.

java - Reflectively checking whether a object is a valid generic argument to a method -

how check using reflection whether given object valid parameter of method (where parameter , object generic types)? to bit of background, i'm trying achieve: while playing reflective method calls thought nice call methods have parameter of specific type. works raw types can call isassignablefrom(class<?> c) on class objects. however, when start throwing in generics mix isn't easy because generics weren't part of reflection's original design , because of type erasure. the problem larger boils down following: ideal solution ideally code import java.lang.reflect.*; import java.util.*; public class reflectionabuse { public static void callmemaybe(list<integer> number) { system.out.println("you called me!"); } public static void callmeagain(list<? extends number> number) { system.out.println("you called me again!"); } public static void callmenot(list<double> number) {

java - Can't find or load main class -

for reason getting error saying can not find or load main class, can give me reason this? package findfile; import java.io.file; /** * * @author kevin */ public class findfile { public void listfilesandfolders(string directoryname) { file directory = new file(directoryname); file[] flist = directory.listfiles(); (file file : flist) { system.out.println(file.getname()); } } public void listfiles(string directoryname) { file directory = new file(directoryname); file[] flist = directory.listfiles(); (file file : flist) { if (file.isfile()) { system.out.println(file.getname()); } } } public void listfolders(string directoryname) { file directory = new file(directoryname); file[] flist = directory.listfiles(); for(file file : flist) { if (file.isdirect