Posts

Showing posts from July, 2015

Error with the batch login -

i write program whitch reading login , password fille if both corect program should go next point. :rejestracja cls set/p "uname=wpisz login : " set/p "upass=wpisz haslo : " cls goto rejestracja2 :haslo set/p "haslo=wpisz haslo : " if %haslo%==<<d:\upass.txt goto nowy if exist %haslo%==<<d:\upass.txt goto start :rejestracja2 echo %uname%>>d:\uname.txt echo %upass%>>d:\upass.txt attrib d:\uname.txt +h attrib d:\upass.txt +h cls goto login :login cls set /p login="wpisz login :" **if {%login%}=={<=d:\uname.txt} goto haslo** pause > nul i need fix line when putted "**" you can't read file "on fly". read them variable first: :login set /p login="wpisz login :" set /p uname=<d:\uname.txt if "%login%"=="%uname%" goto ... same :haslo in :rejestracja2 should use > instead of >> (overwrite instead of append)

node.js - Configure STUN and TURN on My Windows localhost and Linux Server -

i creating live video streaming application using webrtc , need create own ice servers. have googled 2 days find out proper steps configuring ice server on windows localhost test out application , not able find it. please reference or link or video can find steps follow or package install ice server. if wrong anywhere please let me know. in advance.

ios - How to call a function from a different function? -

i'm trying make simple app counts characters of textfield, when user inputs text, function converts user-inputed string var , function counts characters executed @ once. here's code: import uikit class viewcontroller: uiviewcontroller { @iboutlet var mytextfield : uitextfield @iboutlet var usertextfield : uitextfield override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. mytextfield.text = fullconstant } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func modifymyvariable(sender : anyobject) { myvariable = usertextfield.text } @ibaction func clickme(sender : anyobject) { countcharacters(&fullconstant) println(fullconstant) mytextfield.text = fullconstant } } and here's "otherfile.swift" functions located: impor

sql - Error Insert Into a table variable Hana -

i'm working passing ms sql server statements hana sql statements. have variable (tab) type table , variable string (query) defined as: hana statement create type "tab_table_type" table ("docentry" integer, "lineid" integer, "visorder" integer, "object" nvarchar(20)); v_tab tab_table_type query := 'select [docentry],[lineid],[visorder] ,[object] [@inv_afc]'; so i'm trying convert ms sql statement hana statement : ms sql server statement insert @v_tab([docentry],[lineid],[visorder],[object]) exec (@query) i wish use internal table type variable can hold resultset query! when use sql converter sentence displays error: --[note:errormodifier] insert statement not support exec; use exec('insert table '+ originalstatement) --[note:stringifier] sap hana not support inserttarget finally question : how correct hana sql statement case? the syntax of table-type creation correct. guess

assembly - What is the environ.dll? -

in following assembly line mov edx, dword ptr ds: [_environ_dll] i search environ.dll did not find can useful. so question be: there knows dll , explain in sentences me? e.g. behaviour, purpose etc. or if possible links maybe, because did not find any... edit: link found far is http://msdn.microsoft.com/en-us/library/system.environment%28v=vs.110%29.aspx

bash - tmux - attach to a session and specify window -

i have script (.sh) , want run in existing tmux session. have 1 session 8 windows in. is there command tmux -t session-name , specify window? and script work? #!/bin/bash tmux -t session-name #what ever write specify window# java -jar -xmx4g -xms4g spigot.jar you can change active window of session before attach session. tmux -t <session-name> select-window -t <windowid> tmux -t <session-name> you can combine 2 tmux commands well. tmux -t session-name select-window -t <windowid> \; if want run java, presumably want create new window new-window , rather select existing 1 select-window . newer versions of tmux (at least 1.9; did above ever work, perhaps in 1.6?) no longer appear have -t option specify session apply commands to. instead, each individual command specifies session. tmux select-window -t <session-name>:<windowid> \; -t <session-name>

java - Adding textfile data to Derby Database -

i have code reading data textfile , splitting hastags. data stored in array. using derby database on netbeans, question is, data separated, how insert data derby database. input data in text file: 569#chandini#singh#58#24#89 425#angel#dan#67#58#26 780#red#velvet#48#21#10 input data (after splitting hastags) needs inserted derby database: 569 chandini singh 58 24 89 425 angel dan 67 58 26 780 red velvet 48 21 10 this current insert code have written: studenttbl std = new studenttbl(); std.setstudentid(short.parseshort(id.gettext())); std.setname(name.gettext()); std.setsurname(surname.gettext()); std.setit(integer.parseint(it.gettext())); std.setphysics(integer.parseint(physics.gettext())); std.setmaths(integer.parseint(math.gettext())); studydbpuentitymanager.gettransaction().begin(); studydbpuentitymanager.persist(std); studydbpuentitymanager.gettransaction().commit(); studenttbllist.clear()

javascript - Why do width/height element attributes render differently from inline/CSS styles? -

