Posts

Showing posts from June, 2010

How to avoid Rails scaffold to place model into namespace -

How to avoid Rails scaffold to place model into namespace - rails 3 scaffold generator places model classes within namespace. example: rails generate scaffold admin/portfolio but want controllers , views placed within admin namespace. how can avoid that? regards, alexey zakharov. rails generate model portfolio rails generate controller admin::portfolios ruby-on-rails ruby-on-rails-3 scaffolding

What is best way to catch errors and exceptions in error.log file in Zend Application? -

What is best way to catch errors and exceptions in error.log file in Zend Application? - i want implement errorlogger in zend application. have created logger using debugging can tell me best way log errors more readable in file. i have seen sugarcrm logger logs error in proper format. have created logger this. can save time. in advance. well there zend_log wich create loging errors zend easy pie. here tutorial found. exception zend-framework error-handling sugarcrm

PHP, JSON, and MySQL -

PHP, JSON, and MySQL - what easiest way retrieve info database, , convert info json string? there kind of helper class? or supposed loop through columns in dataset create json string? sample code great you can utilize json_encode function convert native php array or stdclass object it's corresponding json representation: $result = $db->query('some query'); $set = array(); if($result->num_rows) { while($row = $result->fetch_array()) { $set[] = $row; } } echo json_encode($set); php mysql json

c# - How to remove less concentrated pixels and leave the most dense part -

c# - How to remove less concentrated pixels and leave the most dense part - i know title not create much sense here situation i'm working on computer vision algorithm , end working algorithm way expensive , no matter how big threshold add together there noise (that less concentrated lime green). all need end concentrated pixels , @ point need clever thought save processing. no don't need code, thought me going. i think usual approach there pick random greenish pixel , start walking around, counting how many greenish pixels create continuous area. if number of pixels, can to, less %\theta%, pixel , neighbors 'noise' , should discarded. maybe easier way might work well: can apply gaussian filter first in order smooth greed pixels downwards , utilize threshold delete pixels below %\theta%. point that, if pick right sigma gaussian filter kernel, single pixels diluted down, groups of pixels have higher intensity. please comment, if confusing. ...

animation - Custom shape (spiral) animated buttons in JavaScript -

animation - Custom shape (spiral) animated buttons in JavaScript - how go generating buttons of custom shape? specifically i'm trying generate similar spiral: (for curious, represents 88 keys on piano). i'm thinking mathematically create set of "perimeter path" points each button -- easy enough. what i'm not sure whether can create svg polygon click-able, or whether need mathematically process click figure out button landed closest to. the buttons coloured. when button pressed need appear bigger , brighter, gradually shrink original size , colour. edit: upload findings , tidy , break answer. add onclick , onmouseover canvas element https://developer.mozilla.org/en-us/docs/web/api/canvas_api/tutorial/drawing_shapes http://www.rgraph.net/blog/2012/october/new-html5-canvas-features.html http://www.rgraph.net/blog/2014/march/an-example-of-html5-canvas-path2d-objects.html -> https://hacks.mozilla.org/2015/01/canvas-2d-new-docs-path2d-hit-region...

java - How to solve the exception throwed by web service? -

java - How to solve the exception throwed by web service? - i encoutered problem when invoking web service simple java client; , want answers! here exception throwed client: exception in thread "main" java.io.ioexception: server returned http response code: 500 url: http://localhost:1010/helloworld @ sun.net.www.protocol.http.httpurlconnection.getinputstream(unknown source) @ org.warnier.zhang.demo.tests.main(tests.java:40) here exception throwed server: javax.xml.ws.webserviceexception: javax.xml.stream.xmlstreamexception: java.io.ioexception: 远程主机强迫关闭了一个现有的连接。(translation: connection forcibly closed remote host) @ com.sun.xml.internal.ws.encoding.streamsoapcodec.encode(unknown source) @ com.sun.xml.internal.ws.encoding.soapbindingcodec.encode(unknown source) @ com.sun.xml.internal.ws.transport.http.httpadapter.encodepacket(unknown source) @ com.sun.xml.internal.ws.transport.http.httpadapter.access$100(unknown source) @ com.sun.xml...

javascript - Adding events on dynamically created tags -

