Posts

Showing posts from May, 2013

Implement Web Services in PHP & JavaScript. -

i want use web services ajax php , javacript, thied exemple still have error. tried lot of code, please me. xmlhttprequest cannot load xxxxx/login.php. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. index.html:1 index.html <html><head> <script src="jquery-2.1.0.js"></script> <script src="jsjsjs.js"></script> </head> <body> <div id='logindiv'> <label>username:</label> <input name="username" id="username" type="text"> <label>password:</label> <input name="password" id="password" type="password"> <input value="submit" name="submit" class="submit" type="submit" onclick='chk_ajax_login_with_php();'> <d

javascript - Test is URL is valid (server response = 200) -

i trying check if url provided user in form valid one, i.e. if server's response 200. i want run check when user has typed in field , when loses focus. because of same origin policy, run check on server side: client side code: // test url when input loses focus angular.element(document).ready(function () { $('#target_url').focusout(function() { if ($('#target_url').hasclass('ng-dirty')){ $http.post('/test-url', { target_url: scope.newjob.target_url }).success(function(response){ if (response === 'valid url'){ console.log('valid url'); }else{ console.log('url not valid'); } }); }; }); }); server side: // url testing route app.post('/test-url', function(req, res) { request(req.body.target_url, function (err, respon

javascript - Issue with JS from fields obtained through Ajax response -

