Posts

Showing posts from April, 2012

php - How to increment a given time with a given number of minutes and associate the new time to a array list -

i need increment given time given minutes number , and associate time array list of id's. example of need : $ids_arrays = array(699926900040821, 699926900040822, 699926900040823); $given_time='20:30'; $given_minutes = '5'; $newarray=array(); and want create new array : array ( [699926900040821] => '20:35' [699926900040822] => '20:40' [699926900040822] => '20:45' ) my code : //$_get['grupuri']= simple array ,$ids_arrays; //$_get['numar_grup']= number of minutes increment ; //$_get['time_grup']=time array; $ora_grup=array(); $h1=new datetime($_get['time_grup']); $m1=new dateinterval('pt'.$_get['numar_grup'].'m'); ( $i=0; $h=$h1; $h->format('h') <10; $i <count($_get['grupuri']) ; $i++, $h->add($m1)) { $ora_grup[$_get['grupuri'][$i]]=$h->format("h:i\n"); } try this

html5 - UX Design Software for Android web based application -

i beginner in designing user interface web based mobile apps. there software on mac os x can use develop user interface of web based mobile apps without using of css or html5. e.g developed pages using microsoft powerpoint mac. since app requires lot of pictures program easy drag , drop features do. thanks! for web based mobile apps mean mobile app written web technologies such html5 or css? because don't think drag-and-drop ui builder exist, apart mit app inventor, generate java code. you can use framework http://phonegap.com/ , require html5, css , javascript.

android - Add fragment to an inflated view -

i have listview . in adapter, in getview method, inflate view resources. want add fragment view. far concerned, fragments can added activity's view only; view created , not attached activity yet. how can it? i have <fragment> tag in item layout, can't reference it, because view.findviewbyid() returns view , cannot cast fragment .

Embedded Record is not getting loaded in Ember.js -