javascript - Adding events on dynamically created tags - i'm creating divs in script class name in loop. want add together onclick event every div , innerhtml clicking on them. every click lastly div's innerhtml. here's code : class="snippet-code-js lang-js prettyprint-override"> for(var i=0;i<10;i++) { var itemrow = document.createelement("div"); itemrow.innerhtml = i; itemrow.onclick = function(){ homecoming function(){ console.log(itemrow.innerhtml); //which returns lastly div innerhtml }(); } } much this mutual issue loop , event callbacks. trying access variable within function updated loop. that's why seeing lastly div innerhtml always. alter code to for(var i=0;i<10;i++) { var itemrow = document.createelement("div"); itemrow.innerhtml = i; itemrow.onclick = getclickhandler(itemrow); } function getclickhandler(itemrow){ ...

html - Improving responsiveness of table -

html - Improving responsiveness of table - i'm looking improve responsiveness of page based on 2 layouts i've created. below query breakpoints: @media screen , (max-width : 768px), screen , (min-width: 768px) , (max-width: 1024px) { } my problem right issue i'm having when resize browser between widths of 1024 , 1224 particularly @ ensure calendar table .. i've explained self in farther details below. for calendar table effort re-sizing browser width 1180px or below value (inspect element on chrome tells browser width) .. notice calendar goes below vertical menu bar .. @ width size don't want happen .. have calendar cells cut down in size any ideas appreciated. here's demo: class="snippet-code-css lang-css prettyprint-override"> /* total width styling */ * { margin: 0; border: 0; padding: 0; } body { background: #f5f5f5; color: #363636; margin: 0; font-family: "helvetica neue", a...

MySQL sorting group-by results -

MySQL sorting group-by results - i have next tables structure: table_1 id title ------------ 155 item1 156 item2 157 item3 table_2 id model ------------ 155 100 156 100 157 200 table_3 id cid ------------ 155 5 156 5 157 5 i want grouping results model (from table_2) and create sure returns highest id (order id descending). i have tried following, order by clause doesn't seem work: select a.id, b.model table_1 inner bring together table_2 b on b.id = a.id inner bring together table_3 c on c.id = a.id c.cid = 5 grouping b.model order a.id desc what doing wrong? select max(a.id), b.model table_1 inner bring together table_2 b on b.id = a.id inner bring together table_3 c on c.id = a.id c.cid = 5 grouping b.model order max(a.id) desc demo here: http://sqlfiddle.com/#!9/afb0b/2 the reason works while initial effort did not, field not nowadays in group by clause, or not used in aggregate fu...

.net - Share send byte[] buffer among multiple SocketAsyncEventArgs -

.net - Share send byte[] buffer among multiple SocketAsyncEventArgs - in scenario send same info many clients, i.e. in scenario should (and in future will) switch using (e.g. pgm) multicast, would thread-safe utilize the same byte[] array instance on multiple socketasynceventargs , hand them multiple sockets via sendasync sent concurrently? after all, sendasync should only read buffer, sharing instance shouldn't issue. guess enable reuse of buffer afterwards, i' d have reference counting , there may other issues tackle, question first , foremost thread safety. .net multithreading sockets socketasynceventargs

sockets - How to upload an Arduino source code to a Lilypad Arduino? -

sockets - How to upload an Arduino source code to a Lilypad Arduino? - i bought lilypad arduino , ftdi socket required connect pc. first socket tried on didn't powerfulness arduino, because of hardware damage. thus, got socket, 4 female pins (vcc, gnd, tx, rx), unlike previous 1 had 6 male pins. let's phone call sec socket x. x, lilypad getting powered through usb cable. then, when tried upload source code first time, started working. when uploaded time later, error called 'programmer not responding' occurs always, i'm unable resolve. what should do? to programme arduino (and arduino-compatibles), need ftdi adapter has rts pin, vcc, gnd, tx, , rx pins. the rts pin connected reset circuit on arduino, putting bootloader programming mode few seconds. you may able work resetting lilypad it's reset button, upload sketch within few seconds after reset. alternatively, or to the lowest degree hassle, ftdi adapter needed signals. recommend adafr...

c# - How do I store Excel File without getting the warning -

c# - How do I store Excel File without getting the warning - i trying replace file gives me warning: the file exists. want replace file in code, not want warning code: string fromfile = @"\\test.net\excel\123.xls"; string tofile = @"\\test.net\excel\123.xls"; microsoft.office.interop.excel.application app = new microsoft.office.interop.excel.application(); microsoft.office.interop.excel.workbook wb = app.workbooks.open(fromfile, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing); file.delete(tofile); wb.saveas(tofile, microsoft.office.interop.excel.xlfileformat.xlworkbookdefault, type.missing, type.missing, false, false, microsoft.office.interop.excel.xlsaveasaccessmode.xlexclusive, microsoft.office.interop.excel.xlsaveconflictresolution.xllocalsessionchanges, false, type.missing...

oracle - Implement One-to-One Relationship in SQL without sharing PKs? -

oracle - Implement One-to-One Relationship in SQL without sharing PKs? - i want define one-to-one relationship between 2 tables in database, let's person , address. create table person ( pid int primary key, name varchar(20), occupation varchar(20)); create table address ( street varchar(30) primary key, city varchar(10), state varchar(2), zip varchar(5)); i want link these two, each person has 1 address, , each address has 1 person living there (it simplified example). most solutions have found recommend having 2 tables share primary key, or changing pk of address fk referencing pk of person. don't want though, because still want both street , pid unique on own. how go approaching this? you'd have unique key on person, primary key, , primary key of address reference that. sql oracle

java - StaleElementReferenceException even when I use `FluentWait` -

java - StaleElementReferenceException even when I use `FluentWait<>` - i run web e2e tests (using cucumber, junit, selenium webdriver) on ubunto. my test fails sporadically when using remotewebdriver (never fails local-webdriver) then banner image in preview html should "p_1047_o_9075_banner_1423040308.png" failure org.openqa.selenium.staleelementreferenceexception: stale element reference: element not attached page document i thought have bypassed exception when refactored code this: public string getsrcafterwait(final by) { webelement webelement = getelementafterwaitfordisplay2(by); string currentsrc = null; if (webelement != null) { currentsrc = webelement.getattribute("src"); } homecoming currentsrc; } public webelement getelementafterwaitfordisplay2(final by) { wait<webdriver> wait = new fluentwait<>(driver) .withtimeout(30, timeunit.seco...

malloc - c++ segmentation fault in string assignment -

malloc - c++ segmentation fault in string assignment - need help understand how assignment of strings below causing segmentation fault in process. note random , same data-set giving core dump , other times not. failure observed while processing multiple files. while processing single file there no failure. process flow - read input file(some format) - process per record - prepare output file (new format) i verified input info beingness processed code fine - instances fails. hence looks allocation/assignment in code causing core dump (segmentation fault) please suggest. thanks. code shown below: class recordholder { public: recordholder(); ~recordholder(){} bool init(); void setrecordtype(char i_recordtype) { m_recordtype = i_recordtype; } **void setsomeid(string i_someid) { m_someid = i_someid.c_str(); }** private: char m_recordtype; string m_someid; }; bool recordholder::init() { m_recordtype = null; m_someid = ...

sql server - Insert/Update Triggers -

sql server - Insert/Update Triggers - i have 2 triggers (insert , update) create trigger my_inserttrigger after insert on `table` each row begin update previous record if found end // create trigger my_updatetrigger after update on `table` each row begin ..... end // according understanding triggers cannot fire programmatically/manually, fires when insert/update/delete happens on table. so question in case mentioned above, insert trigger(my_inserttrigger) invoke update trigger (my_updatetrigger)? thanks in advance. when changed trigger syntax sql server (with inserting 1 row) 1 trigger causes update on table kick off update trigger on table (if exists). i have seen on audit tables , 2 things can, , will, happen: 1) performance suffer. 2) if audit triggers start kicking each other off (by having cross trggers) can run out of stack space (the triggers can nest 32 levels down). sql-server database trigger...

php - In HTML, how can I make a button that reverse sorts a massive -

php - In HTML, how can I make a button that reverse sorts a massive - in html, how can create button reverse sorts massive.. $m = explode($s) form_method="post" i assume mean client-side, not html. if so, utilize array.sort() . http://www.javascriptkit.com/javatutors/arraysort.shtml "massive" relative term, have tested array.sort complex object sorts arrays containing couple one thousand items no issues. simplified, looks this. <input type="button" onclick="performsort()" /> <script> function performsort() { var arr = []; // populate 'arr' items sort arr.sort(); // output sorted results dom } </script> php html

How Parsing string between [STX] and [ETX] using C# - Split/Append output using Regex or String Functions -

How Parsing string between [STX] and [ETX] using C# - Split/Append output using Regex or String Functions - language = c#.net anything between [stx] , [etx] must accepted rest of things must rejected. string startparam = "[stx]"; string endparam = "[etx]"; string str1 = "[stx]some string 1[etx]"; //option 1 string str2 = "sajksajsk [stx]some string 2 [etx] saksla"; //option 2 string str3 = "[etx] dksldkls [stx]some string 3 [etx]ds ds"; //option 3 string str4 = "dksldkls [stx]some string 4.1[etx]ds ds [stx] string 4.2[etx] jdskjd"; //option 4 /* various strings can appended , converted single string using string builder or treat them different strings*/ processstring (string str , string startparam , string endparam) { //what write here using regex or string functions in c# } /* output after passing these processstring () */ /* append output textbox or append string using loop.*/ /* output required...

c# - Passing a Parameter to ViewModel constructor -

c# - Passing a Parameter to ViewModel constructor - is possible pass parameter viewmodel constructor? utilize parameter initialise property and/or other operations in viewmodel. with winforms do public myform(myparamtype myparam) { myformproperty = myparam; //etc. } how go doing similar in mvvm pattern / using mvvm light? any suggestions welcome. in advance. i recommend using ioc container , configuring container supply parameter upon construction. for instance, here's typical code-behind usercontrol looks me in wpf: public partial class mydatagridview : imylistview { public mydatagridview() { initializecomponent(); } public mydatagridview(mylistviewmodel viewmodel) { initializecomponent(); datacontext = viewmodel; } } structuremap creates mylistviewmodel me because default searches greediest constructor , provides dependencies. in structuremap configuration, can specify mylistviewmodel provided whatev...

html - CSS positioning with IE8 - expressions not supported -

html - CSS positioning with IE8 - expressions not supported - i have next code: <html> <head> <style type="text/css"> div#left { z-index: 100; position:absolute; left:0px; top:0px; width: 100px; height: 100px; background-color: #e7e7e7; } div#right { z-index: 100; position:absolute; left:100px; top:0px; width: 100px; height: 100px; background-color: #e20074; } </style> </head> <body> <div id="left"> 1 </div> <div id="right"> 2 </div> </body> </html> but need right div section expanded end of page (width=100%) here how changed width div#right: width: expression(parseint(document.body.offsetwidth)-100); unfortunately, doesn't work ie more! ie8 , firefox ignore expressions. how can overcome issue? many in advance! you shouldn't utilize css expressions - they're slow, old, , importantly, proprietary, meaning won't work on other ie. here's...

How to use decorator to replace $resource object AngularJS -

How to use decorator to replace $resource object AngularJS - i'm using decorator $resource service create base of operations url alter whenever route of application changes. the route setup in way: .state('root', { url: '/{shop_id:[0-9]{0,4}}', abstract: true, params: { shop_id: {squash: true} }, template: '<div ui-view></div>' } ) .state('products', { url: '/products', template: 'products.html' } ) this means can go shop 1 shop 2 using next urls: http://dom.net/1/products // shop 1 http://dom.net/2/products // shop 2 accordingly, base of operations url of $resource should reflect of route define shop it's accessing: http://api.net/1/products // products shop 1 http://api.net/2/products // products shop 2 i using next decorator replace resource function each time shop_id in route chan...

PayPal integration for android crowdfunding app -

PayPal integration for android crowdfunding app - i designing crowdfunding android application. in this, users should able donate money cause wish for. how can create page this? page should prompt user amount he/she wants donate. app owner gets cutting donation. new android, please forgive me if i'm asking much you have import paypal sdk , create appropriate calls .more can found here. also, paypal approve/disapprove request activate , integrate sdk on app. before going forwards above link, business model approved them. don't loose heart if disapproved, there many other gateways, if app 1 , cause. android paypal donations

android - Position of view changes in on drag listner -

android - Position of view changes in on drag listner - i placing views on parent layout. want drag entire view on long click of l1. when long click on l1, view enters in dragging mode changes position of touch center of view (x,y). want drag view holding upper bar of layout(l1). view: ______________ |______l1______| | | y | l2 | | | |______________| x @override public boolean ondrag(view v, dragevent event) { // handles each of expected events switch (event.getaction()) { //signal start of drag , drop operation. case dragevent.action_drag_started: // nil break; //the drag point has entered bounding box of view case dragevent.action_drag_entered: v.setbackground(targetshape); //change shape of view break; //the user has moved drag shadow outside bounding box of view case dragevent.action...

asteriskami - Asterisk Originate Some noooob Questions ^_^' -

asteriskami - Asterisk Originate Some noooob Questions ^_^' - its couple of day i'm working on asterisk, developing application phone call tracking & monitoring , etc ...(asterisk.net lib) i want tell extension(phone) on desk phone call number when press button in application. well i've done googling originate action: originate actionid: 1234 channel: **??*** callerid: **??** context: from-internal exten: [targetphoneno] priority: 1 async: true timeout: 30000 variable: logedinuserid:113 well don't know how gonna work. otl 1st : extension info (phone on desk) cahnnel : source channel or destination channel how can channel state if 1 them busy or whatever ?(e.g dahdi/101 busy ) callerid : optional can set whatever want there ? context : have set or asterisk gonna process it ..............[edit]................ thx ur reply ^_^ in case asterisk worked way : when want create internal phone call sip sip phone call sip registered use...

c++ - Constructor/Destructor function not being called while calling by value or reference. Any way around it? -

c++ - Constructor/Destructor function not being called while calling by value or reference. Any way around it? - i'm having problem because of feature of c++. after working dynamic memory allocation, clear heap(free store) because of obvious reasons. destructor function. , sometime, allocate memory using constructor. after calling object function(call value), destructor works. know it's feature in many cases. but, annoying while working lot of stand-alone functions. way around it,guys? or, should utilize fellow member function allocate , clear memory? an example: #include <iostream> using namespace std; class test{ int *a; public: test(int x) {a=new int; *a=x;} int geta(){return *a;} ~test(){delete a;} }; int apow2(test t) { homecoming ((t.geta())*(t.geta())); } int main() { test tst(10); cout<<"\na^2="<<apow2(tst); //at point, memory reference 'a' doesn't exist cout<<"\n"<<tst.geta();...

How to reinstall shortcut icons when during repair and change mode with WiX installer 3.7 -

How to reinstall shortcut icons when during repair and change mode with WiX installer 3.7 - i new wix installer , have been trying re-install shortcut icons on desktop etc in "change" , "repair" mode not working. works in installation mode. please help me resolve issue? following code been used: <directoryref id="applicationprogramsfolder"> <component id="applicationshortcuts" guid="{964eea43fa8a}"> <shortcut id="applicationstartmenushortcut" name="$(var.shortcuttext)" advertise="yes" description="$(var.shortcutcomment)" target="[productdir]$(var.shortcuttarget)" workingdirectory="productdir" icon="aa.exe" /> <?if $(var.aa) != "true" ?> <shortcut id="applicationdesktopshortcut" directory="desktopfolder" name="$(var.shortcuttext)" target="[productdir]$(v...

Twilio call forwarding for specific time of day -

Twilio call forwarding for specific time of day - with twilio i'd implement service sends inbound calls voice recording during specific times of day. can twilio provide behavior? twilio developer evangelist here. can absolutely that! i'm not sure language or framework you're using, here's thought of how you'd accomplish this. when twilio receives phone call on twilio number makes webhook request server respond , tell call. instructions built in xml (twiml). so, time based stuff want (my illustration in ruby using sinatra web framework): post '/call' time = time.now content_type 'text/xml' response = "<response>" if out_of_hours?(time) response = "<say>please leave message</say><record />" else response = "<dial><number>your_phone_number</number></dial>" end response = "</response>" response end you can define ...

asp.net mvc 5 - Azure Website with background task using WebClient to call controller/action on same website gets 403 -

asp.net mvc 5 - Azure Website with background task using WebClient to call controller/action on same website gets 403 - i have background tasks run on asp.net mvc ecommerce website. 1 uses webclient phone call controller/action html shipping email notification. i shifting website windows server, azure hosted website, or azure web app. web app using standard mode. the problem is, on azure 403 error whenever seek , phone call client.uploadvalues in code sample below: using (cookieawarewebclient client = new cookieawarewebclient()) { //authenticate var logincredentials = new namevaluecollection { [credentials here] }; //perform authentication - after has been performed //the cookie stored within web client client.uploadvalues(loginuri, "post", logincredentials); .... } this code worked fine on standard windows server. if seek changing phone call uploadvalues standard downloadstring of home page (that requires no authentication) ...

javascript - Content loaded through JS not loading in IE9 unless the console is open -

javascript - Content loaded through JS not loading in IE9 unless the console is open - ok, have never seen before. have site loading in content using javascript. works in chrome, opera, firefox, safari , ie 10. place not work ie9. fine except load in ie9 if console open or if open console while on page. does have thoughts issue? have included code bellow. if($("#event-container").doesexist()){ var prop = jquery('#prop').val(); var num = jquery('#num').val(); var current = jquery('#current').val(); var url = "/example/eventspull?prop="+prop+"&num="+num+"&current="+current; console.log(url); $.get("https://example.com" + url, function(data) { console.log(data); info = $.parsejson(data); if (data.length > 0) { $("#event-container").append(data); } }); } javascript ajax internet-explorer

winforms - C# - Possible to safely have an owned form in a separate thread? -

winforms - C# - Possible to safely have an owned form in a separate thread? - i attempting write specialized onscreen keyboard (osk) application i'm writing in c#. facilitate this, i've created form has several buttons on representing keys, , clicking them calls sendkeys , sends out appropriate keys. this form owned main window shown when application first starts, using owner property. way, osk pops whenever user focuses application, , stays on top of main window if said main window dragged on it. this works great, because have modal dialogs want utilize osk, attempted create in separate thread, finish own message loop (via application.run ) still usable modal dialogs in main thread. the problem that, obviously, beingness in separate thread can cause invalidoperationexception s because of cross-threaded calls. 1 specific illustration of when calling application.run(osk) new thread, cross thread error occurs because attempting update window's handle owner (...

java - Configure path for win and linux -

java - Configure path for win and linux - a standalone application windows , linux environment while utilize windows environment file scheme c:\file\abc\xyz\sample.txt in linux environment file scheme /home/qa/file/abc/xyz/sample.txt abc , xyz name of folders depends on user click. (abc country code folder) & (xyz language folders) to build path utilize properties base_path : /home/test/file/ or c:\test\file\ file_name : sample.txt in programme construction of path : string path = base_path+country_code+"/"+language_name+"/"+file_name ("/" linux) string path = base_path+country_code+"\"+language_name+"\"+file_name ( "\" windows) example linux: /home/test/file/spain/es/sample.txt example windows: c:\test\file\italy\it\sample.txt country_code , language_name differ each user click. every time while test application different environment im changing file separator "/...

Pulling files from a directory into the root folder for NPM -

Pulling files from a directory into the root folder for NPM - i publishing library npm. when build library, resulting artifact placed in dist folder located in root of project index.js . when users install npm index.js nowadays in root of folder created in node_modules folder. presently, remains in directory named dist . how can this? my packages.json: { "name": "my-package", "version": "0.0.9", "files": ["dist/*"], "main": "index.min.js", "private": false, "dependencies": {}, "devdependencies": {}, "repository": "git@github.com:username/my-package.git" } npm

java - How to cut text by length in pixels? -

java - How to cut text by length in pixels? - i have algorithmic problem: there 4 strings of text should placed in 1 line divided separator (i.e. |). width of whole line known(i.e. 500px). each string contains words of different length. want place first n-words (n depends length of each word): one four five sixty nine one hundred sixteen i 4 strings approximately equals length. , if 1 of strings smaller other must longer. i.e: one | 4 five... | 60 9 | 1 hundred. the number of initial string can less. in case number of words each string must bigger. i.e: four 5 six one hundred sixteen will be: four 5 6 | 1 hundred sixteen. is possible css or should utilize affinetransform java back-end? tried utilize approach takes lot of resources , time. go through each character , check if can added, widthof(char) returns width of character you'll have set width each character , store them. stringbuilder final = ""; int maxwidthpixel = 500; int curren...

What ways are there to work on a project in a testing environment where the Git commit needs to be different to the PHP code used for testing and dev? -

What ways are there to work on a project in a testing environment where the Git commit needs to be different to the PHP code used for testing and dev? - in project deployable version needs have re-create of each of external libs, different config file , install , setup files, security concerns, main project set reject run if present. upstream copies of other projects need committed repo. how can work on code running on localhost file layout , file contents dev , testing different need commit? background i working on project on hosted on github , main ide netbeans has imperfect git back upwards (good plenty >99% of needs). project in php , uses several other projects libraries. as netbeans not have best back upwards sub-repos have chosen maintain each additional project in separate project. fine central project looks @ config info find these outside libs. half answer my instinct suppose there need "build stage" prior committing github repo how on ear...

php - Retrieve data from a form with GET method using symfony2 -

php - Retrieve data from a form with GET method using symfony2 - i can't retrieve info form, tried differents ways no result. repository : public function buildform(formbuilderinterface $builder, array $options) { $builder->add('min_price', 'text', array('mapped' => false, 'label' => 'de la :', 'attr'=> array( 'placeholder'=>'pretul minim', 'class'=>'form-control'))) ->add('max_price', 'text', array('mapped' => false, 'label' => 'pina la :' , 'attr'=> array( 'placeholder'=>'pretul maxim', 'class'=>'form-control'))...

redirect - Redirecting to show after Excel Import -

redirect - Redirecting to show after Excel Import - i followed thisrailscasts tutorial in order allow importing of excel data. app able import data, however, want redirect 1 instance rather index page, , proving difficult. when have controller set redirect_to quotes_path , redirected quotes index without issue. however, when alter redirect_to @quote or redirect_to quote_path(@quote) redirect_to quotes_path(@quote) neither alternative works. when redirect processes, get: actioncontroller::urlgenerationerror (no route matches {:action=>"show", :controller=>"quotes", :id=>nil} missing required keys: [:id]): app/controllers/quotes_controller.rb:10:in `import' here quotes_controller: class quotescontroller < applicationcontroller before_action :set_quote, only: [:show, :edit, :update, :destroy] def import employee.import(params[:file]) # redirect_to @quote, notice: "census imported." redirect_t...

eclipse - Repeated column in mapping for entity exception when trying to use same embeddable twise -

eclipse - Repeated column in mapping for entity exception when trying to use same embeddable twise - i have entity schoolgallerypic has 2 embedded attributes of type blobfield. on execution getting error saying "repeated column mapping". using eclipse , hibernate 4.3.8. entity: @entity public class schoolgallerypic implements java.io.serializable { @id @generatedvalue(strategy=generationtype.sequence) private long schoolgallerypicid; @embedded @column(nullable=false) private blobfield pic; @embedded @column(nullable=false) private blobfield thumbnail; @manytoone @joincolumn(name="schoolgalleryalbumid", referencedcolumnname="schoolgalleryalbumid",nullable=false) private schoolgalleryalbum schoolgalleryalbum; @column(nullable=true) private integer sortorder; @embedded @column(nullable=false) private audittrail audittrail; private static final long serialversionuid = 1l; public schoolgallerypic() { super(); } public long getschoolgaller...

Does in Rails making a column unique at a db level require it to become an index -

Does in Rails making a column unique at a db level require it to become an index - if want create table column unique @ database level, require column become index? i have column called username want unique not require index (logging in done based on email address, index). so @ model level have added: validates :username, presence: true, length: { maximum: 15 }, uniqueness: { case_sensitive: false } but should within migration file? understand can add together migration file: add_index :users, :username, unique: true but create username index, don't need (and assume create app slower). i using sqlite development (following hartl's tutorial adapting instructions own app). create unique requires index, wanted sure. expect because on http://api.rubyonrails.org/classes/activerecord/migration.html 'unique' nowadays add_index method. that way create column unique in database, create unique index...

powershell - how to look at each registry key and run install file? -

powershell - how to look at each registry key and run install file? - i trying list of registry key's , based on keys install files languages need run. so, key looking @ hklm:\system\currentcontrolset\control\mui\uilanguages , can languages installed. however, lost how run install files based on each key value found. tried below first cause returns each language on single line - cannot proceed want code @ first language , set case against possibly. so - if en-us installed run specific language installer file. then (as server have multiple languages installed) if es-es found run installer , go on until registry keys done. the below have far: $langinstalled = get-childitem -path hklm:\system\currentcontrolset\control\mui\uilanguages | select -expandproperty pschildname $langinstalled | foreach-object { write-host "languages installed $langinstalled" } here output of above server has multiple languages installed - there 7 languages installed displays in...

php - Laravel Chumper Datatable getting data into one datatable from multiple MySQL tables -

php - Laravel Chumper Datatable getting data into one datatable from multiple MySQL tables - i trying create datatable, contains info more 1 mysql table. i using chumper using laravel, far can see there no examples using more 1 sql table @ 1 time. here code: <?php class crudcontroller extends basecontroller { public function instances(){ $query = ec2instance::select('instance_id', 'public_dns_name', 'key_name', 'instance_type', 'launch_time' )->get(); $c_num= account::select('aws_account_id' )->get(); $t_name= tag::select('value' )->get(); homecoming datatable::collection($query, $c_num, $t_name) ->addcolumn('instance_id', function($model){ homecoming $model->instance_id ; }) ->addcolumn('public_dns_name', f...

ios - UIGraphicsBeginContext, UIGraphicsEndImageContext in Cocoa? -

ios - UIGraphicsBeginContext, UIGraphicsEndImageContext in Cocoa? - i'm porting bits of ios app osx , have code creates nsimage @ runtime. i'm having problem converting cocoa osx. help cocoa equivalents of uigraphicsbeginimagecontext, uigraphicsgetimagefromcurrentimagecontext , uigraphicsendimagecontext? - (uiimage *)progressimage:(double)progress size: size { cgfloat height = size.height; cgfloat width = size.width; uigraphicsbeginimagecontext(cgsizemake(width, height)); cgcontextref context = uigraphicsgetcurrentcontext(); // grayness background cgcontextsetrgbfillcolor(context, 102.0 / 255.0, 102.0 / 255.0, 102.0 / 255.0, 1.0); cgcontextfillrect(context, cgrectmake(0.0, 0.0, width, height)); // orange progress cgcontextsetrgbfillcolor(context, 241.0 / 255.0, 89.0 / 255.0, 42.0 / 255.0, 1.0); cgcontextfillrect(context, cgrectmake(0.0, 0.0, width * (cgfloat) progress, height)); uiimage *resultingimage = uigraphicsgetima...

unicode - Encoding problem downloading HTML using mechanize and Python 2.6 -

unicode - Encoding problem downloading HTML using mechanize and Python 2.6 - browser = mechanize.browser() page = browser.open(url) html = page.get_data() print html it shows unusual characters. suppose utf-8 string python doesn't know , cannot show properly. how can convert string unicode string like u = u'test' it gzipped def ungzipresponse(r,b): headers = r.info() if headers['content-encoding']=='gzip': import gzip gz = gzip.gzipfile(fileobj=r, mode='rb') html = gz.read() gz.close() headers["content-type"] = "text/html; charset=utf-8" r.set_data( html ) b.set_response(r) response = browser.open(url) ungzipresponse(response, browser) html = response.read() python unicode encoding utf-8 mechanize

Regex to match tag contents while simultaneously omitting leading and trailing whitespace -

Regex to match tag contents while simultaneously omitting leading and trailing whitespace - i trying write regex matches entire contents of tag, minus leading or trailing whitespace. here boiled-down illustration of input: <tag > text </tag > i want next matched (note how whitespace before , after match has been trimmed): "text" i trying utilize regex in .net (powershell): (?<=<tag>(\s)*).*?(?=(\s)*</tag>) however, regex matches "text" plus leading whitespace within of tag, undesired. how can prepare regex work expected? drop lookarounds; create job more complicated needs be. instead, utilize capturing grouping pick out part want: <tag>\s*(.*?)\s*</tag> the part want available $matches[1] . regex whitespace lookbehind lookahead removing-whitespace

javascript - array with doms turns into variable if only a single exists -

javascript - array with doms turns into variable if only a single exists - so pretty basic jquery guess. var counters = $(".move-counter"); (var key in counters) { console.log(counters[key].text()); } the problem here is, if element class move-counter variable counters wont array, single element, making other .text() fail. can create sure turns array (in way other doing simple .length or of like)? use jquery's .each() method iterate on elements in collection. $(".move-counter").each(function() { console.log($(this).text()); }); javascript jquery