Posts

Showing posts from April, 2011

jquery - How to return the new files name when set defer=true in express.bodyParser -

express config: server.configure(function () { server.use(express.bodyparser({ keepextensions:true, limit:100000000, defer:true, uploaddir: "d:/"}) ); upload controller: exports.upload = function(req, res){ req.form.on('progress',function(bytesreceived, bytesexpected){ res.send({loaded: bytesreceived, total: bytesexpected}); }); req.form.on('complete',function(){ if(!path.existssync(uploaddir)){ mkdirp(uploaddir, function (err) { if (err) console.error(err) saveimg(req, res); }); } else { saveimg(req, res); } }); }; var saveimg = function(req, res) { var scrname = req.files.files[0].path; var distname = uploaddir + uuid.v4() + '.png'; var gm = require('gm'); gm(scrname) .resize(1000, 1000) .autoorient() .write(distname, function (err) { fs.unlink(scrna

c# - Fetching Data For crystal Report and displaying in it -

Image
table1 doctorid(primary key), fee, fee-unit, name table2 doctorid(foreign key), full name, age i have 2 tables ,i trying fetch rows in doctorid same(to display in crysatal report ) ,i tried below query , working fine , giving me result shown in crystal report ,now problem 1)in crystal report doctor name duplicating number of patients (which want show once ) 2)same fee column fee duplicating number of patients time 3)below fee column showing sum how give heading "total fee=" 4)and if don't want show patient name count shall use different datatables ? if b query getting number of patients query da = new oledbdataadapter(@"select d.[firstname]&' '&d.[lastname] [doctor name],d.[fee_unit], d.[fee],p.[pfirstname]&' '&p.[plastname] [patient name],p.[age],p.[birthdate],p.[mobileno]&' '&p.[landlineno] [contact number] doctor_master d,patient_registration p p.doctorid=" + drid + "

php - Use boolean value received from mysql query to update a value -

i need switching boolean value in field in small mysql db. created index.php shows names , presence field (present/away). use boolean. value clickable, should switch boolean value. here relevant code: $id=$_get['id']; $qresult = mysqli_query($con,"select present personnel inlogcode='$id'"); $result=mysql_fetch_array($qresult); $presence = (bool)$result; echo "id is: " .$id . "<br>"; echo "boolean res is: " . $presence . "<br>"; if ($presence) { $sql="update personnel set present=true inlogcode='$id'"; $resultaat=mysql_query($sql); } else { $sql="update personnel set present=false inlogcode='$id'"; $resultaat=mysql_query($sql); } i cannot find out how convert result of query true boolean value can use in rest of php script. adding mysql_fetch_array seems unnecessary, seem lose boolean value zero's or one's. test db of course contains b

loops - Python - Continous Button Inputing (Sort of like BCD) -

i trying make simlar calculator, not full fledge one, 1 take inputs buttons , make operations on them. trying figure out how can user ınput using buttons. know how ms calculator works, eh? (or other calculator basically, or keyboard itself). shifts input give , writes down. ı asking this: user presses "1" "5" "3". want variable in program stored "153". sorry bad explaination, have no idea how can express problem properly. i dont have code built yet. contains tk window, buttons, , functions. thanks :) ! edit: current code has: imports tkinter, creates: (master=tk()) creates 10 buttons labeled 0-9. , pretty it. buttons labeled b0, b1, b2 ... i have tried appending them in list, somehow combining elements of list 1 integer. couldnt figure out. well, easier if post gui code you've created, in general, 1 way store string representing current number being entered. if user presses numerical button, new digit appended end

regex - PHP: How to extract JSON strings out of a string dump -

i have huge string dump contains mix of regular text , json. want seperate/remove json objects string dump , text only. here example: this text {'json':'object'} here's more text {'json':'object'} yet more text {'json':'object'} again, text. my goal text dump looks (basically json removed): this text here's more text yet more text again, text. i need in php. text dump random, , json data structure (most of nested). dump may or may not start json, , may or may not contain more 1 json object within string dump. i have tried using json_decode on string result ends null edit: amal's answer close want (see 2nd comment below): $str = preg_replace('#\{.*?\}#s', '', $str); however, doesn't rid of nested objects @ all; e.g. data contained in brackets: [] or [{}] sorry, i'm not expert in regex. i realized of may need more concrete example of string dump i'm dealing with; therefo

html - How to create custom archive page on Tumblr -

i creating custom tumblr blog layout: http://thespektrdev.tumblr.com/ i need create separated page posts (such archive). have not found way change standard tumblr archive page. what have tried: create new page (but how render posts on these page when use theme html). have not found "custom template option" just use css/js switcher. in option should load posts (it's slow) or maybe situation impossible? it's impossible change /archive page of tumblr blog tumblr not provide capability.

html - Put text under DIV images -

i'm trying put text under images center alignment of text in each image doesn't seem work. there anyway can make mobile compatible? here's jsfiddle: http://jsfiddle.net/r3u6b/ here's css of .p: .imgcontainer p { display:inline-block; position:relative; padding:1px; border: 0px solid #c4c4c4; margin:0px 37px 0px 0px; width:175px; height:175px; } i think need add text-align:center css. example: http://jsfiddle.net/r3u6b/1/ so adjusted code looks this: .imgcontainer p { display:inline-block; position:relative; padding:1px; border: 0px solid #c4c4c4; margin:0px 37px 0px 0px; width:175px; height:175px; text-align:center; }

java: static and nonstatc function calling approach -

i have class: public class c1{ public int v=10; public int myfunction1(){ // code } } to call myfunction1() use: c1 ob = new c1(); ob.myfunction1(); ob.v; same thing `static': public class c1{ public static int v=10; public static int myfunction1(){ // code } } to call myfunction1() use: c1.myfunction1(); c1.v; so question difference between these 2 approach. when use static approach? technical advantage , disadvantage of both? the difference best illustrated if change example somewhat: public class c1{ private final int v; public c1(final int v) { this.v = v; } public int getv(){ return v; } } in case when create c1 give internal state - i.e. v . can do final c1 firstc1 = new c1(10); final c1 secondc1 = new c1(20); you cannot static methods bound class instance , not object instance - hence change in state seen all method calls. generally, in oo design, static best avoid

java - What happens when you create a new object? -

Image
ok, happens when this. a a1=new a(); a2=new a(); a3=new a(); i upload 2 pictures on how imagine being like. can tell me picture true? first picture: second picture: i thought first picture true, don't know, , suspect second true. also, can explain me each side does? like, "a a1" , "new a()" do? thanks. new a() call no param constructor of class , create new memory object. a a1=new a(); // new memory object created a2=new a(); // new memory object created a3=new a(); // new memory object created there 3 different objects getting created, second picture true. for first picture true, declaration of references should this: a a1=new a(); // new memory object created a2=a1; // a2 points same memory object a1 a3=a1; // a3 points same memory object a1 here 1 object(new used once) created 3 references point it.

c# - Synchronize click on group of buttons -

i developing first windows embedded compact 7 application. c# , .net 3.5 have group of buttons. when 1 of buttons clicked, effect wanted is, of buttons seem clicked @ same time. solutions found till now, sendkeys.send("{enter}"); or better button1.performclick seem not avalable on wec7. or oversee something, make them available?

android - Putting ImageView on the bottom of the screen -

Image
i trying put imageview on bottom of layout following xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" tools:context=".mainactivity" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#eeeeee" android:gravity="center" android:orientation="horizontal" > <imageview android:layout_width="wrap_content" android:layout_height="wrap_cont

Bootstrap tags input not working with jquery -

i using bootstrap tags input make tags inside text input,in documentation: just add data-role="tagsinput" input field automatically change tags input field. but when using jquery before function : $('#addrun').click(function () { $('#addrun').before('<input type="text" value="amsterdam,washington,sydney,beijing" data-role="tagsinput" />'); }); it displayed text input text inside , no tags. any ?? bootstrap run @ page load self-executing function. adding new element dom - time, bootstrap-tagsinput.js wouldn't know it. you'll have initialise after adding dom document via javascript. to refresh input tags ( bootstrap tagsinput docs ): $('input').tagsinput('refresh'); so you, you'd need to: /** * on <div id="addrun"> on click, * pre-apend new input * * refresh bootstrap. **/ $('#addrun').click(function

Installing new Perl Modules using strawberry Perl access denied issue -

i'm trying install package in perl on windows machine using strawberry perl. whenever try cpan install module-name access denied error saying cannot create directory in c:\strawberry\perl . when try manually create directory in location (or subfolders of location) access denied issue. when try create folder in directory using mouse doing right click->new folder first asked permission pop-up window saying "do want allow following program make changes computer" i'm guessing has fact work computer , administrator privileges. i've read articles installing perl without root access but, i'm not sure that's issue is. so question how can install perl packages situation?

ruby - print "Enter a character " a = gets if (a == 'b') puts "b was pressed" end -

i new learner ruby. tried print "enter character " = gets if (a == "b") puts "b pressed" end and well print "enter character " = gets.to_s if (a == 'b') puts "b pressed" end you missed method string#chomp . change code below : print "enter character " = gets.chomp if (a == "b") puts "b pressed" end now run code: kirti@kirti-aspire-5733z:~/ruby$ ruby so.rb enter character b b pressed kirti@kirti-aspire-5733z:~/ruby$ note: code not working,as a = gets assigning "b\n" variable a ,which of course not equal "b" .but using #chomp remove \n string,you input command prompt , produce expected output.

node.js - how can I enable jade on my application? -

i trying follow post my server.js this var express = require('express'); var app = express(); var jade = require('jade'); and error module.js:340 throw err; ^ error: cannot find module 'jade' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ module.require (module.js:364:17) @ require (module.js:380:17) @ object.<anonymous> (/var/www/server.js:3:12) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ module.runmain (module.js:497:10) but when this try { jade = require('jade'); } catch (err) { var jade = require('/usr/local/lib/node_modules/jade/bin/jade'); } i can start engine, when enter site see error: cannot find module 'jade' @ function.module._resolvefilename (module.js:338:15) @ functi

asp.net - Can iOS run websites written in C# only? -

i've read view websites written in asp.net , c#, current device needs support silverlight. ios devices support silverlight? , if no can ios device view websites functionality written in c#? i hope can me. thanks in advance :) the device not need support silverlight. asp .net renders html, can viewed device. silverlight separate kind of technology, has nothing html. if make silverlight project, device needs support it. ios not support silverlight, in same way not support flash , other popular runtimes.

Visual Studio 2012 multiple project template with inter-dependencies -

i'm in process of creating mvc starterkit work , i'm having problems creating multi-project template doesn't require massive manual modification after creation. what have 4 projects have dependencies on each other: starterkit.common - no dependency starterkit.dal - dependency starterkit.common starterkit.bl - dependency starterkit.common , starterkit.dal starterkit.web - dependency other three i've tried going route of exporting each project using export template wizard, creating root .vstemplate file , zipping up. although works (i can create new solution based on template), has serious problems. firstly, export replaces entire namespace of each project $safeprojectname$, i.e. starterkit.dal => $safeprojectname$, starterkit.web => $safeprojectname$ etc. this means when new project created (let's call xxx), in namespace starterkit.web ends in xxx namespace , starterkit.bl also ends in xxx namespace! this not going work. secondly, using s

c# - "@" inside a string? -

now, know @ operator - allows use reserved word variable name or make non-escaping string, i've received codebase contain (names changed , parts of string i'm under nda): somestring = @"this thing @nametag there"; obviously seems kind of placeholder, does? likely placeholder replaced @ runtime for example: dear @customername, join first ever event in @city @ @time on @date ...

jquery - trouble updating nav with ajax content -

i've been able use ajax , php update page, exception of nav content. refuses play along remainder of page. the nav section in html looks this: <nav id="nav"> <div id="nav"></div> <ul> <li> <a href="">dropdown</a> <ul> </ul> </nav> my ajax looks this: <script type="text/javascript"> var frm = $('#picker'); frm.submit(function () { $.ajax({ type: frm.attr('method'), url: "http://xxxx.com/test.php", data: frm.serialize(), success: function (data) { $("#nav").html ( data ); } }); return false; }); </script> currently php should echo "this code works". it's functional if point other div, refuses work if send nav. any appreciated. detail driving me batty. if can make work without editing css, appreciated.

java - JPA modelling, one-to-one relation? -

i new jpa , stuggles defining relations between classes. have class called player , class called game. game holds references 2 player instances. question is, how should modelled? this current code: @entity @table(name = "t_player") @jsonserialize(include=jsonserialize.inclusion.non_null) public class player { @id @generatedvalue(strategy = generationtype.identity) private long id; @basic @column(name = "name") private string name; @basic @column(name = "uuid") private final string uuid = uuid.randomuuid().tostring(); i think ok, problem in game class: @entity @table(name = "t_game") @jsonserialize(include=jsonserialize.inclusion.non_null) public class game { public game() { } @id @generatedvalue(strategy = generationtype.identity) private long id; @basic @column(name = "uuid") private final string uuid = uuid.randomuuid().tostring(); @onetoone

python - Draw graph in NetworkX -

i'm trying draw graph in networkx, nothing, not errors: import networkx nx import matplotlib.pyplot plt g1=nx.petersen_graph() nx.draw(g1) add end: plt.show() import networkx nx import matplotlib.pyplot plt g1 = nx.petersen_graph() nx.draw(g1) plt.show() when run interactive shell plt.ion() has been called, plt.show() not needed. why omitted in lot of examples. if run these commands script (where plt.ion() has not been called), plt.show() needed. plt.ion() okay interactive sessions, n ot recommended scripts .

java - Labeled loop,continue keyord does not work -

import java.util.scanner; class details { int num; string names[][]; double marks[][]; double total[]; string grades[]; void getdata() { scanner ob = new scanner(system. in ); system.out.print("enter number of students : "); num = ob.nextint(); names = new string[num][2]; marks = new double[num][4]; (int x = 0; x system.out.print("first name : "); names[x][0] = ob.next(); system.out.print("last name : "); names[x][1] = ob.next(); loop1: (int p = 1; p <= 1; p++) { system.out.print("\tfirst test marks : "); marks[x][0] = ob.nextdouble(); if ((marks[x][0] < 0) || (marks[x][0] > 15)) { system.out.println("marks should within 0 15"); continue loop1; }

haskell - Ignoring letters and parsing only numbers using Parsec -

this code works when numerals (eg: "1243\t343\n" ) present: tabfile = endby line eol line = sepby cell (many1 tab) cell = integer eol = char '\n' integer = rd <$> many digit rd = read :: string -> int is there way make parse "abcd\tefg\n1243\t343\n" such ignores "abcd\tefg\n" part ? you can skip except digits using skipmany . next: many (skipmany (noneof ['0'..'9']) >> digit) or (depending on need) skipmany (noneof ['0'..'9']) >> many digit

Automatic Document classification with Python: Gaming articles being sorted into Sports -

i have corpus of 500 pre-categorized articles. i've taken commonly-used nouns , adjectives each category , sorted them relevance. each category (world, business, tech, entertainment, science, health, sports), has few hundred words associated it. i having trouble article: http://www.techhive.com/article/2052311/hands-on-with-the-2ds-an-entry-level-investment.html it gaming. words "game, player, etc" closely associated sports, based on articles i've looked at. this article scores following: {u'business': 51, u'entertainment': 58, u'science': 48, u'sports': 62, u'health': 35, u'world': 48, u'technology': 59} as can see, technology there @ 59, overtaken sports @ 62. i hoping if increase corpus few thousand articles, problem solved, don't know if likely. what ideas on solving issue? i thought having list of giveaway words, "twitter, facebook, technology, nintendo, etc", automaticall

login - Basic authentication system for my web server -

i'd need basic authentication system web server. either create 1 or use external authentication service. know there many guides on how create one, can use neither php* nor flash. also, external authentication services not free , offer many features don't care about. can me please? *php not seem work on web sever, , can't find solution (see this question ).

c++ - What is the difference between "int *a = new int" and "int *a = new int()"? -

this question has answer here: do parentheses after type name make difference new? 5 answers what difference between following 2 lines ? int *a = new int; int *a = new int(); int *a = new int; a pointing default-initialized object (which uninitialized object in this case i.e value indeterminate per standard). int *a = new int(); a pointing value-initialized object (which zero-initialized object in this case i.e value zero per standard).

Java Sudoku - Not Changing Fields In 2D Array -

i've been running issue. i'm relatively new @ java , trying bite off bit more complex i'm used to. combination of own personal file input , main method cannibalized source other methods. i'm still rusty recursion. reason, assignment command change values in 2d array "board" running through without errors, not changing value. looks kosher me in structure @ least, said, i'm new. also, i'm looking text output on terminal finished program, , throwing exception seems eyesore on terminal. suggestions? import java.util.scanner; import java.io.file; public class sudoku2{ static int board[][] = new int[10][10] ; static int backtrack = 0; public static void main(string[] args) throws exception { sudoku2 mypuzzle = new sudoku2(); // mypuzzle.readboard(); mypuzzle.readdata("./board/input.txt"); mypuzzle.solve(0, 0); printboard(); } protected static void printboard(){ syst

java - API Creation Inquiry -

i working on project needs api. in apis (for example minecraft modloader), api runs "mod" class, without knowing name. how possible? project, need instances of class called spell, without ever calling them directly. tips , answers appreciated. thanks! i pretty sure forge modloader , risu's modloader inside zips , find classes needs considered mod class, example in forge, @mod annotation. attempt load mod. how many mods buildcraft have different parts of mod in same zip.

python - Export django model as pdf from admin model -

i export model pdf file directly model admin using reportlab. class invoiceitem(models.model): invoice_number = models.charfield(max_length=50) invoice_date = models.datefield('invoice date') invoice_sent = models.booleanfield() invoice_paid = models.booleanfield() and model admin: class invoiceitemadmin(admin.modeladmin): def pdf_version(self, obj): ## how call reportlab view here ?? please help, m. use actions! i'm taking created reportlab view , want redirect model items. create function (outside of class): def pdf_version(modeladmin, request, queryset): url = '/your_pdf_url/?pks=' + ','.join([q.pk q in queryset]) httpresponseredirect(url) then in admin: class invoiceitemadmin(admin.modeladmin): actions = [pdf_version] in example using data allow more 1 report @ time, because seems reasonable, can change you'd like. it's easy that. check out documentation futher details

typography - MathML Typographical Error on Firefox 17 on GNU/Linux -

apparently, cannot post images because deemed not 1337 enough unless 10 points of reputation, let me best describe problem. here markup trying render. pay no attention content, because took arbitrary paper arxiv reference. <!doctype html> <html> <head> <meta charset=utf-8 /> <title>example paper</title> <style> * { margin: 0; padding: 0; } body { width: 616px; /*background: url(background.png) center top repeat-y #fff;*/ margin: 0 auto; } h2, h3, h4, h5, h6, p { line-height: 22px; margin-top: 11px; margin-bottom: 22px; } h1 { line-height:44px; margin-top: 11px; margin-bottom: 11px; } </style> </head> <body> <h1> defect sequence contractive tuples </h1> <p> tirthankar bhattacharyya, bata krishna das, santanu sarkar </p> <p&

ios - TableView ScrollToIndex When TextArea Is Focused -

i have tableview , and 1 of rows contains button. when user presses button, append row table contains text area. want new row @ top of tableview , keyboard open. here have tried: function addnewcomment() { var newcomment = new newcomment(tableview.data[0].rows.length); //i add spacer if added row last in table, can still @ top of view var spacer = ti.ui.createtableviewrow({ height:250, backgroundcolor: 'white' }); //there 6 rows of information in table before comments start tableview.appendrow(spacer, {animated:false}); tableview.insertrowafter(5, newcomment, {animationstyle:titanium.ui.iphone.rowanimationstyle.down}); //the listener focuses text area ti.app.fireevent('newcommentaddedtoview'); tableview.scrolltoindex(6,{animated:true,position:ti.ui.iphone.tableviewscrollposition.top}); } when runs, if last line of method isn't called. new row scrolls view not way top. scrolls view enough see typing i

How to pass PHP Object to Python and Vice Versa -

i attempting develop functionality involves 3 programs. program (python): places request program b. program b (php): processes request program , gives program c. program c (python): processes data program b , returns object program b. in end, execution flow want follows: a (data) -> b (data) -> c (data) -> c (object) -> b (object) -> (object) so how can "transfer/pass" python/php object between 2 languages? does involve sort of object serialization? update: more specific, data want transfer class object created in python. i.e.: class foo: def __init__(self): data = 42 name = 'bar' if want exchange objects between python php, let's example sending python dictionary php , reads array, can consider using rpc serialization framework such as: apache thrift protocol buffers apache avro

android - Simple jsoup Java HTML Parser Will Not Update TextView -

i'm attempting update textview using web data via jsoup http://jsoup.org/ for reason never seems update textview table data url i'm attempting gather data from. any suggestions? i've looked on quite bit , cannot seem spot i'm doing wrong - i'm sure it's simple. xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:layout_width="wrap_content" android:layout_height="wrap_co

java - Generify class because of unchecked casting warning -

i have following class methods marked unchecked give me warning. compile/work fine interested if there way generify class intellij idea offering me (but unable do) remove warnings. public abstract class attribute { private final attributednode containernode; private boolean computationcomplete; public attribute(attributednode node) { this.containernode = node; this.computationcomplete = false; } public attributednode getcontainernode() { return containernode; } public attribute getattributefromchildnode(int childindex, attributenameenum attributename) { attributednode node = getcontainernode().getchild(childindex); return node.getattribute(attributename); } public string getchildnodetext(int index) { return getcontainernode().getchild(index).gettext(); } @suppresswarnings("unchecked") public <t, e extends attribute> list<t> getlistofchildattributevalues(attributenameenum name) { list<t> result = new linkedlist<>(

Python coding - list index out of range -

lots of code here ... if c==excelfiles[1]: b ==excelfiles[1] wb = xlrd.open_workbook(a) wb.sheet_names() sh = wb.sheet_by_index(0) rownum in range(sh.nrows): print sh.row_values(rownum) in range(sheet.nrows): cashflow = [sheet.cell_value(i,0)],[sheet.cell_value(i,1)],[sheet.cell_value(i,2)] print cashflow def npv(rate, cashflow): value = cashflow[1] * ((1 + rate/100) ** (12 - cashflow[0])) fv = 0 fv += value return fv def irr(cashflow, iterations = 100): rate = 1.0 = 0 while (cashflow[0][1] == 0): += 1 investment = cashflow[i][1] in range(1, iterations+1): rate *= (1 - (npv(rate, cashflow) / investment)) return rate r = irr(cashflow) print r error/output: file "<pyshell#90>", line 1, in <module> import quarterz file "quarterz.py", line 65, in <module> r = irr(cashflow) # why list index out of range? file "quarterz.

javascript - code printing in firefox but not printing in IE -

i have code below. working fine , printing document in firefox not printing or prompt print document in ie... please help... thanks <script type="text/javascript"> function printelemm(elem) { popup($(elem).html()); } function popup(data) { var mywindow = window.open('', 'my div', 'height=400,width=600'); mywindow.document.write('<html><head><title>print of - completed iso-request form</title>'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.print(); mywindow.close(); return true; } </script> yuppeeeeeeeeeeeees....... here working solution.... ie & firefox both :-d <script type="text/javascript"> function completed() { var mywindow=window.open('','

How to make a variable out of the output of a unix command? -

i'm trying have variable $totallines stores total lines in file (given input $1). i'm trying this: totallines= grep -c *.* $1 but unix doesn't that. i've tried enclosing in paranthesis, square brackets, , (), doesn't work either. has got super simple i'm searching answer around web , not finding page or forum states it. sorry trouble guys such easy one. there 2 ways achieve it: totallines=$(grep -c *.* $1) or totallines=`grep -c *.* $1`

winapi - Pressing keys with python win32api -

i trying achieve following behavior in python 2.4 script, here steps, , after them, question: python script starts the script gives 3 seconds delay change 'z' program's window the script clicks on 'z' program's window. the script stops making clicks /* ¿? */ ask continue program's excecution /* ¿? */ go step 2 so, in steps 5 , 7 want simulate pressing of keys alt+tab in order go script window (in step 5), , go again 'z' program's window (in step 7). , problem have no idea how achieve (the simulation press keys alt+tab), , didn't find answers doubts. using python win32api modules positionate mouse in point , make clicks, don't find way simulate key pressing. you need winapi function sendinput. see description in msdn: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx

python - Kivy - base application has strange alignment -

Image
i trying build basic kivy app. after adding basic elements, , running app, of elements crammed bottom left corner. shows on android , linux. main.py: from kivy.app import app kivy.uix.widget import widget class sublimelauncher(widget): pass class sublimelauncherapp(app): def build(self): return sublimelauncher() if __name__ == "__main__": sublimelauncherapp().run() sublimelauncher.kv: #:kivy 1.2.0 <sublimelauncher>: floatlayout: boxlayout: orientation: 'vertical' spacing: 10 label: text: "enter path folder open.\npress ok if open without directory" textinput: id: folderpath button: text: 'ok' i first tried boxlayout, read somewhere root widget big app. how declare size of app? or layout? how go doing dialog box? maybe missing basic, can't seem figure out. edit: here seeing..

backbone.js - Localizing templates with backbone, underscore on mobile -

i want localize templates in phonegap/backbone mobile app. want somehow override underscore render function in way append attribute languages. let me show on example: lets required (require.js) homeview template wich looks like: <div> <p><%= language.get('sometext') %></p> </div> in homeview.js have: var template = _.template(hometemplate); this.$el.html( template({language: languagemodel})); this works, don't want append language attribute underscore template. somehow overwrite render function include language model? you can put javascript expression inside <%= ... %> . in particular, can access globals. so, if have global application namespace: // i'll call `app` lack of better placeholder. window.app = { ... }; then can put language in there: app.language = your_language_model; and access in template without supplying _.template call or compiled template function: var t = _.template('<%

c - Pointers for a beginner (with code) -

i doing first ever homework assignment in c , i'm trying grasp pointers. make sense in theory, in execution i'm little fuzzy. have code, supposed take integer x, find least significant byte, , replace y byte in same location. gcc returns with: "2.59.c:34:2: warning: passing argument 1 of ‘replace_with_lowest_byte_in_x’ makes pointer integer without cast [enabled default] 2.59.c:15:6: note: expected ‘byte_pointer’ argument of type ‘int’" and same argument 2. kind explain me going on here? #include <stdio.h> typedef unsigned char *byte_pointer; void show_bytes(byte_pointer start, int length) { int i; (i=0; < length; i++) { printf(" %.2x", start[i]); } printf("\n"); } void replace_with_lowest_byte_in_x(byte_pointer x, byte_pointer y) { int length = sizeof(int); show_bytes(x, length); show_bytes(y, length); int i; int lowest; lowest = x[0]; (i=0; < length; i++) { i

r - xyplot panel function overriding group colours -

i have following chunk of script creating scatter plot lm line , lm line through origin: xyplot(nbsp~fric, groups = ecoregion,data=dataplot, xlab="functional richness", ylab="species richness", panel=function(x, y, groups) { panel.xyplot(x, y) panel.abline(lm(y~x), col='blue') panel.abline(lm(y~x+0), col='red') }, type='l', auto.key = list(title='ecoregion', space='right') ) which gets me correct plot, points same colour , don't match groups represented in legend. (sorry don't have enough reputation points post pictures) however, need colours of points match legend, , whatever cannot them to. any , appreciated. i've rewritten chunk more times can count, , i'm sure it's silly error. thanks, katherine i think want. careful function arguments . xyplot(nbsp~fric, groups = ecoregion, data=dataplot, xlab="functional richnes

Subversive Eclipse SVN folder remains in conflict -

i'm trying commit using subversive svn in eclipse. but, keeps giving me following error: some of selected resources not committed. svn: commit failed (details follow): svn: aborting commit: 'c:\users\_\documents\project\src\rule' remains in conflict when files under "rule folder" (using package explorer), there nothing in conflict.. screenshot of package explorer: http://sdrv.ms/ggti1s from other people's posts, tried "update" , "synchronize repository". no success though. doesn't let me commit!! i'm guessing it's because need way tell conflict solved, have no idea how. help?? i had same problem , none of solutions mentioned resolved issue. when right-click on folder, there no option resolve conflict or mark resolved or anything. the way resolved in eclipse (with subclipse plugin), right-clicking on folder , selecting "show tree conflicts". opened view pane in eclipse called "svn tree confli

i have a working multiple upload (document and image) CODEIGNITER -

i have made working multiple upload in codeigniter i'm having problem on how gonna insert file names of files on 2 tables (documents , images table) these 2 tables have 2 same column name (id, name). there way disjunct or compart code uploading image , doc. because united them in 1 function. here code. working. view <?php echo form_open_multipart('test'); ?> <label>images</label> <input type='file' multiple='multiple' name='userfile[]'> <label>documents</label> <input type='file' multiple='multiple' name='userfile[]'> <?php echo form_submit('submit', 'upload them files!') ?> controller function index() { if (isset($_post['submit'])) { $this->load->library('upload'); //$this->uploadfile($_files['userfile']); $files = $_files; $cpt = count($_files['userfile&#

Accessing a member function from a vector of pointers? C++ -

so, lets have vector, vector<item*> vitem , item class member function item::setvalue(); . lets populated vector using vitem.push_back(new item) . now, access member function, through pointer in vector, vitem[0]->setvalue("key"); . valid? assumed was, when cout member variables using getvalue() function, nothing new returned, default values constructor. any ideas? feel it's stupid mistake in logic, i'm not sure. appreciated. edits: setvalue code: void item::setvalue(string svalue) { m_svalue = svalue; } with private variable: string m_svalue; getvalue code: string item::getvalue() { return m_svalue; } simple version of code: void func2(vector<item*>& vitem) { vitem.push_back(new item); vitem[0]->setvalue("key"); } int main(int argc, char * argv[]) { vector<item*> vitem; func2(vitem); cout << vitem[0]->getvalue() << endl; return 0; } i should n

c# - Getting error 0004: Could not load System.Data.SqlServerCe.Entity.dll. Reinstall SQL Server Compact -

i working on asp.net web pages site sql server ce 4.0. i believe sql server ce 4.0 database working fine. can connect without problems on dev machine , without entity framework. once push site server, can connect fine without entity framework using connection string: <add name="startersite" connectionstring="data source=|datadirectory|\startersite.sdf" providername="system.data.sqlserverce.4.0" /> my entity framework connection string looks this: <add name="startersiteentities" connectionstring="metadata=res://*/app_code.productmodel.csdl|res://*/app_code.productmodel.ssdl|res://*/app_code.productmodel.msl;provider=system.data.sqlserverce.4.0;provider connection string=&quot;data source=|datadirectory|\startersite.sdf&quot;" providername="system.data.entityclient" /> when try make ef database calls error message: server error in '/' application. sch

java - loan calculator that implements multiple methods -

i have been working on program java loan payment calculator comp sci class. programs requriements are: ask user loan amount, annual interest rate, , number of months call method calculate , return monthly interest rate call method calculate , return monthly payments call method print loan statement showing amount borrowed, annual interest rate, number of months , monthly payment. this first time working multiple methods. have developed code far shown below. netbeans editor not giving me errors, however, not print statements last method. questions are: are methods set correctly , passing parameters correctly why won't statements print @ end am capturing other methods correctly? need enter variables in main method , call them in final method. is of code redundant? i not sure how proceed here. public class carloan { /** * @param args command line arguments */ public static void main(string[] args) { // declare variables main method double loanam

how to install egit in zend studio 9.0.2 offline -

install environment: windows 7 64 bit/xp 32bit zend stutdio 9.0.2 org.eclipse.egit.repository-3.1.0.201310021548-r i want use git in zend studio 9.0.2 .but pc can not connect internet.so download egit 3.1.0 package.i try install package in "install new software",but failed error: cannot complete install because 1 or more required items not found. software being installed: eclipse git team provider 3.1.0.201310021548-r (org.eclipse.egit.feature.group 3.1.0.201310021548-r) missing requirement: git team provider ui 3.1.0.201310021548-r (org.eclipse.egit.ui 3.1.0.201310021548-r) requires 'bundle org.eclipse.team.core [3.6.100,4.0.0)' not found cannot satisfy dependency: from: eclipse git team provider 3.1.0.201310021548-r (org.eclipse.egit.feature.group 3.1.0.201310021548-r) to: org.eclipse.egit.ui [3.1.0.201310021548-r] can me? this answer might applicable you: can install egit: missing requirement: git team provider core in other words, internal v

java - Convert FastSet to Array of String -

i have set: set<string> tmpset = fastset.newinstance(); when follow question: how convert set string[]? and same: string[] strarrstrings = includefeatureids.toarray(new string[0]); and have exception: exception: java.lang.illegalargumentexception message: error running script @ location [component://order/webapp/ordermgr/web-inf/actions/entry/catalog/keywordsearch.groovy]: java.lang.unsupportedoperationexception: destination array small ---- cause --------------------------------------------------------------------- exception: java.lang.unsupportedoperationexception message: destination array small ---- stack trace --------------------------------------------------------------- java.lang.unsupportedoperationexception: destination array small javolution.util.fastcollection.toarray(fastcollection.java:351) so now, have code as: for (fastset.record r = tmpset.head(), end = tmpset.tail(); (r = r.getnext()) != end;) { // copy 1 one element string[] }

Create JSON string with php issue -

i want create json structure: {"id":"ws", "data":[ {"name":"it.geosolutions"}, {"name":"cite"}, {"name":"testwor"}, {"name":"tiger"}, {"name":"sde"}, {"name":"topp"}, {"name":"newwork"}, {"name":"sf"}, {"name":"nurc"} ] } i do: function funcarray(){ foreach ($ws $item){ $wsarray[] = '{"name":"'.$item->name.'"}'; } return $wsarray; } $json_data = array ('id'=>'ws','data'=>funcarray()); $json = json_encode($json_data); and get: {"id":"ws", "data":[ "{\"name\":\"it.geosolutions\"}", "{\"name\":\"cite\"}", "{\"name\":\"testwor\"}", &qu