Posts

Showing posts from July, 2013

java - Changing color of the border of the background of a list item -

i going through this tutorial , had idea of making when press button, 1 of cards borders changes color. i looked @ this solution , nothing happens. here have done: i have xml in drawable shape (feed_item.xml): <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- bottom 2dp shadow --> <item> <shape android:shape="rectangle"> <solid android:color="#d8d8d8" /> <corners android:radius="7dp" /> </shape> </item> <!-- white top color --> <item android:bottom="3px" android:id="@+id/feedsquare"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <!-- view background color --> <solid

numpy - Pandas - Delete rows with two or more NaN values in dataframe -

i want delete column values contain many nan values; specifically: 2 or more. have dataframe column looks this. below column had 40 rows . want remove nan values 19th row (after 17.9 value). avgws 0.12 1 2.04 3.01 3.99 5 6 7 7.99 9 10 10.98 11.99 13 13.93 14.99 15.98 nan 17.9 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan thanks you can call isnull() on column, return series boolean values, cast int , true values become 1 , false becomes 0 , call cumsum() , filter df cumumlative sum less 2 equates point nan count becomes greater 2: in [110]: df[df['avgws'].isnull().astype(int).cumsum() < 2] out[110]: avgws 0 0.12 1 1.00 2 2.04 3 3.01 4 3.99 5 5.00 6 6.00 7 7.00 8 7.99 9 9.00 10 10.00 11 10.98 12 11.99 13 13.00 14 13.93 15 14.99 16 15.98 17 nan 18 17.90

.net - TSQL - how to read datetimes from files with xp_dirtree -

i'm working tsql-script uses xp_dirtree pick file name directory multiple bak-files, , restores database using selected filename , directory. however, want able select recent file said folder. currently, script picks top after ordering filename. the folder might this: ------------ file1.bak file2.bak file3.bak file4.bak ------------ my script looks this: declare @dir varchar(60) set @dir = 'c:\testfolder\' create table #directorytree ( id int identity(1,1) ,subdirectory nvarchar(512) ,depth int ,isfile bit); insert #directorytree (subdirectory,depth,isfile) exec master.sys.xp_dirtree @dir,1,1; declare @file varchar(60) = (select top 1 subdirectory #directorytree isfile = 1 , right(subdirectory,4) = '.bak' order subdirectory desc) set @dir = @dir+@file print '--selected file

osx - Disable editing in NSTextView -

i trying disable editing in nstextview there doesn't seem option there.all other types have enabled property when set false non editable there nstextview? please not forget class inherits methods of superclass. superclass of nstextview nstext . , there find method (void)seteditable:(bool)flag with comment: controls whether receiver allows user edit text.

php - How to get data from a form who using method GET -

i have problem form. tried value form no result. form is: <form action="{{ path('show_product_category',{ 'id':category.getid(), 'name':category.getcategorylink() }) }}" method="get" {{ form_enctype(form) }}> {{ form_widget(form) }} <input type="submit" class="btn btn-primary marg-left-20" value="search"/> </form> my controller : $entity = new product(); $form = $this->createform(new producttype(), $entity); $request = $this->getrequest(); $form->handlerequest($request); //get filter array search if ($form->isvalid()) { $afilter['iminprice'] = $form["min_price"]->getdata(); $afilter['imaxprice'] = $form["max_price"]->getdata(); } print_r($afilter); my productrepository: public function buildform(formbuilderinterface $builder, array $options) { $builder->add('min_pric

Get result set in plsql -

am wondering if there rewriting suggestions functions such generating recurrence dates between 2 dates - generate_recurrences() link recurrency recurrency events in plsql? returns setof date, in plsql can't figure out how resultset dates , looping return next next_date, next returns next date on list. i tried rewrite in plsql return of 1 date, because can't find out how return resultset in plsql, i've tried: create or replace function generate_recurrence( rec in varchar2, start_date in timestamp, end_date in timestamp ) return timestamp next_date timestamp := start_date; duration interval day second; day interval day second; begin if recurs = 'none' return next_date; elsif recurs = 'daily' duration := interval '1' day ; while next_date <= end_date loop return next_date + duration; end if; end; i wrote following pipelined fun

jquery ajax anonymous function when trying to pass form data -