recently i've been coding simple platformer in html5 , js. background image, has width of 600 pixels , height of 400 pixels, rendered differently depending on how define size of canvas. if use element attributes , define size so: <canvas width="600" height="400"> desired outcome; image sits within canvas. on other hand, if define canvas size giving canvas id , style within css file so: #canvas { width: 600px; height: 400px; } , or style inline, image appears stretched , doesn't fit within canvas, although values identical. why don't these declaration methods render similarly? there difference between canvas dimensions , canvas display size. the html attributes sets canvas dimensions, determines how objects measured draw on canvas. the css style sets canvas display size, determines how large canvas drawn in browser. if display size different dimensions, canvas stretched when drawn. if define dimensions, used display size,

string - Converting Character and CodePoint in Swift -

can convert directly between swift character , unicode numeric value? is: var i:int = ... // plain integer index. var mycodeunit:uint16 = mystring.utf16[i] // mychar = mycodeunit character, or equivalent. or... var j:string.index = ... // not integer! var mychar:character = mystring[j] // mycodeunit = mychar uint16 i can say: mycodeunit = string(mychar).utf16[0] but means creating new string each character. , doing thousands of times (parsing text) lot of new strings being discarded. the type character represents "unicode grapheme cluster", can multiple unicode codepoints. if want 1 unicode codepoint, should use type unicodescalar instead.

In haskell Conduit, how do I zip a Source that yields lists with one that doesn't -

i'm using sourcefile yields bytestring , source yields word8 . word8 source infinite. i need way convert word8 source [word8] source lists same length bytestring first source. i'm not sure context doing this, more straight-forward way convert bytestring source word8 source, , zip 2 word8 sources together. if needed original bytestrings, include marker indicate end-of-chunk. a more complicated approach use connect-and-resume , manually deal popping values out of sources.

How is an HTTP server supposed to find out if a client supports byte ranges? -

i writing http/1.1 server in python, , seems implementing byte ranges should pretty easy. question is, proper way server ask client if supports byte ranges? case i'm thinking of if client ever sends request large resource without saying want byte range, or can accept them.

java - JavaFX TableView - dynamic row and column -