i use datatables in order create nicely displayed , managable table. data use ajax data source , prepared php script connect database , echo on screen date in json format. assign.php $q = "select o.id, a.id aid, o.starttime,o.scid, count(case when v.severity = '0' 1 else null end) zero, count(case when v.severity = '1' 1 else null end) one, count(case when v.severity = '2' 1 else null end) two, count(case when v.severity = '3' 1 else null end) three, o.starttime start topic a, project v, person o a.id = v.topic_id , a.id = o.topic_id , o.starttime = '".$_get['date']."' group o.id,o.starttime,o.scid,a.id order id desc"; $result = $db->query($q)->fetchall(pdo::fetch_assoc); $arr = array(); foreach ($result $row){ if ($row['scid']==1){ $button="<button id=\"opener_".$row['aid']."\" class =

multiple sorting in backbone.js -

sorting in backbone it's working fine. want sort multiple fields, passing sort argument dynamically clicking sorting headers. have 5 headers(id,desc,type,category,hierarchy). when click headers it's sort ascending , next click descending problem sort 1 attribute want multiple attribute pass collection , maintain previous sorting order , again sort till data relative. in collection: sortasc: function(sortfield) { var key = sortfield; this.comparator = function(model) { return model.get(key); }; this.sort(); }, sortdesc: function(sortfield) { var key = sortfield; this.comparator = function(a, b) { = a.get(key); b = b.get(key); return < b ? 1 : > b ? -1 : 0; } this.sort(); }, view: called when click header(click event) , elem id (dynamically change on click) id,,desc,category,type , hierarchy. sortitems: function(e) {

matlab - Resample and anti-alias FIRLS filter order -

i have audio files recorded in 48khz sampling frequency. have examine audio characteristics , need lower sampling frequencies see when start fail. going test downsampled audio files @ 24khz, 16khz, 12khz, , 8khz. i found matlab function resample(x,p,q,n) . it's easy understand there's 1 thing i'd ask. in description says applies anti-alias firls filter during re-sampling process. understandable. don't know should apply n because accuracy depends on n parameter. values should use obtain decent results in downsampling. help. also, says if downsample high low sampling frequency should in intermediate stages. suggest on this. cheers! :) you can use easier command y = decimate(x,r) the documentation mentions "for better results when r greater 13, divide r smaller factors , call decimate several times.", highest factor of 6 times decimating don't have worry. the default 8th order iir , 30th order fir seem sufficient me, if doubt them can

c - #include does not see the function definition -

i have .c , .h file: misc.c #include "misc.h" int isallzeros(int *arr, int l) { int i; int allzeros = 1; (i = 0; i<l; i++) { if(arr[i]) { allzeros = 0; break; } } return allzeros; } int containsdup(int *arr1, int *arr2, int l1,int l2) { int i,k; int dup = 0; (i = 0; i<l1; i++) { (k=0;k<l2;k++) { if(arr1[i] == arr2[k]) { dup = 1; break; } } if (dup) break; } return dup; } and misc.h #ifndef misc_h #define misc_h #include "ext.h" #include "ext_obex.h" #include "ext_path.h" typedef struct _mnote { t_uint32 t; t_uint8 note, vel; } t_mnote; typedef struct _mped { t_uint32 t; t_uint8 state; } t_mped; typedef struct _note { t_uint32 t, length; t_uint8 note, vel; } t_note; typedef struct _chordind { int

Faster way to get row data (based on a condition) from one dataframe and merge onto another b pandas python -

i have 2 dataframes different indices , lengths. i'd grab data asset column asset_df if row matches same ticker , year. see below. i created simplistic implementation using for-loops, imagine there fancier, faster ways this? ticker_df year ticker asset doc 2011 fb nan doc1 2012 fb nan doc2 asset_df year ticker asset 2011 fb 100 2012 fb 200 2013 goog 300 ideal result ticker_df year ticker asset doc 2011 fb 100 doc1 2012 fb 200 doc2 my sucky implementation: for in ticker_df.name.index: c_asset = asset_df[asset_df.tic == ticker_df.name.ix[i]] if len(c_asset) > 0: #this checks see if there asset data on company asset = c_asset[c_asset.fyear == ticker_df.year.ix[i]]['at'] if len(asset) > 0: asset = int(asset) print 'g', asset, type(asset) ticker_df.asset.ix[i] = asset

How to pass variables that are arguments in user defined functions to subfunctions in r -

i have general problem in understanding how create user defined function can accept variables arguments can manipulated inside defined function. want create function in can pass variables arguments internal functions manipulation. appears many of functions want use require c() operator requires quotes around arguments. so function has able pass name of variable dataframe quotes c() , other functions requiring quote strings. read through many post on paste0 , paste , cat(x) , cannot figure out how solve problem completely. here simple dataset , shortened code structure problem. here want able provide dataframe, , 3 variables. function should provide mean of variable in y position each combo of x , z variable. resultant aggregate table should have names of variables provided arguments xtabar column headers. n=50 datatest = data.frame( xcol=sample(1:3, n, replace=true), ycol = rnorm(n, 5, 2), catg=letters[1:5]) xtabar<- function(ds,xcat,yvar,group){ library(plyr)

javascript - How to create a horizontal sliding sub-menu panel for my site? -

i want create horizontal sliding sub-menu site. when click on menu item 2 sub-menu panel show/hide sliding function or that. just example, it's not i'm copyrighting or - godaddy.com navigation menu. here - jsfiddle there few things want in menu - fades out whole page when menu expand. when click anywhere else sub-menu on fade out page, sub-menu panel auto collapse. and collapse when click same menu item again. it slideup , slidedown smoothly. html <div id="header"> <div id="main-header" class="center"> <div id="menu"> <ul> <li><a href="#">menu item 1</a> </li> <li><a href="#" id="button" onclick="showhide()">menu item 2</a> </li> <li><a href="#">menu item 3</a>

java - Using Collections.sort to sort an ArrayList of a specific object -

so have seen multiple questions addressing similar problems mine, not able find 1 problem. i have arraylist of contact objects, , want sort them using collections.sort: public void sortcontactarraylist(){ arraylist<contact> newlist = new arraylist<contact>(); collections.sort(newlist); } in order this, made contact implement comparable<contact> . and, compareto method looks this: @override public int compareto(contact othercontact) { return this.getname().compareto(othercontact.getname()); } however, receiving error when calling collections.sort(newlist); the error is: "bound mismatch: generic method sort(list<t> ) of type collections not applicable arguments ( arraylist<contact> ). inferred type contact not valid substitute bounded parameter <t extends comparable<? super t>> " does know issue is? said, have seen similar problem customized list of objects " contactdatabase<contact> "

sqlalchemy - How to use descriptors in sqlachemy.orm.synonym -

i have code working fine: def get_timestamp(ts): return datetime.utcfromtimestamp(ts) def set_timestamp(dt): return time.mktime(dt.timetuple()) class group(base): __tablename__ = 'group' _created = column('created', integer, nullable=false) @property def created(self): return get_timestamp(self._created) @created.setter def created(self, value): self._created = set_timestamp(value) i want code this, it's not working: created = synonym('_created', descriptor=property(get_timestamp, set_created)) because passed in self 1st param. i'd use get_timestamp , set_timestamp across project of cause. i'm not going make them methods of class stand alone function. how can achieve this? edit : take option2, , still open other answers. option-1 : code below should work (you not need have class in order define self ): def pget_ti

where will I will get mysql 5.6 developer certification exam model paper -

where oracle mysql 5.6 developer exam 1z0-882 sample questions beneficial exam. friends in advance this blog entry oracle's todd farmer should help http://mysqlblog.fivefarmers.com/2013/10/15/exam-cram-preparing-for-the-mysql-5-6-certification-exams/ has has provided practice sections in linked articles under ("index")

java - Eclipse - Wrapped lines' indentation appears & disappears each time I save -

each time click save entire file's formatting alternates between these 2 formats: this.getobject() .method() .method(); this.method(arg1, arg2, arg3, arg4); and this.getobject() .method() .method(); this.method(arg1, arg2, arg3, arg4); i want stick first format. i have same problem current eclipse configuration. think eclipse bug. my guess problem related option: java code style -> cleanup -> code organizing -> correct indentation getting in conflict with java code style -> cleanup -> code organizing -> format source code which should fix indentation according formatter settings. i disabled option correct indentation in both java code style -> cleanup , java editor -> save actions -> additional actions -> configure... , problem seemed disappear.

datagridview - WPF edit autogenerated column header text -

Image
i'm using wpf datagrid display datatable 's. need able edit bound datatables (two-way binding). i'm using datagrid followed: <datagrid selectionunit="cellorrowheader" isreadonly="false" autogeneratecolumns="true" itemssource="{binding path=selecteditem.bindablecontent, fallbackvalue={x:null}}" /> the problem have, user can't edit columnheader 's cell content or rows. screenshot below illustrates porblem. thing can sort columns. there way edit column headers too, example when user clicks twice, or presses f2 . maybe style ' or headertemplate job? have tried styles , control templates i've found around internet, without success. edit: i managed display column headers in textbox (and not in textblock ) within autogeneratingtextcolumn event handler: private void _editor_autogeneratingcolumn(object sender, datagridautogeneratingcolumneventargs e) { // first: create , add data template parent

import - Set LD_LIBRARY_PATH before importing in python -

python uses pythonpath environment-variable determine in folders should modules. can play around modifying sys.path , works nicely pure python-modules. when module uses shared object files or static libraries, looks in ld_library_path (on linux), can't changed , platform dependent far know. the quick-fix problem of course set environment-variable or invoke script ld_library_path=. ./script.py , you'll have set again every new shell open. also, .so files in case in same directory .py file, may moved absolute path, i'd set them automatically every time invoke script. how can edit path in python interpreter looks libraries platform-independently on runtime? edit: i tried os.environ['ld_library_path'] = os.getcwd() , no avail. i use: import os os.environ['ld_library_path'] = os.getcwd() # or whatever path want this sets ld_library_path environment variable duration/lifetime of execution of current process only. edit: looks need

string - Treat a Character as a variable -

suppose have following code a<-c(1,2,3) b<-'a' now treat string in 'b' variable 'a' when input function or operation. imagine "treat.as.variable()" real function this: treat.as.variable(b)+c(1,2,4) [1] 2 4 7 is there function this, predefined? or way in general? use get function > get(b) + c(1,2,4) [1] 2 4 7

sql - Syntax error when updating -

i'm bit of noobie when come sql, i'm using access 2013 , i'm trying update date field in 1 table, using id numbers different table update specific ones. the query have is: update leadsavailable set first_usage_date = '23/04/2014' leadsavailable r inner join workingtable_gosh g on g.[lead number] = r.[lead number] g.type = 'gosh' but keep getting errors , don't know why. any appreciated try sorry im in mobile: update leadsavailable inner join workingtable_gosh b on a.[lead number] = b.[lead number] set a.[first_usage_date] = '23/04/2014' b.type = 'gosh';

c# - Why is a bool's default val (false) not recognized? -

this question has answer here: why must local variables have initial values 4 answers with code: bool successfulsend; const string quote = "\""; string keepprinteron = string.format("! u1 setvar {0}power.dtr_power_off{0} {0}off{0}", quote); string shutprinteroff = string.format("! u1 setvar {0}power.dtr_power_off{0} {0}on{0}", quote); string advancetoblackbar = string.format("! u1 setvar {0}media.sense_mode{0} {0}bar{0}", quote); string advancetogap = string.format("! u1 setvar {0}media.sense_mode{0} {0}gap{0}", quote); if (radbtnbar.checked) { successfulsend = sendcommandtoprinter(advancetoblackbar); } else if (radbtngap.checked) { successfulsend = sendcommandtoprinter(advancetogap); } if (successfulsend) { messagebox.show("label type command sent"); } i get, " use of unassigned l

resources - How do I reference elements from other resouces? -

i working on xml using fhir resource. found element of resource cross reference other resources. e.g. in encounter (resource), element :serviceprovider cross reference resource(organization). in such case, there way specify elements of resource(organization) on encounter (resource) xml such can validated correctly? i think you're asking is: can constrain information care have captured organization associated encounter (as opposed organization communicated in other manner or context). example, encounter, might want name , phone number while in other contexts may want other information. if that's indeed you're looking for,, solution profile. create profile on encounter and, serviceprovider reference organization, on "type" element, in addition "code" element indicating "organization", you'd specify "profile" element pointing structure wanted enforced on content of organization. structure might defined in same

html5 - Are there any custom semantic html tags project for designing html pages? -

i found semantic ui project here: http://semantic-ui.com/ semantic structured around natural language conventions make development more intuitive. for example bellow code creates menu using semantic : <nav class="ui menu"> <h3 class="header item">title</h3> <a class="active item">home</a> <a class="item">link</a> <a class="item">link</a> <span class="right floated text item"> signed in <a href="#">user</a> </span> </nav> instead of bootstrap css classes: <div class="navbar"> <a class="navbar-brand" href="#">title</a> <ul class="nav navbar-nav"> <li class="active"><a href="#">home</a></li> <li><a href="#">link</a></li> <li><a href="#&

php - How to register mails with shell_exec and plesk 11? -

i want create free e-mail service. i'm using vserver 200gb (for first time) on debian 6 parallels plesk 11 backend. now want simple php script guests register new mail (for themselves). i've asked programming friend if me, did. he has written script this: <form method="post" action=""> <input type='hidden' name='submitted' id='submitted' value='1'/> <label for='email' >email address:</label> <input type='text' name='email' id='email' maxlength="50" /> <br> <label for='password' >password*:</label> <input type='password' name='password' id='password' maxlength="50" /> <input type="submit" name="submit" value="submit" /> </form> <? function sanitize($data) { $data = strip_tags(trim($data)); $search = array('/[^a-za-z0-9\. -\!\

xpath - Behat/Mink - trouble finding buttons -

my application under test has been developed external suppliers have no control on html structure. application extremely javascript , ajax heavy, numerous dynamically generated buttons , auto-complete lists. in other words, characteristics of pages filled with: elements no fixed ids (ids generated on fly , have numbers or other text dynamically added them) the same happens classes most of times buttons have no text associated them since either custom coded 'down' arrows lookup lists (which aren't lookup lists hidden divs) or '+' , '-' icons maximise or minimise portions of content. - it therefore difficult identify these elements, buttons. i trying write generic 'i click on button near y' type of step not necessary hardcode each , every button (assuming can identify them with) each , every test. the thinking behind there label of sort close button @ least. what want to find text label, see if there button inside same scope, , if t

css - How to stick a background behind the navbar? -

i have problem here. i'm using wordpress , confused. how stick background behind nav bar?. activated lowermedia sticky.js menu's plugin, want change navbar background color. try add background: #000; in #navigation . it's okay, when scroll down, navigation background not move. there's navigation text moved. try move background: #000; #navigation .sf-menu a background appear around text, move text when scroll down. don't know now. please me. before. this site : vitraprawira.net this final navbar css code: /* main navigation ================================================== */ /*hide responsive nav*/ #top-bar .selector, #navigation .selector { display: none; } /*core*/ .sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; } .sf-menu { line-height: 1.0 } .sf-menu ul { position: absolute; top: -999em; width: 180px; } .sf-menu ul li { width: 100% } .sf-menu li:hover { visibility: inherit } .sf-menu li { float: left; position: relative; }

Rails Destroy Record link doesn't do anything -

i'm attempting destroy nested record, destroy button appears work , redirect above models page record still shows there. here partial nested record: <p> <tr> <td><%= time_delta.start %></td> <td><%= time_delta.length %></td> <td> <%= link_to 'destroy time delta', [time_delta.stock, time_delta], method: :delete, data: { confirm: 'are sure?' } %> </td> </tr> </p> heres show above class <!-- shows stock--> <h1> stock </h1> <table> <tr> <th>stock</th> <th>hashtag</th> </tr> <tr> <td><%= @stock.name %></td> <td><%= @stock.hashtag %></td> </tr> </table> <!-- shows time

Java -> MySQL query issue -

i trying create java query insert mysql keep getting errors. please see code below. ps connection db fine. here query being called public string newempinsert() { return newempinsert; } private string newempinsert = "insert empinfo" + "(firstname, lastname, ssn, address, salary, pin, emplevel, contactinfo) " + "values ("+firstname+", "+lastname+", "+ssn+", "+address+", "+salary+", "+pin+","+emplevel+", "+contactinfo+")"; here handler being called main public void newempinsert() { // sql connection connection conn = null; try { conn = mysql_connection_test.getconnection(); // create statement statement statement = conn.createstatement(); statement.executequery(queries.newempinsert()); } catch (sqlexception e) { // todo auto-generated catch block //e.printstacktrace(); sy

c - msgtype member in Message Queues -

my server , client structures follows: struct server { long msgtype; char find[20]; }; struct client { long msgtype; char text[200]; }; i send message client program common message queue using msgsnd() function. facing difficulty in understanding statement if msgtyp greater zero, first message of **type** msgtyp received. does type mean when use msgrcv() function message received of type long (in case). if how possible receive structure in long? the argument msgp [of msgrcv() function] points user-defined buffer must contain first field of type 'long int' specify type of message, , data portion hold data bytes of message. (type 'long' same type 'long int') the 'msgtype' field used identify message structure. 'msgtype' field followed user-defined data payload. in example, assign number represent server structure (perhaps '1'), , number represent client structure (perhaps '2'). when

java - how to remove login field when user login and display user's name? -

i have 1 college management web application in have sign-in field student , faculty on top of each page want show when user sign-in in web application sign-in field must disappear , in place of sigh-in field user's name must display in page. please suggest me. you may use header file include in every jsp page. , check if user or faculty logged in show label value of username or else show link sign in

c++ - Rectangles Intersection (Vertical line) -

Image
for given rectangle r1 trying find out other rectangles intersect if draw vectical line segment. the rectangles intersect r1 marked in red. every rectangle characterized (top, left) , (bottom, right) coordinates. r1 = [top, left, bottom, right],...,rn = [top, left, bottom, right] by using coordinates , vertical line. want find rectangles intersects r1 solution i found following library same work icl boost library must simpler: download site: [ https://github.com/ekg/intervaltree][2] #include <iostream> #include <fstream> #include "intervaltree.h" using namespace std; struct position { int x; int y; string id; }; int main() { vector<interval<position>> intervals; intervals.push_back(interval<position>(4,10,{1,2,"r1"})); intervals.push_back(interval<position>(6,10,{-6,-3,"r2"})); intervals.push_back(interval<position>(8,10,{5,6,"r3"})); vector<in

compare - Python quiz, need guidance -

this first code if bear me , thorough possible. this quiz asks question , has 4 possible answers choose 1-4. file reads looks this. right answer displayed above question. a sport uses term love ? a)tennis b)golf c)football d)swimming b german word water ? a)wodar b)wasser c)werkip d)waski what want grab chunk without answer question now, questions , possible answers. , when guess compare answer real answer see if matches, if you'll score , if doesn't don't. biggest queries how compare , these chunks without answer. quiz_file = '/home/wryther/desktop/quiz.dat' num_questions = 146 def get_chunk(buf, n): while buf: chunk = [buf.readline() _ in range(n)] if not any(chunk): chunk = none yield chunk def get_awns(ans): #this transfomrs ints answers str compare if right or wrong. if ans == 1: ans = 'a' elif ans == 2: ans = 'b' elif ans == 3: ans = 'c'