i trying pass input file field through jquery ajax , getting anonymous function in chrome inspector console says because of line in script: $.ajax({ heres code run after have <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> $("#sendcoverimageform").click(function(e){ e.preventdefault() var mform = $("#sendformone").serialize() $.ajax({ type: "post", url: "{% url 'ajax_coverimage' %}", data: mform, success: function(data){ console.log(data) $("#coverimagemodal").modal("hide"); }, error: function(data){ var obj = data.responsejson $("#modalmessage").html("<p style='color:red;'>" + obj + "</p>") },

c# mysqlcommnand insert into mysql database -

i have program insert list of field database. when use own computer insert datetime field looks completing fine. however, when insert using windows 7 chinese edition, field become 0000-00-00 00:00:00 command mysqlcommand mycommand4 = new mysqlcommand("insert orderrecords_table values('" + orderidlabel.text + "','" + customercode + "','" + customer + "','" + telcombobox.text + "','" + licensecombobox.text + "','" + drivercombobox.text + "','" + addresscombobox.text + "','" + locationtypecombobox.text + "','" + pickupcombobox.text + "','" + customertypelabel.text + "','" + convert.todecimal(totalpricelabel.text) + "','" + status + "','" + note + "','" + sandreceiptno + "','" +

java - Replacing programs with batch issue -

i want create auto-updater of program. in java part looks like int pid = kernel32.instance.getcurrentprocessid(); string cmd = folder + "update.bat" + " " + currentloc + " " + updateloc + " " + integer.tostring(pid); runtime.getruntime().exec(cmd); and batch contains set "name=gamedrive logs viewer.exe" set "myname=update.bat" taskkill /pid %3 taskkill /pid %3 del "%1\%name%" move "%2\%name%" "%1" "%1\%name%" del "%2\%myname%" so, i'm killing current program , delete it. move new version old folder, run new version, , delete bat file. bat file works when call cmd sending parameters. nothing happend when i'm trying use java program. found, dialog windows creating current program have same processid. (i tested bat). so, guess batch called java program same processid , kill himself. right? , if yes - can how that? i guess n

Call MYSQL stored procedure through c# -

i trying call mysql stored procedure through c# keeps giving me error saying "you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''55\'', 'useremail','username@company-it.pk\''' @ line 1 " sp takes 3 input parameters user_id, preferences_key , preferences_value. have checked sp executing through mysql works want excute through c#. below code. mysqlcontext = new mysql_otrsentities(); var userid=mysqlcontext.users.where(x=>x.login==agent.login).select(x=>x.id).firstordefault(); mysqlparameter param1 = new mysqlparameter("@user_id", agent.id); param1.mysqldbtype = mysqldbtype.int32; mysqlparameter param2 = new mysqlparameter("@preferences_key", "useremail"); param2.mysqldbtype = mysqldbtype.varchar; mysqlparameter param3 = new mysqlparameter("@preferences_value", agent.login); param3.mysqldbtype = mysqldbtype.longblob; mysqlcon

rspec - Rails ActionController::UrlGenerationError -

i have basic rspec tests client model. , broke after assigned current_user. have problems figuring out what's wrong. looking help. problem exist show , edit , delete actions require 'spec_helper' describe 'clientpage' subject {page} let(:user) {factorygirl.create(:user)} let(:client) {user.clients.build(client_name: client_name, client_secondname: client_secondname, budget: budget, project: project)} let(:client_name) {'client'} let(:client_secondname) {'first'} let(:budget) {3000} let(:project) {'project'} before {sign_in(user)} #==============================new page===========>> describe 'new client page' before {visit new_client_path} {should have_title('new client')} let(:submit) {"create"} describe 'create' context 'invalid creation' 'should not create client' expect{click_button submit}.not_to cha

javascript - How To Reinitialize tinyMCE with fresh data after an AJAX Call? -

i have page used both create , update. when user writes name , if name doesn't exist in database added along newly created description (through tinymce plugin) (this part works perfectly). when user selects existing name, ajax request fired pull description. able pull description correctly response (text) not shown in tinymce. using latest version of tinymce. my question how can reinitialize tinymce control has been initialize on page load, or there other way achieve this, want existing description updated you don't need perform re-initialize editor, using below command tinymce.activeeditor.setcontent('some content here') instead. can try this?

html - How to use CSS to create two column page layout? -

i create 2 column web page in that example . each column contains description photo next - know how use css achieve that? .col-half { width: 40%; float: left; padding:15px; } .col-half div { background-color:orange; color:white; margin:5px; border:1px solid black; background-image:url('http://img1.wikia.nocookie.net/__cb20100915194254/starwars/images/7/7f/jabba_swsb.png'); background-size:cover; min-height:150px; } <div class='col-half'> <div>asdf</div> <div>zyzzz</div> <div>asdf</div> <div>12345</div> </div> <div class='col-half'> <div>asdf</div> <div>zyzzz</div> <div>asdf</div> <div>12345</div> </div> note width 40%, make room margin/padding. can adjust see fit.

c# - Performance with SQL Server cursor in following application scenario -

i've wondered how can modify application because have performance problem. have following application scenario. i've used c# console application sql server. application scenario: select 15 000 unique userid (int) foreach list of users , list of documents (documentid) every userid. ( perhaps 50 documents per 1 user. ) insert database table called permissions - userid, documentsid - perhaps - 15 000 * 50 = 750 000 rows my scenario: i have create 2 stored procedures in sql server, first select userid's , second documents according userid , inserting permissions table. stored procedure: dbo.createdocumentpermissions declare @userid bigint begin try declare permissionscursor cursor select userid dbo.[user] open permissionscursor fetch next permissionscursor @userid while @@fetch_status = 0 begin begin try exec dbo.savedocumentspermissions @userid = @userid end try begin cat

jquery - javascript not working on struts html tag -

i have following codes in jsp page in struts2 project <select id="amountselect"> <s:iterator value="ratecarddetailslist" status="liststatusamount"> <option value="<s:property value='#liststatusamount.index'/>"><s:property value="rechargeamount"/></option> </s:iterator> </select> and corresponding script $(document).ready(function() { $("#amountselect").change(function(){ var v= $("#amountselect").val(); var r= "<s:property value='ratecarddetailslist["+ v +"].mobilerate'/>"; alert(r); }); }); where ratecarddetailslist array of particular bean(object) contain variable mobilerate . i'm getting null @ position of 'r' whil alerting (alert(r);). on inspecting element following $(document).ready(function() { $("#amountselect").change(function(){

php - Apache keeps forcing non-UTF-8 character set -

Image
i having character encoding problem web page works in local once uploaded remote server doesn't works properly. i have simple textarea use update mysql database row utf-8 encoded text. pages html5 , use utf-8 encoding. <!doctype html> <html> <head> <meta charset="utf-8"> ... also database , tables encoded utf8 database charset , utf8_general_ci database collation . when submit form , see updated textarea info database, see messed character. in local (but connecting same remote database), fine. this textarea <textarea class="form-control" name="info" required><?=htmlentities(getinfo($mysqli));?></textarea> and function output result function getinfo ($mysqli) { if ($result = $mysqli->query("select info settings limit 1")) { $row = $result->fetch_assoc(); $result->free(); } return $row["info"]; } i have impression remote web server o

python - PyQt Node interface - Parrent to ItemIsMovable object -

Image
so building node based interface using pyqt project working on , having issues getting objects belong base not follow in space. when user drags base node, child objects (inputs , output boxes) follow it. have drag-able node works child objects not following properly. ideas? #!/usr/bin/python # -*- coding: utf-8 -*- """ base py file gui """ import sys pyqt4 import qtgui, qtcore array import * """ base class node. contains initialization, drawing, , containing inputs , outputs """ class node(): width = 100 height = 100 color = 1 x = 90 y = 60 inputs=[] outputs=[] def __init__(self, nwidth, nheight): self.width = nwidth self.height = nheight self.ininodedata() """ inputs , outputs created """ def ininodedata(self): j in range(5): = self x = input(this,90, 0+(j*10)) self

ios - unexpectedly found nil while unwrapping an Optional value for UITableVewCell custom cell class -

Image
when running code table view, trying instantiate custom cell , fill values , seems work find until gets putting values outlets. couple notes : i know preferred method here use "tableview.dequeuereusablecellwithidentifier" in situation taking different route. also, outlets in custom cell hooked corresponding cell in story board. appropriate delegates setup. thanks in advance. class favoritespropertyviewcell: uitableviewcell { @iboutlet weak var activityindicator: uiactivityindicatorview! @iboutlet weak var cellpropertyimage: uiimageview! @iboutlet weak var cellroomsvalue: uilabel! @iboutlet weak var cellspacevalue: uilabel! @iboutlet weak var cellpricerangevalue: uilabel! @iboutlet weak var cellcitystatezipvalue: uilabel! @iboutlet weak var celladdressvalue: uilabel! } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell{ var newpropertycell: favoritespropertyviewcell = fa

How to list files and folders together in liferay? -

i trying list files , folders under root folder of liferay site. querydefinition querydefinition = new querydefinition(workflowconstants.status_any, queryutil.all_pos, queryutil.all_pos, null); list<object> list = dlfolderlocalserviceutil.getfoldersandfileentriesandfileshortcuts(groupid, folderid, null, true, querydefinition); is right way? how differentiate files , folders? you can , differentiate files, folders , shortcuts following: list <object> foldersandfileentriesandfileshortcuts = dlappserviceutil.getfoldersandfileentriesandfileshortcuts( folder.getgroupid(), folderid, workflowconstants.status_any, true, queryutil.all_pos, queryutil.all_pos); (object folderandfileentryandfileshortcut: foldersandfileentriesandfileshortcuts) { if (folderandfileentryandfileshortcut instanceof fileentry) { fileentry fileentry = (fileentry) folderandfileentryandfileshortcut; } else if (folderandfileentryandfileshortcut instanc

jenkins - Push to git without an email adress -

Image
i'm using jgit.sh on linux trying push file git reppository via shell commands on jenkins. my jenkins jobs following: fetch git repo via jenkins git plugin i use maven commands , additional files created under workspace. use jgit.sh push files git repository. i'm executing following commands: jgit.sh checkout master jgit.sh add ui5propreties.xml jgit.sh commit -m "commit files" jgit.sh push origin master i'm using jgit.sh user called solmanvoter , user doesn't have email adress on git. user. so following error when run job: remote: error: in commit d704a1f404f052f8117b456ac59a67a69cbfc281 remote: error: committer email address remote: error: not match user account. remote: error: remote: error: have not registered email addresses. remote: error: remote: error: register email address, please visit: remote: error: https://git.wdf.sap.corp/#/settings/contact remote: ssh://git.wdf.sap.corp:29418/sandbox/grcsandbox/pr1234_forcecommit

android - How to display toast when changing focus in EditText? -

i working on login page of activity have username , password 2 edittext boxes. trying display toast message when focus changed username password box : -if text entered in username box has whitespace in it. -if no white space no toast display. edittext txtedit = (edittext) findviewbyid(r.id.edittxt); txtedit.setonfocuschangelistener(new onfocuschangelistener() { public void onfocuschange(view v, boolean hasfocus) { if (!hasfocus) { if (txtedit.gettext().contains(" ")) { toast.maketext(context, text, toast.length_short).show(); } } }); reference: https://stackoverflow.com/a/10627231/2111834

ios - iPhone objects not sizing correctly on different devices -

Image
so i'm building application has different objects on viewcontroller. when run in on iphone 5/5s runs nicely, whereas on 6 , 6 plus looks messed up. used know how make work on devices, can't figure out anymore. can me please? here photos more explanation: 6 plus: 5s: please help, i'm new , i'd detailed explanation. select both objects add following constraints: and after that: that should keep textfield , button in center on devices.

datetime - process the files in S3 based on their timestamp using python and boto -

i trying process files in s3 based on timestamp these files have. have code provides me date modified attribute of files , parse convert appropriate format using boto.utils.parse_ts . want sort files , if possible put key name in list in sorted order oldest files comes first processing. how can this? con = s3connection('', '') bucket = conn.get_bucket('bucket') keys = bucket.list('folder1/folder2/') key in keys: date_modified = parse_ts(key.last_modified) there lots of ways here's 1 way should work: import boto.s3 conn = boto.s3.connect_to_region('us-east-1') bucket = conn.get_bucket('mybucket') keys = list(bucket.list(prefix='folder1/folder2/')) keys.sort(key=lambda k: k.last_modified) the variable keys should list of key objects sorted last_modified attribute oldest first , newest last.

oracle - Need sql statement to join two lists of data into one with one common variable -

i have table columns patient # , adverse event: 0101 headache 0101 vomiting 0105 pink eye 0201 fever 0201 skin rash 0201 cold 0204 coughing and second table columns patient # , medication: 0101 aspirin 0201 tylenol 0201 hydrocortisone 0201 midol 0201 benedryl 0201 advil 0203 ginkgo biloba 0204 advair 0204 triaminic i sql query combine 2 lists this: 0101 headache aspirin 0101 vomiting 0105 pink eye 0201 fever tylenol 0201 skin rash hydrocortisone 0201 cold midol 0201 benedryl 0201 advil 0203 ginkgo biloba 0204 coughing advair 0204 triaminic basically dumping contents of 2 tables patient # (no relationship between adverse event , medication) simple joins not give result need have row number partitioned patient : selec

Windows Batch script to get filename as input and search the file in a folder location -

i want create windows batch file includes 3 tasks mainly: 1.it ask user input like: please enter file name search: where have give file name , depending on file name search in specified location. 2.if file found ,again search pattern(e.g-"error") in file. 3.copy 10 lines line pattern found , paste contents file. example: you have entered file name as: demofile 1.it search demofile.log in specified location. 2.if above file found search pattern(e.g-"error"). 3.suppoese pattern error found in line #20 ,then copy contents line #20 line #30 file( mydemofile.txt ). it seems quite complex. anyhow need badly. thanks in advance :) below code snippet in prompts user file name. @echo off *** prompting user enter id***** set /p uname=please enter conversation id: if "%uname%"=="" goto error echo entered conversation id : %uname%, below log files related id: /f "tokens=* delims=" %%x in (a.txt) echo %%x *** f

ios - Is implementing the UITableViewDataSource protocol required for table functionality -

ive created class declaration class lessondetailsviewcontroller: uiviewcontroller { @iboutlet var detailstable: uitableview! i can populate contents in table , provide operations implementing proper tableview functions. but did not implement uitableviewdatasource protocol these functions defined. can please explain me key concept i'm missing makes possible? how ios know call these methods of class doesn't implement uitableviewdatasource protocol? you must need implement required method of uitableview datasource , delegate method. (nsinteger)numberofsectionsintableview:(uitableview *)tableview (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

mysql - Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\widget_corp\data_base.php -

i trying select data mysql table, warnings: notice: undefined variable: result in c:\wamp\www\widget_corp\data_base.php on line 40 and one: warning: mysqli_fetch_row() expects parameter 1 mysqli_result, null given in c:\wamp\www\widget_corp\data_base.php on line 40 this code: $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); // test if connection occured if (mysqli_connect_errno()){ die ("database connection failed: " . mysqli_connect_errno() . " (" . mysqli_connect_errno() . ")" ); } // perform database query $query = "select * subjects " ; $resut = mysqli_query($connection, $query); // test if there query error if (!$resut){ die ("database connection failed!"); } // use return data if while ($row = mysqli_fetch_row($result)){ //output data each row var_dump($row); echo "<hr />"; }

Applying a Kalman filter on a leg follower robot -

i asked create leg follower robot (i did it) , in second part of assignment have develop kalman filter in order improve following process of robot. robot gets person distance robot , angle (it relative angle, because reference robot itself, not absolute x-y coordinates) about assignment have serious doubt. have read, every sample have seen kalman filter has been in 1 dimension (a car running distance or rock falling building) , according task have apply in 2 dimensions. possible apply kalman filter this? if possible calculate kalman filter in 2 dimensions understand asked follow legs in linnearized way, despite person walks weirdly (with random movements) --> have doubt of how establish function of state matrix, please tell me how or tell me can find more information this? thanks. well should read on kalman filter. estimate state through mean , variance separately. state can whatever want. can have local coordinates in state global coordinates. note latter resu

java - Handling exception in Service layer -

could please advice how overcome problem described below: there application (it involves using hibernate , spring frameworks) 3 layers: dao, service , controller. want avoid saving duplicate entities in db. made using constraints @ db-level , in annotation in bean ( @table(name = "artist", uniqueconstraints = {@uniqueconstraint(columnnames = "artist_name")}) ). logic supposes if try add duplicate entity exception thrown. try process exception in service layer fails succeed. mean when explicitly notice exception thrown application can't proceed work because of exceptions. more clear cite code below: dao-layer @override public void saveentity(client client) { session session = sessionfactory.getcurrentsession(); session.save(client); } service-layer @transactional @override public boolean saveentity(artist entity) { boolean completedstate = false; try { //method dao-layer artistdao.saveentity(entity); } catch (cons

Google Prediction API always returns a score of 1.0 or 0.0 -

i'm using the insert function of google-api-ruby-client , passing in array of traininginstances. when call predict used scores 0.653264 , 0.346736 (using 2 output categories). after doing refactoring scores of 1.0 , 0.0 , no probabilities in between. the prediction accuracy (measured me) still close accuracy given status function looks trained model working. want know why i'm not getting scores in between 1 , 0 use in application. any insight appreciated. here sample of training data i'm using: "completed registration",32.54,2,0,1,12 "completed registration",27.05,2,0,1,7 "completed registration",27.29,1,0,3,7 "completed registration",24.15,1,0,1,6 "completed registration",26.36,2,0,1,6 "completed registration",27.0,3,1,3,5 "completed registration",22.15,3,1,3,5 "completed registration",27.9,2,1,1,1 "completed registration",21.21,2,0,3,0 "completed registration&quo

php - Update picture/image in Codeigniter -

i'm trying create update image user want change photo.the when click submit on photo upload, there no photo uploaded , photo's column still no update. here contorller: function foto($id='') { $data['data'] = $this->user_model->get_foto($id); $data['form_action'] = site_url("user/update_foto/$id"); $this->load->view('user/foto_form', $data); } function update_foto($id=''){ $this->user_model->update_foto($id); } here model: function get_foto($id=0){ $id = $this->session->userdata('id'); $sql = "select id,foto user id= '$id'"; $query = $this->db->query($sql); $data = $query->row_array(); return $data; } function update_foto(){ $config['upload_path'] = './upload/'; $config['allowed_types'] = 'jpg|png|jpeg';

javascript - Loading state as a modal overlay in AngularJS -

i want load state modal can overlay state without effecting other states in application. example if have link like: <a ui-sref="notes.add" modal>add note</a> i want interrupt state change using directive: .directive('modal', ['$rootscope', '$state', '$http', '$compile', function($rootscope, $state, $http, $compile){ return { priority: 0, restrict: 'a', link: function(scope, el, attrs) { $rootscope.$on('$statechangestart', function (event, tostate, toparams) { event.preventdefault(); }); el.click(function(e){ $http .get('url here') .then(function(resp){ $('<div class="modal">' + resp.data + '</div>').appendto('[ui-view=app]');

c# - System.DivideByZeroException without division -

i using code capture short bursts of video connected camera: private void show() { if (videodevice != null) { videodevice.videoresolution = capabilities[combobox1.selectedindex]; size = ((size) combobox1.selecteditem); videodevice.newframe += new aforge.video.newframeeventhandler(frame); videodevice.start(); } } private void frame(object sender, newframeeventargs e) { if (count > 7 && !motion) { urame = 0; b = ((bitmap) e.frame.clone()); if (detector.processframe(b) > 0.02) { motion = true; writer.open(@"c:\users\home\documents\visual studio 2013\projects\cctv\cctv\bin\wesdgzufjw3.mp4", size.width, size.height, 30, videocodec.msmpeg4v3); } } else if (motion) { b = ((bitmap) e.frame.clone()); writer.writevideoframe(b); if (detector.processframe(b) < 0.02) { motion = false; writer.close(); }

python - Package import creates a module, submodules still importable -

i've been working on python package , turn small rpm distribution. package includes few modules, 1 of executable. can create rpm-package python setup.py bdist_rpm , install on fedora box rpm . at point have desired command myscript , works charm. when try import package in ipython , run strange. can following from myscript import sdf import myscript.mol2 both work flawlessly, but import myscript myscript.sdf throws attributeerror: 'module' object has no attribute 'sdf' i've been working while no avail. there's plenty of questions of import problems, haven't found answer 1 yet. what should change make work? the current folder structure is: myscript/ #project root setup.py src/ myscript/ __init__.py functions.py sdf.py mol2.py runner.py bin/ myscript #symbolic link src/myscript/runner.py setup.py is: from distutils.core import setup setup(name = 'myscript', version =

c - How to implement a language interpreter without regular expressions? -

i attempting write interpreted programming language read in files , output bytecode-like format can executed virtual machine. my original plan was: begin loading contents of file in memory of interpreter, read each line (where word defined being series of letters followed space or escape character), using regular expressions, determine parameters of word, for example, if myvalue = 5 then become if myvalue 5 , convert each of these words byte form (i.e. if become 0x09 ), execute these bytes 1 one (as executor understand if or 0x09 followed 2 bytes. i have been told regular expressions terrible way go doing this, i'm unsure if or bad way of implementing interpreted language. this experience, don't mind if isn't performance friendly, benefit. what best way of implementing interpreter, , there examples (written in plain old c)? the reason why people tell regular expressions aren't best idea case because regular expressions take more time