i have code java application; need convert code javafx tableview please me import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; public class tablerowcolumn extends jframe { private final static string letters = "abcdefghijklmnopqrstuvwxyz"; jtable table; defaulttablemodel model; jpanel buttonpanel; jbutton button; public tablerowcolumn() { // create table object[][] data = { { "1", "a" }, { "2", "b" }, { "3", "c" } }; string[] columnnames = { "number", "letter" }; model = new defaulttablemodel(data, columnnames); table = new jtable(model); table.putclientproperty("terminateeditonfocuslost", boolean.true); // add table , button panel frame jscrollpane scrollpane = new jscrollpane(table); getcontentpane().add(scrollpane); but

ajax - How to change link text from jquery function on click event -

i stuck in simple situation. have link execute ajax call , on success need change clicked link text or color. foreach (var m in model.groupposts){ ... @html.actionlink("vote up", "vote", "grouppost", new { grouppostid = m.grouppostid }, new{@class="vote-up"}) @html.actionlink("vote down", "vote", "grouppost", new { grouppostid = m.grouppostid }, new { @class = "vote-down" }) } $('.vote-up').click(function (e) { e.preventdefault(); var url = $(this).attr('href'); $.ajax({ url: url, type: "get", success: function (html) { alert("voted up"); e.target.text("new link text"); } }); }); i can't change clicked link text. it should be: $(e.target).text("new link text&q

javascript - How does the browser know if a script is finished loading? -

how web browser know if script inside <script> tag has finished loading? the onload event fires when resource (such script, or stylesheet) loaded: var oscript = document.createelement("script"); oscript.type = "text\/javascript"; oscript.onload = function () { // when script loaded } document.getelementsbytagname("head")[0].appendchild(oscript); oscript.src = "path/to/script"; the onload event not work on inline scripts.

ios - How to make SKSpriteNode reappear on the opposite side of its SKScene? -

Image
i have been experimenting spritekit time now, , appreciate “best practice” input regarding movement of skspritenode within skscene’s bounds. using accelerometer, applying forces on skspritenode's physicsbody property in order move node around screen in marble-like fashion. currently, set physicsbody of scene using self.physicsbody = [skphysicsbody bodywithedgeloopfromrect:self.frame] marble bounces off of scene's edges. instead of bouncing off of scene's edges, hoping once marble moved beyond scene’s bounds (1) reappear same velocity on opposite side of scene (2). want bounds wrapping occur , in such way when portion of marble has moved outside of scene’s bounds (3), portion have become visible on opposite side of scene (4). is possible accomplish while using single skspritenode , preserving node’s physicsbody? thanks in advance! nope. need 4 sprite nodes if sprite can leave screen in direction avoid sprite merely "popping" in , out when sw

Delaunay triangulation implementation in matlab -

hello it`s first post here. want write matlab script delaunay triangulation. here script: clear all;clc %% delaunay x=[ 160.1671 366.9226 430.7894 540.1208 660.2771 508.7287 252.1787]; y=[ 223.9615 259.5000 120.5769 245.5000 283.1923 472.7308 469.5000]; % x=x'; y=y'; %orginal plot dd=delaunay(x,y); dt=trirep(dd,x,y); triplot(dt); z=[x.^2+y.^2] i=1:length(x); ptk=[i' x y] %% main loop l=0; i=1:length(x)-2 j=1+i:length(x) k=1+i:length(x) if (j ~= k) l=l+1; xn = (y(j)-y(i))*(z(k)-z(i)) - (y(k)-y(i))*(z(j)-z(i)); yn = (x(k)-x(i))*(z(j)-z(i)) - (x(j)-x(i))*(z(k)-z(i)); zn = (x(j)-x(i))*(y(k)-y(i)) - (x(k)-x(i))*(y(j)-y(i)); if (zn < 0) border=zn; m=1:length(x) border = (border) & ... ((x(m)-x(i))*xn +... (y(m)-y(i))*yn +...

amazon s3 - Why are S3 and Google Storage bucket names a global namespace? -

this has me puzzled. can understand why account id's global, why bucket names? wouldn't make more sense have like: https://accountid.storageservice.com/bucketname which namespace buckets under accountid. what missing, why did these elite architects choose handle bucket names way? “the bucket namespace global - domain names” — http://aws.amazon.com/articles/1109#02 that's more coincidental. the reason seems simple enough: buckets , objects can accessed through custom hostname that's same bucket name... , bucket can optionally host entire static web site -- s3 automatically mapping requests incoming host: header onto bucket of same name. in s3, these variant urls reference same object "foo.txt" in bucket "bucket.example.com". first 1 works static website hosting enabled , requires dns cname (or alias in route 53) or dns cname pointing regional rest endpoint; others require no configuration: http://bucket.examp

vba - How to edit current macro to search only column C for a value greater than one specified -

i'm not sure how go this, search through folder of excel files , create new sheet list , link files contain specified search term. question is, how edit @ specified column (e.g., column c). also, how make search numbers greater 1 specified (e.g., excel files have lab values in column c, , i'm trying find excel files have values greater ^) sub searchwkbooks() dim ws worksheet dim myfolder string dim str string dim single dim sht worksheet set ws = sheets.add application.filedialog(msofiledialogfolderpicker) .show myfolder = .selecteditems(1) & "\" end str = application.inputbox(prompt:="search string:", title:="search workbooks in folder", type:=2) if str = "" exit sub ws.range("a1") = "search string:" ws.range("b1") = str ws.range("a2") = "path:" ws.range("b2") = myfolder ws.range("a3") = "workbook" ws.range("b3") = "works

php - Yii Model attributes showing null/blank values -

i working on simple form in yii. able access model attributes values before. but can't, because it's showing blank/null. i don't know what's problem , how solve this. appreciated. thank you. here's form code. <div class="span4"> <?php $form=$this->beginwidget('cactiveform', array( 'id'=>'testform', 'enableclientvalidation'=>true, 'clientoptions'=>array( 'validateonsubmit'=>true, ), )); ?> <p class="note">fields <span class="required">*</span> required.</p> <div class="row"> <?php echo $form->labelex($model,'sample'); ?> <?php echo $form->textfield($model,'sample'); ?> <?php echo $form->error($model,'sample'); ?> </div> <div class="row buttons"> <?php echo chtml::submi

dependency injection - Web Api Start up Exceptions with IDependencyResolver implimentation -

i developing web api , decided use custom dependencyresolver. refer this [dependency injection web api controllers] article. working far in terms of dependency injection controllers. code snippet of configuration owin startup class private void registerioc(httpconfiguration config) { _unitycontainer = new unitycontainer(); _unitycontainer.registertype<iaccountservice, accountservice>(); ......... ......... config.dependencyresolver = new unityresolver(_unitycontainer); } but @ time when api starts first time resolutionfailedexception thrown (but catched) inside unityresolver's getservice method. here exception message "exception occurred while: while resolving. exception is: invalidoperationexception - current type, system.web.http.hosting.ihostbufferpolicyselector, **is interface , cannot constructed. missing type mapping?**" above same exception thrown following types system.web.http.hosting.ihostbufferpolicyselector syst

windows - FastReport for FMX corrupts styles/texts on other forms -

i'm using fastreport component in delphi xe5 firemonkey (basically embarcadero edition). when i'm using report component on 1 of form, effecting styles/texts (font size mainly) on other forms on windows 7 machine. when remove component , fmx.frxclass uses section, works well. does have idea reason that? for units in interface uses list, initialization sections of units used client executed in order in units appear in client's uses clause. check order in have units in uses section , try moving fr beginning or end. fr initialize global variables in way fmx not expects.

Convert raw Android image to png -

on rooted android device, want take screenshot , convert raw format image png image save locally. far, managed access framebuffer, take screenshot , save raw image. problem when convert png format, image wrong.. bunch of white , grey lines. here's did: public void putrawimageinarray (byte [] array, file f ) throws ioexception{ @suppresswarnings("resource") bufferedinputstream bufferedinputstream = new bufferedinputstream(new fileinputstream(f)); //the framebuffer raw image in file bufferedinputstream.read(array, 0, array.length);//read file } public void converttobitmap (byte [] rawarray) throws ioexception{ byte [] bits = new byte[rawarray.length*4]; int i; for(i=0;i<rawarray.length;i++) { bits[i*4] = bits[i*4+1] = bits[i*4+2] = (byte) ~rawarray[i]; bits[i*4+3] = -1;//0xff, that's alpha. } bitma

box api - Box.com Search API to retrieve all files in a determined folder -

i'm searching way obtain files of specific folder. but can't find sufficient informations in official documentation i think this: (i assume set custom header access_token) https://api.box.com/2.0/search?query=* this way doesn't work, , think query doen't accept regex... any idea? ps: real usecase understand question: my folder: folderone: | |_file1.jpg | |_file2.doc | |_folder1 | |_file3.jpg | |_folder2 | |_file4.pdf with search request expect file1.jpg , file2.doc , file4.pdf . you can accomplish querying folder's contents , filtering client-side file items. curl https://api.box.com/2.0/folders/folder_id/items \ -h "authorization: bearer access_token" this return collection of items, can select type file . { "total_count": 4, "entries": [ { "type": "folder", "id": "192429928", "name": "folder1"

java - RotateAnimation rotates two times instead of just once -

i trying implement feature user can rotate picture. thought of using rotateanimation so: rotateright.setonclicklistener(new onclicklistener(){ @override public void onclick(view v) { //create new bitmap rotated 90 deg matrix mat = new matrix(); mat.postrotate(90);//90 degree rotation right bitmap bmaprotate = bitmap.createbitmap(bmp, 0, 0, bmp.getwidth(), bmp.getheight(), mat, true);//create new bitmap rotated angle bmp = bmaprotate; //save rotated bitmap bitmap uploaded rotateanimation rotateanim = new rotateanimation(0f, 90f, animation.relative_to_self, 0.5f, animation.relative_to_self, 0.5f); rotateanim.setduration((long)100); rotateanim.setrepeatcount(0); rotateanim.setfillafter(true);//maintains rotation previewimage.startanimation(rotateanim); previewimage.setimagebitmap(bmp);//set bitmap rotated 1 (if don't this, animation start initial position } }); however, when picture rotates 2 times first time butto

regex - Replace string value in regular expression with integer value in python -

this question has answer here: safety of python 'eval' list deserialization 5 answers in python code, user enters mathematical expression. want replace variables integer values , calculate result. can user regular expression in python replace variables integer values cant calculate sum replaced string of type string. can in tcl. has built in expr command pass string , automatically converts mathematical expression , calculates result. there way same in python? thank you yes there eval . example: a=3 b=4 s="(a*a+b*b)**.5" eval(s) but warned maybe security risk. may better use sympy http://sympy.org/en/index.html

Tree in Swift programming language -

i tried make tree swift using fonctionnal way here code: //this code works struct testarbre { var racine: int? } let a0 = testarbre(racine:nil) //this code stuck on error struct arbre { var racine: int? var feuillegauche: arbre? var feuilledroite : arbre? } let a1 = arbre(racine: 10, feuillegauche: nil, feuilledroite: nil) let a2 = arbre(racine:5, feuillegauche:nil, feuilledroite:nil) let a3 = arbre(racine:1, feuillegauche: a1, feuilledroite: a2); and here error when running code: <unknown>:0: error: unable execute command: segmentation fault: 11 <unknown>:0: error: swift frontend command failed due signal (use -v see invocation) command /applications/xcode6-beta.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/swift failed exit code 254 structs value types. imagine how struct initialized: have struct arbre, system allocate memory members, int , struct arbre, system allocate memory members (an int , struc

ios - UITableView snap to cell -

i trying implement "snap cell" effect in uitableview . uitableview has 3 equally sized cells, reason uitableview snaps cell 0 or cell 1 , doesn't ever snap third cell. wrong 50 points low, no matter how hard slide. use obvious code create effect can't understand why doesn't work. - (void)scrollviewwillenddragging:(uiscrollview *)scrollview withvelocity:(cgpoint)velocity targetcontentoffset:(inout cgpoint *)targetcontentoffset { nsindexpath *pathfortargettopcell = [self.tableview indexpathforrowatpoint:cgpointmake(cgrectgetmidx(self.tableview.bounds), targetcontentoffset->y)]; dlog(@"indexpathforrow %d", pathfortargettopcell.row); targetcontentoffset->y = [self.tableview rectforrowatindexpath:pathfortargettopcell].origin.y; } any thoughts going wrong? edit: suspect has status bar , nav bar on top, since off 64 points. still doesn't explain why doesn't recognise last cell though.. for status bar offset, in vc

php - Setting user role (admin/user) in Yii -

how can set user's role after login him/her yii::app()->user->login($identity, 0); ? what i'm asking how/what rule check if user logged in ( @ ) , administrator ( admin )? code in random controller: public function accessrules() { return array( array('allow', 'actions'=>array('users','user'), 'users'=>array('@'), ), array('allow', 'actions'=>array('admin','delete'), 'users'=>array('admin'), ), array('deny', 'users'=>array('*'), ), ); } well, seydamet said tutorial yii user writes. in case 'users'=>array('admin'), means user actual username of admin. i believe trying use roles. in case still link above perfect. after loggin in can http://www.yiiframework.com/wiki/65#hh3 , assign r

converter - XSLT or BizTalk-Mapping generated from Excel -

does know if there tool can convert excel document (or similiar, not have excel) xslt document or biztalk mapping (actually here must not biztalk specific document). if there no tool this, know references theme? know common question, unfortunatelly can not more specific. need research , preparing develop software. or @ least maybe has keywords might me research, because don't know how problem can described. no, asking not exist. in practice, crosswalk maintained business user using tool appropriate them, excel. the developer takes , implements biztalk map based on information provided business. never direct translation realistically, tool not possible. what can use @ ship time biztalk map documenter: http://biztalkmapdoc.codeplex.com/

shell - how to call a python function and give its parameters from the command line? -

let's say, have python script (test.py) , contains function takes string , printed back, following def pri(str): print str how call function ( pri ) command line? tried: $python test.py pri(blablalba) but got following error: missing end of string you should use sys.argv . argv list of arguments passed through command line. try this: import sys def pri(s): print s pri(sys.argv[1]) and can run doing python test.py blablabla

grep - zgrep File to get Lines containing any of a list of words -

i have large gzipped file , lines contain of list of words. there fast , efficient 1 line command this? try piped inclusions zgrep -e "one|two|three" myfile.gz

Java BigDecimal / Double precision error -

i'm trying simulate atm amount input in java, ie. user keeps inputting "1", amount shown should be: 0.00 0.01 0.11 1.11 11.11 111.11 i tried both double , bigdecimal processing: println( ((new bigdecimal(current)).multiply(new bigdecimal(10)).add(new bigdecimal(0.01))).setscale(2, roundingmode.half_up).tostring()) ) println( "" + double.parsestring(current) * 10 + 0.01 ) however both seems show instead: 0.00 0.01 0.11 1.11 11.1 <<< missing 0.01 @ end 111.01 are both due precision rounding error (i thought bigdecimal not have problem) or doing wrong? the simplest option might record input string. after each key press append new character end of it, , format number creating bigdecimal , dividing 100. string input = "111111"; bigdecimal value = new bigdecimal(input).divide(new bigdecimal(100)); // 1111.11 that said, i've tried code in loop , appears work fine. you'll need post code showing how generate curren

asp.net - PHP to ASP base64_decode -

i have working php code creates image string of data, , wondering how convert asp: $jpg = base64_decode($_post['imagedata']); header('content-type: image/jpeg'); header("content-disposition: attachment; filename=".$_get['name']); echo $jpg; is along lines of following code? var image = request.params["imagedata"]; if (string.isnullorempty(imagedata)) return; var imagecontent = convert.frombase64string(image); response.contenttype = "image/jpeg"; using (var os = response.outputstream) { (int = 0; < imagecontent.length; i++) os.writebyte(imagecontent[i]); os.flush(); os.close(); } thanks!

android - EditText custom cursor incorrectly drawn in first row -

i have edittext in main layout. have app theme, default edittext styled custom curdordrawable. <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/introedittext" android:gravity="top" android:singleline="false" android:text="" android:inputtype="textmultiline" android:textsize="24sp" > <requestfocus/> </edittext> <style name="apptheme" parent="android:theme.holo.noactionbar"> <item name="android:textcolor">#ffffff</item> ... <item name="android:edittextstyle">@style/edittextstyle</item> </style> <style name="edittextstyle" parent="@android:style/widget.edittext"> <item name="android:background">@android:color/transparent</item> <item name=&quo

excel - Formula to use current value of a cell, which won't update in the future -

is there function use current value of cell, won't update in future if change value of target cell? for example: a1 = 5 a3 = a1 (which equals 5) now, when change value of a1 6 a4 = a1 (should equals 6, a3 should remain 5) is possible in excel? say start a1 , a4 both empty. following event macro allow enter value in a1 , have appear in a4 . each time value in a1 changed, new value copied first empty cell below a4. enter following event macro in worksheet code area: private sub worksheet_change(byval target range) dim a1 range, a4 range, n long set a1 = range("a1") set a4 = range("a4") if intersect(a1, target) nothing exit sub application.enableevents = false if a4.value = "" a4.value = a1.value else n = cells(rows.count, "a").end(xlup).row + 1 cells(n, "a").value = a1.value end if application.enableevents = true end sub

python - Binary to Decimal converter works backwards -

i have created basic program converting 8-bit binary decimal, when run program, works backwards, e.g. if enter binary number '00000001' program return 128 . here code: binaryvalue=input("please enter 8 bit binary number.") binaryvalue=str(binaryvalue) if len(binaryvalue) <= 8: print("your number accurate.") value_index=0 total=0 print("your number valid.") in range(len(binaryvalue)): total = total + (int(binaryvalue[value_index])) * 1 * (2**(value_index)) value_index = value_index+1 print("your decimal number is: "+str(total)) so, mentioned jonrsharpe , moe reverse input: binaryvalue = str(binaryvalue)[::-1] or, can place offset in power: total = total + (int(binaryvalue[value_index])) * 1 * (2**(len(binaryvalue)-value_index-1)) both doing same thing though.

windows - Javascript project templates Win App store -

short question, find javascript templates windows apps? as described in follow link: javascript project templates store apps tried googling , trying search inside visual studio no avail (js templates not installed default). searching online through visual studio returns nothing of value. using visual studio express update 2. for reason fresh clean install did install templates except javascript ones. (lengthy) repair of visual studio 2013 express did trick!

c# - Is it a good practice to add a "Null" or "None" member to the enum? -

this question has answer here: c# enums: nullable or 'unknown' value? 6 answers when creating new enum in c#, practice have null member? if yes, give value of 0 default? call null member null or null? strictly believe in null or don't have problem calling other null. instance none. can elaborate on answer? there's design rule in visual studio, ca1008 , provides insight question. description of rule (styling mine): the default value of uninitialized enumeration, other value types, zero. a non-flags−attributed enumeration should define member has value of zero default value valid value of enumeration. if appropriate, name member 'none' . otherwise, assign 0 used member. note that, default, if value of first enumeration member not set in declaration, value zero. if enumeration has flagsattribute applied defines zero-valued

javascript - AngularJS using UI-JQ with Two-Way Data Binding -

good evening, i have small issue when trying create wizard form using jquery steps inside angularjs. can pass data plugin, cannot plugin send data controller. here how have setup: jqconfig myapp.value('uijqconfig', { steps: {} }; conroller myapp.controller('mainctrl', function ($scope) { $scope.user = { name = "", address = "" }; $scope.wizardoptions = { onstepchanging: function (event, currentindex, newindex) { console.log($scope.user); } }; html template <form ui-jq="steps" ui-options="wizardoptions"> <h1>step 1</h1> <div> <input ng-model="user.name" /> </div> <h1>step 2</h1> <div> <input ng-model="user.address" /> </div> </form> i wizard load , everything. issue when type inputs, not update user object inside contr

.htaccess - Use htaccess to append a query string to URL -

i need append query strings urls campaign tracking/form submission. instance, need http://domain.com/page/ redirect http://domain.com/page/?campaign_id=123456 the way tried set giving me redirect loop error message when try visit domain.com/page: rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] redirect 301 /page http://domain.com/page/?campaign_id=1234656 i tried rewriterule instead, , giving me loop message: rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewriterule ^page$ http://domain.com/page/?campaign_id=1234656 [l,ne,r=301] i'm sorry if question has been answered on here. searched awhile , couldn't find it, please don't yell @ me posting. did try find on own. thanks! try: rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{query_string} ^$ rewriterule ^page/?$ http://domain.com/page/?campaign_id=1234656 [l,ne,r=301]

sql - Update a row with data from a joined table where each row is different -

i update column in table value different every row. value want update table obtained inner join table. how go updating each row value obtained join, on row row basis? here example .... divisionid divisionname licenseno ---------------------------------------------- 1 crimminal law null 2 civil law null 3 corporate law null practiceid divisionid practicename licenseno ---------------------------------------------------------- 11 1 law firm 243527 12 2 law firm b 364802 13 3 law firm c 394843 select practice.licenseno practice inner join division on division.divisionid = practice.divisionid i know how values want unsure how practice.licenseno licenseno field in division table. using sql server 2012. try this. update division set licenseno=practice.licenseno division inner jo

html5 - Encoding FFMPEG to MPEG-DASH – or WebM with Keyframe Clusters – for MediaSource API -

i'm sending video stream chrome, play via mediasource api. as understand it, mediasource supports mp4 files encoded mpeg-dash, or webm files have clusters beginning keyframes (otherwise raises error: media segment did not begin keyframe). is there way encode in mpeg-dash or keyframed webm formats ffmpeg in real-time? edit: i tried ffmpeg ... -f webm -vcodec vp8 -g 1 every frame keyframe. not ideal solution. work mediastream though. way sync segments keyframes in webm not every frame needs keyframe? reference questions on webm / mp4 , mediasource: media source api not working custom webm file (chrome version 23.0.1271.97 m) mediasource api , mp4 at moment ffmpeg not support dash encoding. can segment ffmpeg ( https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment ), recommend combining ffmpeg , mp4box. use ffmpeg transcode live video, , mp4box segment , create .mpd index. mp4box part of gpac ( http://gpac.wp.mines-tel

xml - Android: Can I re-use a layer-list? -

when implementing selectors buttons , listview items, keep finding want reuse same item/background state_pressed , state_focused. instead of duplicating xml 'code', possible re-use ? e.g. here state_pressed 'code' - how can state_focused use same lump of 'code' without duplicating all? <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- pds: side lowlight lines inset hidden underneath solid colour --> <item android:bottom="0dp" android:right="0dp" android:top="0dp" android:left="0dp"> <shape> <solid android:color="#00000000" /> <stroke android:color="@color/butgreyselectframe" an

uiview - On a programmatic view, my button can't be clicked -

i have uiview leads uiview. have userinteraction set true. button shows, button not when clicked. added println statement make sure wasn't code ran in function. wrong view, or how button , function connected. i using swift. this code. in snipits, won't see viewdidload method: let initiallaunchcontroller = uiview() let teachingscreen = uiview() learntoplaybutton.settitle("click here learn how play.", forstate: .normal) learntoplaybutton.settitlecolor(uicolor.whitecolor(), forstate: .normal) learntoplaybutton.titlelabel.font = uifont(name: "helveticaneue-ultralight", size: 35) learntoplaybutton.titlelabel.textalignment = .center learntoplaybutton.addtarget(self, action: "learntoplaypage:", forcontrolevents: .touchupinside) learntoplaybutton.frame = cgrectmake(37, 70, 500, 200) initiallaunchcontroller.backgroundcolor = uicolor.whitecolor() teachingscreen.backgroundcolor = uicolor.

oracle - How to make a copy of a database package -

i have package (potentially, many) i'd copy new package different name. ideally i'd run this: begin copy_package('my_package_name','my_package_name$bk'); end; / this find package named my_package_name , , create/replace new package called my_package_name$bk references my_package_name (if any) changed on well. it reasonable assume package names not case-sensitive, , references package name in source either uppercase or lowercase (i.e. there won't references my_package_name in source). this procedure copy specified package, replacing references package name (all uppercase or lowercase) goes - including references in comments. procedure copy_package (old_name in varchar2 ,new_name in varchar2 ) ddl clob; begin ddl := dbms_metadata.get_ddl (object_type => 'package_spec' ,name => old_name ); ddl := replace(ddl, upper(old_name), upper(new_name)); ddl := replace(ddl, lower(old_name), lower(new_name

Apply SVN patch to GIt repo -

i have patch file have generated via " svn diff " command 1 of svn repository. now, have moved repository github , need apply patch file git repository. problem each time try apply patch git repo, patch hunks failed. i have tried via " git apply " , " patch " commands none of them seemed work correctly. note: know question has been asked before none of provided answers seems working me, trying out luck here. if you're applying diff subversion git, should using svn diff --git produce git's preferred format.

php - $row=mysql_fetch_array and $row2=mysql_fetch_array -

i'm trying figure out way of being able use $row , $row2. how can incorporate while statement? $result=mysql_query("select * infupdates username='$_session[username]' order date desc"); $result1=mysql_query("select * infupdates username='test' order date desc"); while ($row1=mysql_fetch_array($result1,mysql_assoc)) <td><span class="checkmark"><?php if (($row[onetie]==1)) print "✓";?></span></td> <td><span class="checkmark"><?php if (($row2[onecro]==1)) print "✓";?></span></td> better use or in query try <?php $result=mysql_query("select * infupdates '".$_session['username']."' or username='test' order date desc"); while ($row=mysql_fetch_array($result,mysql_assoc)) {?> <td><span class="checkmark"><?php if (($row['onetie']==1)) print "✓&qu

Reading the parameters of an ajax link in PHP in codeigniter -

i new ajax. have link has 4 parameters 1 of these $str_post initialized in controller: $str_post="&ajax =1"; $str_post.="&province=".$this->input->post('province'); $str_post.="&city=".$this->input->post('city'); $str_post.="&name=".$this->input->post('name'); $this->ajax_pagination->make_search($this->case_model->case_paginations(),$starting,$url,$str_post); by using function(make_search) sets $str_post parameters of ajax pagination link. when echo $str_post thing this: &ajax=1&proince=all&city=all&name=all now need these parameters , assign every of them in variables this: $province=$str_post['province']; but shows & how can all value? can 1 me? try getting values way! $province = $_post['province']; // if ajax type post

python - The best way to sort indexes in Text widget -

in text widget , indexes used point positions within text handled text widget. positions withing text in text widget marked using string indexes of form “line.column”. line numbers start @ 1, while column numbers start @ 0. the problem how sort list of indexes? instance: unsorted_indexes = ['1.30', '1.0', '1.25', '3.10', '3.100', '3.1', '3.8'] # expected result: ['1.0', '1.25', '1.30', '3.1', '3.8', '3.10', '3.100'] # cant sort strings: print(sorted(unsorted_indexes)) # gives incorrect values: ['1.0', '1.25', '1.30', '3.1', '3.10', '3.100', '3.8'] # cant convert float print(sorted([float(index) index in unsorted_indexes])) # [1.0, 1.25, 1.3, 3.1, 3.1, 3.1, 3.8] if transform string index other form, off course need way original form. in above example doing float('3.1') , float('3.100') resu

How to include iText Library with licensed in android app? -

if have license itext, steps include itext jar file in android application? need download jar , add project? or need else? i'm afraid bit out of scope stackoverflow , instructions should have been given when received license key, here's how add key: the jar added classpath other library. you'll need download , add licensekey jar classpath, can found here: http://itextsupport.com/download/licensekey.html you'll need load license key before using other itext operation calling licensekey.loadlicensefile("path/to/itextkey.xml")

python - skipping double quotes"" while reading into array in jython -

example: in jython: (here want read line file:path skipping double quotes) how that. i'm not sure question since in example did not remove double quote, if want (removing double quote), that: ''.join(yourstring.split('"')) this gives me: >>> string = '"d:/ibm/websphere8/appserver/profiles/appsrv12"/logs/logbackmain.xml' >>> ''.join(string.split('"')) 'd:/ibm/websphere8/appserver/profiles/appsrv12/logs/logbackmain.xml' if it's first double quote, can do: ''.join(yourstring.split('"', a))

Can we have a form with fields from different pages in multipage document in jquery mobile? -

i have multi page document in jquery mobile. page 1 has link redirects me page 2. page 2 has button submit request server. possible create form have form fields spread in both page 1 , page2 , when submit form fields in both pages submitted. multi page document in jquery mobile support this? or there other way easily? yes, can. the long page forms can spread on 2 pages in same html shown in following code. <body> <form action="/m/processorder.php" method="post"> <div data-role="page" id="delivery"> <?php $headertitle = "deliver to"; ?> <?php include("includes/header.php"); ?> <div data-role="content"> <h2>where delivering?</h2> <!—-form elements go here --> <p> <div class="ui-grid-a"> &

asp.net mvc - MVC SelectListItem in multi-layer design -

i'm following typical domain driven design tier design. have: web contains views, , controllers applicationservice facade application, i.e. service(s) contains view models automapper domain model bll repository persistence logic but since i'm using drop down lists in views, i'm confused how incorporate selectlistitem in design. note, drop down lists populated data database. from i've read, view models should reside in applicationservice tier. theory, web layer "presentation", i.e. views , controllers , therefore can replaced without re-designing app. but, doesn't work when view models using selectlistitem (for drop down lists). selectlistitem requires system.web.mvc. , applicationservice layer believe should not have reference system.web.mvc. so, i'm stuck! either give applicationservice layer reference system.web.mvc (ugly option). or find way how populate drop down lists without selectlistitem. or move view

django - Data structure: mongoengine to GeoJson -

i posted first question on stackoverflow, think question quite extensive , full of potential errors. i'd begin again, step-by-step, shorter , simplier question : do think code correct ? the purpose structure models.py store datas in mongo database geojson objects. thanks lot ! models.py : # -*- coding: utf-8 -*- mongoengine import * connect(‘mongodb_jsons’) import datetime class geojson(document): # geojson object # save in mongodb geojson structure date_created = datetimefield(default=datetime.datetime.now) location = pointfield(auto_index=false) # list of 2 float numbers [ 10.000 , 240.000 ] content1 = charfield() content2 = charfield() meta = {'db_alias': 'mongodb_jsons', # save in db ‘mongodb_jsons’ 'indexes': [ # geojson structure {'type' : 'feature', { 'geometry':{ 'type' : 'point',

ruby on rails - Bootstrap - Modify Media Queries -

i'm using twitter-bootstrap 2.2.8 , rails 4. where applicable, i've set different divs desktop, tablet , phone using following classes: .visible-desktop, .visible-tablet, .visible-phone the problem that, way bootstraps media queries work, ipad(landscape) using desktop code not tablet version major problem. is there way modify bootstraps media queries tablet max-width is, example, 1024px instead of current value (979px)? if don't mind hacking @ bootstrap css need find media queries , change them whatever width/height want. you'll find lines this @media (min-width: 768px) { /*some css*/} just change these values whatever want (the media queries appear in many different places throughout css) , change various classes, in case there should like @media (max-width: 979px) { .visible-tablet{ display:block; } } just change media query 1024 , away. mindful of messing media queries much, classes widths (such various span* classes) mig

hadoop - Sqoop installation export and import from postgresql -

i v'e installed sqoop , testing . tried export data hdfs postgresql using sqoop. when run it throws following exception : java.io.ioexception: can't export data, please check task tracker logs . think there may have been problem in installation. the file content : ustnu 45 mb1ba 0 gnbco 76 izp10 39 b2aoo 45 si7eg 93 5sc4k 60 2ihfv 2 u2a48 16 yvy6r 51 lnhsv 26 mz2yn 65 80gp3 43 wk5ag 85 vufyp 93 p077j 94 f1oj5 11 lxjkg 72 0h7np 99 dk406 25 g4krp 76 fw3u0 80 6ld59 1 07khx 91 f1s88 72 bnb0v 85 a2qm7 79 z6cat 81 0m3do 23 m0s09 44 kivwd 13 gnud0 78 um93a 20 19bhv 75 4of3s 75 5hfen 16 this posgres table: table "public.mysort" column | type | modifiers --------+---------+----------- name | text | marks | integer | the sqoop command is: sqoop export --connect jdbc:postgresql://localhost/testdb --username akshay --password akshay --table mysort -m 1 --export-dir mysort/input followed error: warning: /usr/lib/hcatalog not exist! hcatalog