templates - How to correctly pass objects from the controller to the view in PHP? -

for learning purposes, built simple mvc-pattern. in order learn how display content of specific database table in view, wrote simple read-function in model (m_crud.php) so: <?php class crud{ private $database; private $db_table = 'products'; function __construct() { global $database; $this->database = $database; } // read (select) public function read(){ $query="select * $this->db_table"; $result= $this->database->query($query); $num_result=$result->num_rows; if($num_result>0){ while($rows=$result->fetch_assoc()){ $this->data[]=$rows; //print_r($rows); } return $this->data; } } } the database details stored in init.php , crud-object initiated well: <?php // connect database $server = 'localhost'; $user = 'root'; $pass = &#

How to use Robotium with Android Studio? -

robotium android test automation framework has full support native , hybrid applications. now android studio de facto ide android development, i'm interested try android studio. however, couldn't find way set up. how setup , use robotium test android studio? guide: add following line dependencies section of inner build.gradle file (this file located @ same level src folder), change version name if required: androidtestcompile 'com.jayway.android.robotium:robotium-solo:5.2.1' if reason don't want let gradle download dependencies can add them manually: place robotium.jar libs folder. right click , select add library... in src folder create folder androidtest inside create java folder (optional step, see below) inside create package test source same name app’s package name (or add ".tests" end.) place cursor (in editor window) @ class name inside 1 of files want test (e.g. mainactivity) , press alt+enter. select create test

c++ - Remove XML declaration using msxml2 IXMLDOMDocument2 -

i want remove xml declaration xml using c++ <?xml version="1.0" encoding="utf-8" ?> then want add line , resave xml <?xml version="1.0" encoding="iso-8859-1" ?> all have , know how load xml document hr = ixmldomdocument->load(vstrfilename, &status); using ixmldomdocument2 interface of msxml2 how can achieve ? programming environment borland c++ builder 6 thank you <? text ?> processing instruction. node of type node_processing_instruction . retrieve node first child of document, using get_childnodes , delete removechild . then, use createprocessinginstruction new encoding , use insertbefore (with new first child) add document.

Django Query Relations Behaviour -

okay there way filter objects records associated records. right join maybe? basically, want select records b has foreign key whilst using clause on b. making sound more complicated is? don't need records b, a; maybe subquery? i'm relatively new django's queries , i've done of simpler stuff. your question little vague, if understand correctly work this: class a(models.model): pass class b(models.model): = models.foreignkey(a) some_field = models.integerfield() a.filter(b__some_field=5).distinct() this joins 2 tables , filters on b 's some_field . distinct() makes sure unique a s returned. see documentation on lookups span relationships .

c# - Add data to a table from database -

i new .net , c# , want perform update/delete. using e template has table. want data database , display in table , perform update. protected void page_load(object sender, eventargs e) { sqlconnection connection = new sqlconnection(configurationmanager.connectionstrings["registrationconnectionstring"].connectionstring); sqldatareader rd; sqlcommand comand = new sqlcommand(); //open connection database connection.open(); //query select users given username comand.commandtext = "select * artikulli "; rd = comand.executereader(); if(rd.hasrows ) { while (rd.read()) { row1.items.add(rd[0].tostring()); } } connection.close(); } row1 id of table row. know not best way , doesn't work. i error: cs0103: name 'row1' not exist in current context my table row row1 declared below: <td id="row1" style="width: 73px">&nbsp;</td> it'

Stripe javascript with Ruby on Rails -

i sure simple, cannot figure out. new stripe , configuring on website first time. using following javascript code stripe's library make charges. <script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" data-key="<%= rails.configuration.stripe[:publishable_key] %>" data-description="qsnag 1 time fee" data-amount="<%=@amount*100%>" data-email="<%=current_user.email%>"> </script> as can see here, amount variable based on plan user chooses. question how can access amount in charge controller create charge. charges controller code below def create customer = stripe::customer.create( :email => params[:stripeemail], :card => params[:stripetoken], :plan => @plan_id, ) charge = stripe::charge.create( :customer => customer.id, :amount => @a

python 3.x - How to turn a string lists into a lists? -

there other threads turning strings inside lists different data types. want turn string in form of lists lists. this: "[5,1,4,1]" = [5,1,4,1] i need because writing program requires user input lists example of problem: >>> x = input() [3,4,1,5] >>> x '[3,4,1,5]' >>> type(x) <class 'str'> if mean evaluate python objects this: x = eval('[3,4,1,5]'); print (x); print(type(x) list) [3, 4, 1, 5] true use caution can execute user input. better use parser native lists. use json input , parse it.

javascript - jquery choosing one checbox between two checboxes -

i have 2 checkboxes. want algorithm happen: if check checkbox1 want checkbox 2 uncheck, if check checkbox2 want checkbox1 unchecked. therefore, need select 1 checkbox only. , want in jquery. thank you.. html <input type="checkbox" name="checkme" id="cc1">check me1</input> <input type="checkbox" name="checkme" id="cc2">check me2</input> javascript $('#cc1').change(function(){ var c = this.checked ? $('#cc1').prop('checked', true) : $('#cc2').prop('checked', false); }); $('#cc2').change(function(){ var c = this.checked ? $('#cc2').prop('checked', true) : $('#cc1').prop('checked', false); }); http://jsfiddle.net/z4nkw/ $('#cc1').change(function(){ $('#cc2').prop('checked', !$(this).prop('checked')); }); $('#cc2').change(function(){ $('#cc1').pro

php - How to resize image using Codeigniter -

i trying upload image , resizing image.i want both image original image thumb image. but problem image resizing code not working. image uploading code working fine store image in folder image resizing code not working. how can ? here code public function add_images(){ $this->form_validation->set_rules('description','description','required'); $this->form_validation->set_rules('status','status','required'); if($this->form_validation->run() == true) { // print_r($this->input->post()); $config['upload_path'] = 'public/img/inner_images/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; // upload valid images // update library setting of upload $this->load->library('upload', $config); //upload image $this->upload->do_upload('image'); $finfo = $this->uplo

jquery - How to get same aligment in Javascript? -

Image
i trying add html code in javascript alignment , styling. searching on google 3 4 days not getting suitable answer. looking for? javascript code : function readcookie() { var ca = document.cookie.split('%'); alert(ca); } function getcookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); if (c.indexof(name)==0) return c.substring(name.length,c.length); } return ""; } function checkcookie() { var user=getcookie("username"); var span = document.getelementbyid("file_handle"); //span.innerhtml = ''; // clear existing if (user!="") { //document.getelementbyid('file_handle').innerhtml; // span.appendchild(user); span.textcontent = user; // test case } } thank in advance do mean alignment of html elements via jscript? how add css using html dom

SQL/HSQLDB query and sub-query in Aggregate Function -

my database looks (very simple) , called "ridedate": bikedate bike miles looking achieve query each month total(sum) across years, average(avg) across years, , total specific year (where year("date")= '2014"). (i don"t have exact code in front of me due power fluctuations, pushing me onto ipad (high winds , wet/heavy snow)). my attempt goes this: select month("bikedate") "month", sum("miles") "smiles", avg("amiles") "average", (select month("bikedate") sum("miles") year("bikedate") = '2014') "2014" "ridedate" group month("bikedate") order month("bikedate") asc the results should be: (month) (sum of month on years) (avg of month on years) (sum of month '14) the last column not collate 'group month' , gives sum whole year. how can write sub-query sum across iterated month of main query sele

javascript - How to get child div contents from multiple parent divs with same id when each of them is clicked -

i have multiple divs same id , need content of child's div when parent div clicked, divs dynamically created. following code explains : i have php file generate multiple divs same id follows : <div id="display" style="display: block;"> <div class="display_box" id="display_box" align="left"> <div class="pic"><img src="https://graph.facebook.com/picture"></div> <div class="picname">sahrish rizwan</div> </div> <div class="display_box" id="display_box" align="left"> <div class="pic"><img src="https://graph.facebook.com/picture"></div> <div class="picname">sahil devji</div> </div> <div class="display_box" id="display_box" align="left"> <div class="pic"><img src="https://graph.facebo

android - Background Image compressed in Mobile Chrome and Opera -

i'm working on page mobile devices , got sprite background image, 13 times higher related div-container. changing background position of sprite, looks animation. works fine on different ipads (safari, chrome, dolphin), microsoft surface , sony xperia tablet z (chrome, firefox, opera, dolphin, android ver. 4.3). i'm testing page on asus transformer prime samsung galaxy tab 10.1n (stock browser, firefox, dolphin, chrome, opera). on 2 devices, there's weird bug in mobile chrome (ver. 34.0.1847.114) opera (ver. 21.0.1437.74904). android version of samsung tab 4.0.4 , of asus 4.1.1. the wohle sprite compressed on y-axis. originally, sprite 8879px on y-axis 1024px on x-axis large, background-size of div container. while sprite compressed, change of background-position works normaly, till bottom of sprite reaches bottom of div-container. both browser start stretching sprite when want change background position. happens till background position reches value -7770px, image d

java - FatWire Content Server CSDT import/export failure -

i trying import , export workspace from/to fatwire contentserver using csdt. i first wanted try "simple" export of provided "firstsiteii" site following command : java -classpath $csdtjar_folder/csdt-client-1.0.4.jar:$csdtjar_folder/lib/* com.fatwire.csdt.client.main.csdt $cs_url username=fwadmin password=mypassword cmd=export datastore=test fromsites=firstsiteii 'resources=@all_assets:*' but, got error : *** exporting batch 1398411569399 exporting assetdata document_cd:1112649867903 (batch 1398411569399) java.lang.classnotfoundexception: com.fatwire.rest.util.assetjaxbserializer @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1680) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1526) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:190) @ com.fatwire.realtime.packager.csdtutil._getserializer(y:930) @ com.fatwire.realtime.pa