following json data trying load using ember-data: { "product" : [ { "id" : 1, "name" : "product1", "master" : { "id" : 1, "name" : "product1", "images" : [ { "id" : 1, "producturl" : "/images/product1_1.jpg" }, { "id" : 2, "producturl" : "/images/product1_2.jpg" } ] } }, { "id" : 2, "name" : "product2", "master" : { "id" : 2, "name" : "product2", "images" : [ { "id" : 3, "produ

mysql - How to use concat() method in wql? -

i develop wmi application windows logs using wql query. how use concat() method in query. input wql query : wmic -u xxx%xxx //xxx "select concat(category, '|dhcp') win32_ntlogevent timewritten > '06/04/2014 13:59:00' , logfile = 'security'" output : [wmi/wmic.c:212:main()] error: retrieve result data. ntstatus: nt code 0x80041017 - nt code 0x80041017 without using concat() method, work perfectly. if other way value using concat() method in wql. notes: when using concat() method in different scenario, not working. throw error code. please me guys. thanks in advance. the not concat function in wql , wql a small subset of sql standard , doesn't include such function.

javascript - Angular - ngAnimate - Animate.css - Item first shows and then the animation starts -

i have problem angular - nganimate - animate.css combination (using nganimate separate module, not old version). so have list table , each tr repeat ng-repeat. list can modified, it's guests list, , have button adds new object (guest) model displayed same ng-repeat. each added list, use css rule make fade in list: #ic-booking-details .ic-confirmed-guest-list tr.ng-enter { -webkit-animation: slideinleft 0.5s; animation: slideinleft 0.5s; } the animation shown, problem first shows in list, visible short period (about 100ms), , starts animating -> hides , starts fade in. ofcourse, shouldn't show first, , fade in, should fade in while not visible @ all. am missing css rule work properly? right i'm using ng-enter. thanks! edit: html repeats guests: <div class="ic-confirmed-guest-list-holder"> <table class="ic-confirmed-guest-list"> <tr ng-repeat="(k,v) in guests.data"> <td class=

Android and PhoneGap -

i had urge learn android build apps , games, looked fun language if had prior knowledge java. found out there other frameworks convert codes native features apps phonegap , there unity helps in cross-platform game development uses javascript, c# , boo. question if frameworks these exist why need learn native languages? difference make? using native languages advantages the native applications allow full use of device capabilities might missing in other third party apis. easier performance application when programming using native sdks. disadvantages requires learning different languages development on different platforms. the code base developed 1 platform cannot adapted platform. using frameworks phonegap developers can build applications using html/css/js, including javascript classes give access device hardware , other ios api featurs contacts, filesystem, camera, microphone, gps, etc. final application wrapped within platform native '

python - reload subclass of frozenset -

i have class want have functions of frozenset don't want him configurable (by init, frozenset gets iterable). additionally, want him have function 'reload' - loading static list server user can not change (so don't want user think can change it). list on server can changed admin need reload option. that's hoped for: class a(frozenset): def __init__(self, list_id): super().__init__() self.list_id = list_id self.reload() def reload(self): #loading staff self.list_id... pass but didn't find way 'add' new staff class (i tried re-init it). may using wrong staff if have anther way fine (i need option compare difference between difference objects): a = a(1) b = a(2) len(a) iter(a) a.difference(b) may overloading add , update of set don't want (it looks bad in code because there more update-like functions). you cannot update frozenset contents, no; remains immutable when subclassed.

jsf 2 - Stacked Bar Chart with Line Chart not working -

i need create bar stacked combination chart line see example: multiaxismodel = new linechartmodel(); multiaxismodel.setstacked(true); barchartseries boys = new barchartseries(); boys.setlabel("boys"); boys.set("2004", 120); boys.set("2005", 100); boys.set("2006", 44); barchartseries boys1 = new barchartseries(); boys1.setlabel("boys1"); boys1.set("2004", 20); boys1.set("2005", 10); boys1.set("2006", 44); linechartseries girls = new linechartseries(); girls.setlabel("girls"); girls.setxaxis(axistype.x2); girls.setyaxis(axistype.y2); girls.set("a", 52); girls.set("b", 60); girls.set("c", 110); multiaxismodel.addseries(boys); multiaxismodel.addseries(boys1); multiaxismodel.addseries(girls); multiaxismodel.settitle("multi axis chart"); multiaxismodel.s

excel - check for user input data in dynamically added ComboBoxes -

i using user form display acronyms found in document , definitions of acronyms. because won't know in advance how many there have created of labels, check boxes , comboboxes dynamically using loop below. i stuck in want allow user able type in combobox new definition example 1 didn't exist in excel database or want use different definition 1 there (i aware bad practice unfortunately people don't stick standard list). works fine set problem want check if user has entered new or not. so question is, there built in function or variable this? or there simple way it? (i have tried , tested code add string database not issue, checking if wasn't there before without running through entire database scratch again) = 1 n checkboxi = "checkbox" & labeli = "label" & comboboxi = "combobox" & 'add checkbox, label , combobox .multipage1.pages("page1").controls.add "form

oracle sqldeveloper - SQL developer GUI function permission -

after granting user ability create functions adding grant create procedure user; i've created function code no problems. however, when using gui in sql developer create function error appears indicating have no permission create function. how can fix problem?

php - SilverStripe LookupField always displays "(none)" -

using silverstripe 3.1 trying have form display specific, pre-selected, value instead of having dropdown. since docs indicate lookupfield being situation attempted use it, no matter displays (none) instead of value pass. doesn't appear ever had kind of problems because google doesn't bring useful. either or fail @ using google. $fields = new fieldlist(...); // $user contact (a dataobject) or null if ($user == null) { $raw = dataobject::get('contact', 'maycontact = 1', 'sortorder asc'); $list = array(); foreach ($raw $item) { $list[$item->id] = $item->name . (empty($item->rank) ? '' : ' (' . $item->rank . ')'); } $sel = new dropdownfield('contact', 'contact', $list); } else { $list = array(); $list[$user->id] = $user->name . (empty($user->rank) ? '' : ' (' . $user->rank . ')'); $sel = new lookupfield('contact', '

html - Flash of unstyled content -

Image
i've got page content pulled down database in body, in head i've got external style sheet linked format content. on safari (doesn't seem happen on chrome or firefox) i'm getting lovely flash of unstyled content. i'd rather have non-javascript fix this, there way position external css sheet link gets applied before php script runs in body? - assume being @ top in head automatically, apparently not in safari, ideas? <?php require_once "../config/article_functions.php"; include "../widgets/topborder.html"; include "../widgets/banner.php"; include "../widgets/navbar.html"; ?> <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="http://example.org/widgets/article.css"> <style type="text/css"> a:link {color: inherit;} /* unvisited link */ a:visited {color: inherit;} /* visited link */ a:hover {color: inherit;} /* mouse

ruby on rails - Error: First argument in form cannot contain nil or be empty -

i having issues form_for, keep getting error first argument in form cannot contain nil or empty this form <%= form_for @blog |f| %> <%= f.text_area :blogpost %> <%= f.submit 'add blog'%> <% end %> this controller class blogscontroller < applicationcontroller def index @blogs = blog.all #.paginate(page: params[:page], per_page: 5) end def create @blog = blog.create(blog_params) redirect_to root_path, notice: "created blog" end def update @blog = blog.create(blog_params) redirect_to root_path end def show @blog = blog.find(params[:id]) end def new @blog = blog.new end def edit @blog = blog.find(params[:id]) end def destroy @blog = blog.find(params[:id]) @blog.destroy redirect_to root_path end private def blog_params params.require(:blog).permit(:blogpost) end end how fix this? as belongs index.html.erb ,you should

java - How to implement interface that uses templates? -

i'm expected implement immutable list interface looks this: public interface interflist<t> extends iterable<t> { public interflist<t> append(t t); //more abstract methods follow } when i've let netbeans implement interface me, appeared: public class mylist implements interflist { private object value; @override public interflist append(object t) { throw new unsupportedoperationexception("not supported yet."); } } however, want keep template proper type of object accepted. eg.: public class mylist<t> implements interflist { private t value; @override public interflist<t> append(t t) { throw new unsupportedoperationexception("not supported yet."); } } the first approach allow kinds objects stored in list making quite mess. the first approach, however, marked error in netbeans: mylist not abstract , not implement method append(object) in interflist you should

python - Cannot remove SQLite row using 'where' and variable -

got problem, appreciate on it. i want remove row, transferred func variable. that's code: con = sql.connect('db.sqlite') cur = con.cursor() query = 'delete media_tmp media_id="%s"' % media_id.strip() print(query) cur.execute(query) if con: con.close() print(query) gives me following: delete media_tmp media_id="737589711821419460_184456611" and when execute directly in sqlite, works , removes deserved row. executed cur.execute(query) doesn't work @ all. the func finishes good, got no errors. you forgetting commit change: con.commit() the sqlite3 command line tool auto-commits changes, sqlite3 library not. you should use sql parameters instead of string interpolation: query = 'delete media_tmp media_id=?' cur.execute(query, (media_id.strip(),)) quoting sqlite3 documentation : usually sql operations need use values python variables. shouldn’t assemble query using python’s string operations

r - Smote fails making oversampling -

i have done oversampling in dataset using smote, included in dmwr package. my dataset formed 2 classes. original distribution 12 vs 62. so, have coded oversampling: newdata <- smote(score ~ ., data, k=3, perc.over = 400,perc.under=150) now, distribution 60 vs 72. however, when display 'newdata' dataset discover how smote has made oversampling , there samples repeated. for example, sample number 24 appears 24.1, 24.2 , 24.3. is correct? affects directly in classification because classifier learn model data present in test, not legal in classification. edit: think didn't explain correctly issue: as know, smote technique oversample. creates new samples original ones, modifying values of features it. however, when display new data generated smote, obtain this: (these values values of features) sample50: 1.8787547 0.19847987 -0.0105946940 4.420207 4.660536 1.0936388 0.5312777 0.07171645 0.008043167 sample 50.1: 1.8787547 0.19847987 -0.0105946940 4.420

javascript - JS: Run function outside iFrame -

i have website can press ctrl+c (using shortcut.js library) , text field appears, can type command go somewhere else, content of "somewhere else" loaded inside iframe. the thing websites ctrl+c still works, , others not. there way make function check keyboard if focus on iframe?

c++ - Detect if event is taken - win32 -

this question has answer here: winapi bn_clicked how identify button clicked? 2 answers i'm wondering if can me on since i've been looking around google , chances found don't understand how it. routine perform. have button 'a' , button 'b', if button 'a' pressed open messagebox. if button 'b' pressed open new window , display content window. sorry vague basically, have 2 buttons on application. 1 labelled 'a' , 'b'. how tell application run through kind of loop check if buttons pressed? if first button clicked open message box, if second open window class. following how add new properties window class opened in same application? i thinking of taking wm_command approach in switch statement, id's of cases , how correspond each button? -- can on problem here appreciated, code example more appreciated!

hex - I have written the following program for XORing 2 cipher texts in hexadecimal using java. How do i convert output to ASCII -

i have written following program xoring 2 cipher texts in hexadecimal using java. output not correct. how convert output in ascii? public class javaapplication1 { public static void main(string[] args) { string y="a12104c6134e57914f104f2521ba4422c4d7b184f4815541f80484e1e24161d64d54ba2210194510164d4f3a0534304e43e1e1da524612171b11701be45431cc1d16a52d11744e1961a114de55174f84e54371"; string z="32510ba9babebbbefd001547a810e67149caee11d945cd7fc81a05e9f85aac650e9052ba6a8cd8257bf14d13e6f0a803b54fde9e77472dbff89d71b57bddef121336cb85ccb8f3315f4b52e301d16e9f52f904"; string d; string s="a"; char strfory[] = new char[2]; char strforz[] = new char[2]; string stry,strz; for(int i=0; i<y.length();i+=2) { strfory[0]=y.charat(i); strfory[1]=y.charat(i+1); strforz[0]=z.charat(i); strforz[1]=z.charat(i+1); stry = new string(strfory); strz = new str

c# - cant remove element from java.util.list -

i'm using java.util in c# program. want remove element list, don't know why is not working. foreach (list sentence in new documentpreprocessor(clfile)) { //int = sentence.size(); string rm = "aspect"; object objstr = rm; sentence.remove(objstr); string temp2 = string.join(",", sentence.toarray()); ... } after execution of above coe word "aspect" still there in list sentence. ps: document preprocessor belongs to, edu.stanford.nlp.process according javadoc of java version, there no string s in list: http://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/process/documentpreprocessor.html , hasword s. should go through , remove tostring() or find out concrete implementation.

sql - Couldn't find Project with id=1 [WHERE "projects"."deleted_at" IS NULL] -

i using paranoia gem. i have bunch of projects in database somereason behaving if deleted. when navigate projects/1 route error: couldn't find project id=1 [where "projects"."deleted_at" null] when type in console: project.find(1).deleted_at i nil what happening here? this controller show action: def show @project = project.find(params[:id]) @comments = comment.all.where(:project_id => @project.id) @updates = projectupdate.all.where(:project_id => @project.id) end error happens on @project = project.find(params[:id]) here model project scopes: scope :by_category, lambda {|category| {:conditions => {:category_id => category.id}}} scope :by_npo, lambda {|npo| {:conditions => {:npo_id => npo.id}}} with project.find(1) get: => #<project id: 1, name: "project 1", npo_id: 1, description: "project1 description", location_id: 4, singular_unit: "1", past_tense_action: &qu

android - ImageView getting very small under a linear layout -

Image
in 1 of screens, expect acheive kind of layout highest importance being images correctly scaled. these images giving of adequate resolution , works fine on fragment layout. layout.xml looks this <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/stadiumbg" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@drawable/listview_item" android:orientation="horizontal" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content"

javascript - how to execute angular stuff in resolve of routePrvodier? -

once execute angular stuff trigger ng-click of element use element.click() ,it says "error: [$rootscope:inprog] $digest in progress". but if set timeout settimeout function,this error gone. check out, should solve problem: https://coderwall.com/p/ngisma . saying using element.click() instead of ng-click, why that? ng-click directive meant handling clicks within angular digest cycle, why implement yourself?

android - Reason why i'm not getting Json Response from server -

public string post(string url){ inputstream inputstream = null; string result = ""; try { // 1. create httpclient httpclient httpclient = new defaulthttpclient(); // 2. make post request given url httppost httppost = new httppost(url); string json = ""; // 3. build jsonobject jsonobject jsonobject = new jsonobject(); jsonobject.accumulate("username","example@gmail.com"); jsonobject.accumulate("password","123456!"); jsonobject.accumulate("appid","andapp"); // 4. convert jsonobject json string json = jsonobject.tostring(); // ** alternative way convert person object json string usin jackson lib // objectmapper mapper = new objectmapper(); // json = mapper.writevalueasstring(person);

sql server - Count(*) the total unique entries but for 2 different fields -

i'm working on old table using sql server 2005. (the table isn't designed well, can't changed now.) i'm trying count unique entries in 2 columns. this gives list need: select name1 mytable union select name2 mytable -- automatically removes dups but how count that? (hopefully 1 statement.) this, syntax isn't right: select count(select name1 mytable union select name2 mytable) use subquery: select count(*) (select name1 mytable union select name2 mytable) u

android: how do i save and load and int value using internal storage -

i'm looking way save , load data in android, i'm using eclipse & not want use sharedpreferences @ all, please not suggest that save() think i've figured out , have done this: int blankval = 1; int targetval = 0; fileoutputstream fou = openfileoutput("data.gds", mode_private); fou.write(blankval); fou.write(targetval); fou.close(); while load() have no idea how do, i've tried many things , make app crash upon executing i want load each val 2 ints (blankval & targetval) if do: blankval = 5; targetval = 7; load(); load set values 0 & 1 sharedpreferences choice, if wanna avoid why not go sqlite database provided android.

Cordova device-orientation error on iOS -

i'm getting following error xcode when trying access compass heading: (void)getheading:(cdvinvokedurlcommand*)command exc_bad_access (code=1) any idea on causing this? thanks after research here , there, i've found out error occurs on devices architecture arm64 , has been solved in new release of cordova 3.5. download new cordova release , update project ios platform , it's magically solved.

php mysql (INSERT QUERY) -

i have simple payment form , include voucher_id , customer_id , amount , payment_type , transaction_type , date . transaction_type’s withdrawls , deposits. my data base table should not contain "amount" column. has credit , debit column. in case, want insert amount debit column if transaction type ="withdraws" of insert amount credit column if transaction_type ="deposits" . when insert data table show: column count doesn't match value count @ row 1 because, table has debit , credit column. form has 1 column , name amount. how can insert query sort out question. <?php // save data if form submitted if(isset($_post['submitted'])){ // catch data $voucher_numebr = $_post['voucher_numebr']; $member_id = $_post['member_id']; $amount = $_post['amount']; $acc_type = $_post['acc_type']; $payment_type = $_post['payment_type'];

xpath - How to grab the actual name of the attribute/class within the brackets -

how name of class, in case 84 <div style="width: 50%;" data-test="84" class="test"></div> so want contents of data-test attribute given: <div style="width: 50%;" data-test="84" class="test"></div> if want value of data-test attribute, use: /div/@data-test or, if you're looking class equal test : /div[@class="test"]/@data-test or, if want value of data-test attribute containing data-test attribute: //*[@data-test]/@data-test and if none of these help, may want update question give better idea of you're looking for.

c# - Error Loading Crystal Report in Client Machine -

i have developed windows application using vs2010 c# , generated crystal report using application.the problem able view report on computer when same application runs on client machine throwing error "could not load file or assembly crystaldecisions.windows.forms version 13.0" i not able load report on client machine. possible reasons error. include dll crystaldecisions.windows.forms in deploy client machine. can mark file in solution explorer copy local, , deploy bin folder in installer.

ios - How to disable copy/paste option in UITextfield in ios7 -

i tried @implementation uitextfield (disablecopypaste) -(bool)canperformaction:(sel)action withsender:(id)sender { return no; return [super canperformaction:action withsender:sender]; } @end but disables textfield's copy/paste option,how disable menu options specific textfield. i think method ok,since no making of category etc.it works fine me. [[nsoperationqueue mainqueue] addoperationwithblock:^{ [[uimenucontroller sharedmenucontroller] setmenuvisible:no animated:no]; }]; return [super canperformaction:action withsender:sender];

python - How to enqueue a job in rq from redis -

i have fetch functions , time when execute mysql , save thing redis.now redis have execute functions @ prescribed time.i want use rq scheduler not able find out model in should save imported data redis. totally new in python , redis if install redis there file (for me ~/lib/python2.7/site-packages/rq/queue.py in turn calls job.py) states enqueue , enqueue_call functions: def enqueue_call(self, func, args=none, kwargs=none, timeout=none, result_ttl=none, description=none, depends_on=none): """creates job represent delayed function call , enqueues it. `.enqueue()`, except takes function's args , kwargs explicit arguments. kwargs passed function contain options rq itself. etc....""" def enqueue(self, f, *args, **kwargs): """creates job represent delayed function call , enqueues it. expects function call, along arguments , keyword arguments. etc....&quo

android - Crosswalk - Build and Manifest -

i'm using crosswalk projects need run on android 2.2 , up. i'm looking documentation manifest.json because didn't find lists properties can use. i know if there way manually edit androidmanifest.xml before build in order change permissions or sdk version. eventually, glad if move build folder crosswalk-environment project folder. moment, can move apks --target-dir. here folder structure : -myapp_project -myapp_www -[move build folder here] -crosswalk-env -...content... -[build folders there] thanks i'm new crosswalk, answer should not perfect. as previous comment, documentation of manifest.json found in https://github.com/crosswalk-project/crosswalk-website/wiki/crosswalk-manifest . it says can set permissions properties don't have edit androidmanifest.xml directly. (though have not tested it) i don't know how handle crosswalk's sdk directory neither, simple build.bat script mitigate pain. @set xwal

c - converting sprintf to snprintf using MACRO -

we have code following: #define maxint 1000000000 #define sprintf(a, b, c) ((sizeof (a) > 8) ? snprintf(a, sizeof (a), b, c) : snprintf(a, maxint, b, c)) // avoids buffer overrun static buffers of size > 8 else behaves default sprintf() // note max. size of char pointer 8, if sizeof (a) > 8, means static array i remember developer asked convert sprintf() safer version snprintf() , did change shown above. i understand above macro avoids buffer corruption static buffers of size > 8 , other i.e. dynamic buffers , static buffers of size <=8 behaves normal sprintf() assuming string being copied not greater "maxint". correct? for ex. if string being copied less dest buffer or greater dest buffer, statement/above macro behave correctly either snprintf(a, sizeof(a), b, c) or normal default sprintf() - kind of ok behaviour time being. assume never fill dest buffer maxint (too big , src string never

javascript - How to detect collision -

i doing small game based on tutorial http://code.tutsplus.com/tutorials/learn-createjs-by-building-an-html5-pong-game--active-11845 i made changes line buggy if(ball.x <= player.x + 22 && ball.x > player.x && ball.y >= player.y && ball.y < player.y + 75) whenever user hit fast left or right ball keep bouncing in tutorial, bug there, can me ? thanks i think easiest solution add direction variable ball , test it. if it's towards player check you've coded, else ignore. if check passes, change direction when player intercepts it. when bounces back, change direction again. simplify code lot , reduce number of checks going on.

How to change the Header info (text) in NSIS at run time? -

Image
i using nsis i.e., null soft create windows installer. working fine, need change header info text while installer running. for example: in header info getting follows, installing, please wait while... but need change info or text please wait... or text. herewith have attached screenshot , marked in red color. please suggest solution. !include mui.nsh !insertmacro mui_page_components !define mui_page_header_text "blah blah" !define mui_page_header_subtext "sub blah blah" #!define mui_instfilespage_finishheader_text "blah blah completed" ; need if mui_page_instfiles last page #!define mui_instfilespage_finishheader_subtext "sub blah blah" !insertmacro mui_page_instfiles !insertmacro mui_page_finish !insertmacro mui_language english edit: , change during install process: section !insertmacro mui_header_text "hello" "world" sleep 3333 !insertmacro mui_header_text "still" "there?" s

How can a GitLab ssh url show a non-default user? -

i have gitlab installation, installed under different user default ' git '. on project pages, users instructed use following url ssh: git@host:user/project.git how change show new username? try , modify/uncomment lines regarding ssh use in gitlab.yml # uncomment , customize if can't use default user run gitlab (default: 'git') # user: git the initializer supposed use setting when computing ssh url repos. see " config/initializers/1_settings.rb#l12-l18 " def build_gitlab_shell_ssh_path_prefix if gitlab_shell.ssh_port != 22 "ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/" else "#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:" end end

ios - Can we insert MP3 songs inside iTunes library programatically -

i want add downloaded songs form cloud itunes library can able access songs outside application. possible add downloaded song in itunes library list. please suggest way access itunes library songs in iphone application. appreciate tutorial or link. thanks in advanced.

osx - "Save As" does not work for my NSPersistentDocument application -

i have os x application uses subclass of nspersistentdocument store data. core data persistent store type sqlite. relying on standard menu commands created when create new project document-based application core data in xcode. this application exists 2 years , evolving. today discovered "save as" not work in newest version. behavior follows: i create new document , enter data. i save document, close it, re-open it. fine. select "save as", choose new name , location file. gets renamed , can enter more data. i save document, close it, re-open , empty. when open original document, changes should in saved-as document there. the application not crash or produce errors. i pretty sure once worked correctly. tried first "official" version of program, , behavior same (wrong). edit: created new xcode project of same type, 1 core data entity. behavior same. difference application new project automatically used new "duplicate" menu comman

java - i was building my project using ANT ,but my build failed , i have tried debugging but no results -

following build out put , have tried every thing downloading compieresecuredefault.properties internet , paste in directory mentioned in output doesn't work . suggestions? buildfile: c:\users\public\compiere\compiere\utils_dev\build.xml init: [echo] =========== build compiere - ${env.encoding} [echo] java.home = d:\programsandfiles\java\jre6 [echo] java version = 1.6.0_45 sun microsystems inc. [exec] execute failed: java.io.ioexception: cannot run program "svnversion" (in directory "c:\users\public\compiere\compiere"): createprocess error=2, system cannot find file specified [echo] =========== svn revision core = ${svnoutput} build: toolsinit: [echo] =========== build tools ${env.compiere_version} toolscompile: toolsserver: toolsclient: toolsappsserver: toolsdatabase: toolsdistribution: init: [echo] =========== build common makedir: compile: dist: initad: [echo] =========== build ad comp

php - Need Json in the given form -

i want json in given form web sercie: "header":{ "code":"0", "message":"success" }, "body":{ "questions":{ "1":"who microsoft ceo", "2":"oop stands for?" }, "answers":[ "question 1":[ "bill gates", "nelson mandela", "nsteve jobs", "robert andrew",] "question 2":[ "object oriented program", "object oriented programing", "object oriented proffesion", "object oriented prefix" ] } } i getting "header":{ "code":"0", "message":"success" }, "body":{ "questions&qu

c# - Creating a new row in empty datatable and get correct next OID -

i know seems simple doesn't seem work. have table in msaccess database empty did have records @ point, when datatable.newrow returns new row objectid field 0 (autoincerement field). after commit new row database has objectid 84 (or whaterver think next number should be) need have correct objectid value before commit because used in join table. if have @ least 1 record on datatable , datatable.newrow, objectid new row correct 84. here code i'm using datatable: string ssql = "select * <tablename>" idbdataadapter dbadapter = getdataadapter(ssql); dbadapter.missingschemaaction = missingschemaaction.addwithkey; if (dbconnection.state == connectionstate.closed) dbconnection.open(); try { dataadapterfill(dbadapter, dataset, stablename); } catch (oledbexception oledbex)

windows - Setting and using an environment variable in the same command -

i using windows 7 , want set environment variable , use in same command. specifically, want execute following 2 commands simultaneously single command-: set mypath="c:\program files (x86)\microsoft visual studio 11.0" %mypath%\vc\vcvarsall.bat in other words, want windows version of this . i've tried far -: set mypath="c:\program files (x86)\microsoft visual studio 11.0" && cmd.exe /c "%mypath%\vc\vcvarsall.bat" but isn't working. so, there way of doing in windows ? this can done writing -: cmd.exe /x /v:on /c "set mypath="c:\program files (x86)\microsoft visual studio 11.0\vc\varsall.bat" && !mypath!" source

javascript - Angular Directives Template variables based on attributes -

i have directive generates box div. /template/boxes.html <box index=0></box> <box index=1></box> /box.js app.controller('boxcontroller', ['$scope', function ($scope) { $scope.boxindex = false; }]); app.directive('box', function () { return { restrict: 'e', templateurl: '/partials/_box.html', link: function (scope, element, attrs) { scope.boxindex = attrs.index; } } }); /partials/_box.html <div class="box{{boxindex}}"></div> i'm getting output <div class="box1"></div> <div class="box1"></div> instead of <div class="box0"></div> <div class="box1"></div> is there else should doing make both instances separate? your directives both sharing parent controller's scope , therefore accessing same value. since you're using interpolation, b

activerecord - Rails 4 - Displaying items from database tables -

i have following models , associations: #models class order < activerecord::base has_many :order_items has_many :items, :through => :order_items accepts_nested_attributes_for :items, :order_items, :allow_destroy => true end class item < activerecord::base has_many :order_items has_many :orders, :through => :order_items end class orderitem < activerecord::base belongs_to :item belongs_to :order end i want display item.name , order_item.quantity , order_item.price in 1 table attempted below: <tbody> <% @order.items.each |item| %> <<<<<<<< need call item.name <% @order.order_items.each |order_item| %> <<<<<<< need call other fields <tr> <td><%= item.name %></td> <td><%= order_item.quantity %></td> <td><%= order_item.price %></td> </tr> <

c++ - Is this the right way to initialize a pointer? -

is right way use function writes pointer? have allocate memory double* before calling function? double *mydouble; write_to_pointer( mydouble ); you can make pointers point data in variety of ways. the following create single double on heap, , pointed mydub . assign value of mydub 4. delete mydub , set pointer null . double * mydub = new double; *mydub = 4; delete mydub; mydub = null; you can allocate arrays. double * mydub = new double[123]; mydub[0] = 4; mydub[3] = 43; delete[] mydub; mydub = null; and can have pointers point variables exist. (note don't call delete in case!) double onstack = 4; double * mydub = &onstack;

javascript - Spawn child process escaping the quotes -

i'm trying add arguments require string quoted, spawn escaping them. code follows: var printproc = spawn('rawprintserver.exe', ['standalone', '"rawprinter"'], { detached: true, stdio: ['ignore', out, err] }); when check task manager, can see has spawned as rawprintserver.exe standalone "\"rawprinter\"" whereas need rawprintserver.exe standalone "rawprinter" windowsverbatimarguments var printproc = spawn('rawprintserver.exe', ['standalone', '"rawprinter"'], { detached: true, stdio: ['ignore', out, err], windowsverbatimarguments: true }); found mentioned on bug ( quotes not handled correctly when child_process.spawn() parses args ) don't think it's documented.

python - showing image in templates using django -

i new django. project folder contain media folder. contain images. how can display images in template of app? path : mysite/media/blog/templates/blog/details.html details.html {{<img src="media/image_2.jpg">}} but not display anything.. you should set-up static folder , configure media files. the full reference: https://docs.djangoproject.com/en/dev/howto/static-files/ , https://docs.djangoproject.com/en/1.4/howto/static-files/ . however should use (once configured static files) : <img src="{% static "media/myexample.jpg" %}"/> edit: before using static tag, must load specific tags incluing on top of template code: {% load staticfiles %} : referring static files in templates

javascript - Checking if local files are available -

<script> var test; function gameexists() { var http = new xmlhttprequest(); http.open('head', "/flappy.html", false); http.send(); if(http.status!=404){ test= "true"; }else{ test == "false"; } } </script> <script> if(test=="true") { alert('game exists, add code.'); } else { alert('download game !'); $('#frame').append('<a href="path/to/flappy.html">download</a>');} </script> this javascript, check if local file available. being hosted locally can not use server side languages. not sure have done wrong. please me, make work. a) doesn't check correctly b) doesn't download . thank :) not sure why code not working, please me out! doing wrong? couple of issues: 1) you're trying access /flappy.html , on local machine, not want - it's literally root of machine. you'

python - Py-StackExchange raise a valueError -

i try use stackexchange api , found py-stackexchange library python. installed through easy_install in windows. here code: from stackexchange import site, stackoverflow = site(stackoverflow) my_favourite_guy = so.user(2309097) print my_favourite_guy.reputation.format() print len(my_favourite_guy.answers), 'answers' and here error: traceback (most recent call last): file "c:\users\tasos\desktop\test - copy.py", line 8, in <module> my_favourite_guy = so.user(2309097) file "build\bdist.win-amd64\egg\stackexchange\__init__.py", line 626, in user u, = self.users((nid,), **kw) file "build\bdist.win-amd64\egg\stackexchange\__init__.py", line 631, in users return self._get(user, ids, 'users', kw) file "build\bdist.win-amd64\egg\stackexchange\__init__.py", line 621, in _get return self.build(root, typ, coll, kw) file "build\bdist.win-amd64\egg\stackexchange\__init__.py", line 598, in b