Posts

Showing posts from March, 2015

php - How to use "where not" in a Laravel Model Relationship? -

i have user table similar to: === users === id: int (pk) name: string is_coach: bool ... and coach request table similar to: === coach_requests === id: int (pk) student_id: int(fk => users.id) coach_id: int(fk => users.id) ... i have corresponding laravel models (i.e. user , coachrequest ). in user model, wish make method such given specified user, return users is_coach = true , except: him/herself , users have been matched person coach in coach_requests table. for example consider following sample data: users (1, "a", false) (2, "b", true) (3, "c", true) (4, "d", true) (5, "e", true) (6, "f", true) coach_requests (1, 2, 3) (2, 2, 4) (3, 3, 2) (4, 3, 6) (5, 4, 5) (6, 4, 6) (7, 5, 6) (8, 6, 5) (9, 1, 4) now if user with: id 1 (i.e. user "a"), return user ids: 2, 3, 5 , 6 id 2, return user ids: 5, 6 id 3, return user ids: 4, 5 id 4, return user ids: 2, 3 id 5, return user ...

c# - LINQ - Join 2 tables, Group by DateTime.Month , multiple Counts -

i'm pretty new c# , linq , i'm trying list of emails holds sum of emails, attachments , user's (the one's sent email). so current problem output of query false. number of email's equal number of attachment's obvious wrong. query: var monthquery = em in dbedoka.email join ema in dbedoka.email_attachment on em.id equals ema.email_id e e2 in e.defaultifempty() group e2 em.erstellt_am.month grouped select new entities.month { nameofmonth = grouped.firstordefault().erstellt_am.tostring(), numberofmails = grouped.distinct().count(m => m.email_id != null).tostring(), numberofattachments = grouped.count(a => a.id != null).tostring(), numberofusers = grouped.select(u => u.erstellt_von).distinct().count().tost...

audio - Python import sounddevice as sd (ImportError: No module name sounddevice) -

i have python code running on raspberry pi b++ uses sounddevice library lets play , record sounds python. have installed modules. can confirm through python command line , enter import sounddevice sd works without errors. have confirmed typing ('modules') in python command line , sounddevice module appears. when running code in independent python program importerror: no module name sounddevice appear. hope 1 can help. here included code: import sounddevice sd the error: importerror: no module name sounddevice hello after alot of trial , error final solved on pip install sounddevice --user . you need remove --user part command is: pip install sounddevice . installs through out entire system , works.

php - How to update the data in an array with a specific array key? -

i creating cart using session , 2d array problem want change content of 1 of array in 2d array , have order id make sure changes correct array, here's code please me; this code inserting new item: if(isset($_post['addtocart'])){ $count= count($_session['cart']); $newproduct= array( 'id' => $count, 'code' => $_session['code'], 'color' => $_post['color'], 'type' => $_post['type'], 'size' =>$_post['size'], 'quantity' => 1 ); $_session['cart'][]= $newproduct; } $_session['cart'] name of 2d array. here's sample list: $_session['cart']=> array([0] =>(array order=> 0, code=> 123, color=> blue, type=> us, size=> m. quantity => 1 ); ([1] =>(array order=> 1, code=> 125, color=> red, type=> uk, size=> s. quantity =...

java - How can I sum the product of two two-dimensional arrays? -

so got code 2 arrays: 1 array contains tickets sold 3 cinemas , other 1 contains adult , kid prices. code outputs total every cinema separately (3 lines of output) need total number of 3. instead of printing 828 cinema1, 644 cinema2, 1220 cinema3 , need print 2692 (total of 3 cinemas). how can sum 3 products loop? here's code: public class arrays { public arrays() {} public static void main(string[] args) { float[][] = new float[][] {{29, 149}, {59, 43}, {147, 11}}; float[] b = new float[] {8, 4}; string[] s = new string[] {"cinema 1", "cinema 2", "cinema 3"}; string[] t = new string[] {"adults", "children"}; int i,j; system.out.println("cinema complex revenue\n\n"); ( = 0 ; <= 2 ; i++ ) { ( j = 0 ; j < 1 ; j++ ) { system.out.println(s[i] + "\t$" + (a[i][j] * b[j] + a[i][j...

html - float right doesn't work -

Image
sorry basic question. i'm new in css , try work. have following markup: <div class="box-title"><p>element-betonbecken premium</p></div> <img src="img/page1/pool-top.png" class="pool-img" alt="" /> <div class="box-small-title-right"><p>elementtreppen</p></div> <div class="box-elementtreppen"></div> and have css markup: .box-title { background-color: rgba(255, 255, 255, 0.5); width: 900px !important; height: 67px; margin-top: 20px; font-weight: 600; line-height: 67px; } .box-title p { font-weight: 600; line-height: 67px; padding-left: 20px; } .box-small-title-right { background-color: rgba(255, 255, 255, 0.5); width: 460px; height: 40px; float: right; margin-top: 2px; } .box-small-title-right p { font-weight: 600; line-height: 40px; padding-left: 20px; } .box-small-title-left { opacity:...

nginx - Socket.Io under multinode cluster on loopback-pm -

i'm using process manager of strongloop called strong-pm cluster node instances, use last socket.io library websockets implementation, i saw exist node module call socket io store clusters to resolve problem using node's native cluster messaging, question module used under strong-pm resolve problem of clustering socket.io??, not how can resolve problem of cluster nodes using strong-pm , socket.io. actually make tests, using strong-pm , nginx, configure nginx connect socket.io clients server, when try broadcast event server clients event never sent, supouse need module between strong-pm , nginx manage sticky-sessions correctly. suspicious correct?? regards i resolve problem using socket.io redis adapter , force socket.io client use websockets protocol this: var socket = io({transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling', 'polling']});

php - Unable to UPDATE mysql table from a function, although successful query response -

i using phpmyadmin database. when button on html page clicked, following executed: var stopid = 10; // sample var stoppov = "129.29,158.58"; // sample $.ajax({ url: "getfromdb.php", type: "post", datatype: 'json', data: { action: "setstoppov", stopid : stopid, stoppov : stoppov }, success: function(data) { //alert(data); } }); my getfromdb.php such: <?php require_once('connect.php'); require_once('db_functions.php'); if (isset($_post["action"]) && !empty($_post["action"])) { $action = $_post["action"]; switch ($action) { case "setstoppov": $stopid = $_post['stopid']; $stoppov = $_post['stoppov']; setstoppov($stopid, $stoppov); break; } } ?> finally, setstoppov(...) ...

c++ - How can I add and initialize objects in a vector without having the destructor for the existing objects called? -

i working homework assignment , have come across problem when added destructor class. from assignment: the class have destructor displays message indicating object has "gone out of scope". i've implemented in rectangle class outputting ofstream object: rectangle::~rectangle() { rectoutput << "object length " << length << " , width " << width << " out of scope." << std::endl; } the problem i'm running that, put these objects vector make easy output table. looked until added destructor. due way vectors copy data new internal array , delete old array increase size, destructor called , message output several times in creation of objects. part of constraints of homework had initialize of objects values. choice use vector own. here code of initalization of objects: std::vector <rectangle> rectangles; //initialize of our rectangle objects within our vector rectangles.push_b...

How to display Image in jsp file in spring MVC -

i using maven project , trying display image, below code header part, <div> <div id="header-top"> <ul class="lang-nav"> <li><a id="active" href="" title="en">en</a></li> <li><a href="" title="fr">fr</a></li> <li><a href="" title="nl">nl</a></li> </ul> </div> <div id="header-bottom"> <img src="/resources/images/mobistar.jpg" /> </div> </div> servlet-context.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframewo...

Tracing Rails configuration changes -

an application has config.action_view.cache_template_loading = true in production.rb during rendering of template setting nil . how can trace changed? (obviously, there no other mentions of cache_template_loading in project code, it's changed external dependency) after you've set value want, can leave booby-trap explodes when else tries set value: config.action_view.cache_template_loading = true def (config.action_view).cache_template_loading=(new_value) raise runtimeerror, "someone reconfigured cache_template-loading" end you'll stack trace showing value set. (obviously, diagnostic tool running locally , not suitable committing code base.)

dynamic - R Shiny : Observe only works once -

i developing r shiny dashboard school project have problem reactive values , observers. want update ui (and more precisely selectinput) when user succesfully logged in. here current code global.r db <<- dbconnect(sqlite(), dbname = "ahp_data.db") isconnected <<- 0 #imagine here df contain model names df <- data.frame(option1 =c("no model selected), option2 =c("model_1","model_2") ) reactvalues <<- reactivevalues() isconnectvar <- null ui.r library(shinydashboard) dashboardpage( dashboardheader(), dashboardsidebar(), dashboardbody( #authentification panel sidebarlayout( sidebarpanel( titlepanel("authentification"), textinput('username', label="user name"), passwordinput('password', label= "password"), actionbutton("connectbutton", label='connect'), actionbutton("subscribebu...

twitter bootstrap 3 - jQuery Date Picker popup TO field Calendar -

i'm using plugin display date range calendar on website using bootstrap-datepicker . i quite new jquery , find hard figure out usage of methods . when user selects from date, want popup to date calendar automatically. have turned on autoclose calendar disappears once from date selected, cant figure out how popup to calendar. here sending html . first of need add class our date input , date input . add class fromdate date input add class todate date input <div id="sandbox-container"> <div class="input-daterange input-group" id="datepicker"> <input type="text" class="input-sm form-control fromdate" name="start" /> <span class="input-group-addon">to</span> <input type="text" class="input-sm form-control todate" name="end" /> </div> <...

excel 2010: text to columns is remember, how to get rid of this? -

Image
i have tekst copied pdf file eexcel(2010). used 'text-to-columns' create separate columns. now have finished part of task, want paste piece of text same file. but excel directly uses text-to-columns used split new text, (obvious) not want split. tried pasting text on new worksheet. tried paste text in new workbook, still text directly split excel. i tried pasting text , tried pasting unicode text. far, have not found solution this. how can make excel "forget" has split text columns? select cell value , run data ► text-to-columns, delimited. turn off all delimiters , click finish.      subsequent pasting of information worksheet not use 'remembered' delimiters since there none.

scala - Can only zip RDDs with same number of elements in each partition despite repartition -

i load dataset val data = sc.textfile("/home/kybe/documents/datasets/img.csv",defp) i want put index on data thus val nb = data.count.toint val tozip = sc.parallelize(1 nb).repartition(data.getnumpartitions) val res = tozip.zip(data) unfortunately have following error can zip rdds same number of elements in each partition how can modify number of element partition if possible ? why doesn't work? the documentation zip() states: zips rdd one, returning key-value pairs first element in each rdd, second element in each rdd, etc. assumes 2 rdds have same number of partitions , same number of elements in each partition (e.g. 1 made through map on other). so need make sure meet 2 conditions: both rdds have same number of partitions respective partitions in rdds have same size you making sure have same number of partitions repartition() spark doesn't guarantee have same distribution in each partition each rdd. why that? becau...

go - What is the Advantage of sync.WaitGroup over Channels? -

i'm working on concurrent go library, , stumbled upon 2 distinct patterns of synchronization between goroutines results similar: using waitgroup var wg sync.waitgroup func main() { words := []string{ "foo", "bar", "baz" } _, word := range words { wg.add(1) go func(word string) { time.sleep(1 * time.second) defer wg.done() fmt.println(word) }(word) } // concurrent things here // blocks/waits waitgroup wg.wait() } using channel func main() { words = []string{ "foo", "bar", "baz" } done := make(chan bool) defer close(done) _, word := range words { go func(word string) { time.sleep(1 * time.second) fmt.println(word) done <- tru...

swift - How to add barButtonItem to ToolBar -

how convert code have button appear in toolbar? : navigationitem.rightbarbuttonitem = editbuttonitem() try this, let barbuttonitem = uibarbuttonitem(title: "edit", style: .plain, target: self, action: "oneditbuttontapped:") self.navigationitem.rightbarbuttonitem = barbuttonitem then write action function likes this, func oneditbuttontapped(sender:uibarbuttonitem) { ... }

windows - Add chararacter to end of each lines except the last one -

i'm trying convert file containing json line json array. achieve had append opening , closing square brackets file (which done!). finish need append comma end of each line except last one. i'm using following script, don't how stop @ last line. @echo off setlocal enabledelayedexpansion /f "tokens=* delims= " %%a in (input.txt) ( set /a n+=1 echo ^%%a^, >> output.txt ) thank advance help! try , should work if lines not content ! symbols. produce temp.file .if file need remove last line.you'll need change values of fileloc , endsymbol values want. @echo off setlocal enabledelayedexpansion ::-------------------------:: :: change values here :: set "fileloc=testfile.txt" set "endsymbol=," ::-------------------------:: set counter=0 /f "usebackq tokens=* delims=" %%# in ("%fileloc%") ( set /a counter=counter+1 set "line[!counter!]=%%#" ) set /a uptoline=counter-1 break>t...

eclipse - Iterate Sql.result set -

i need create owl class first table name if cardinality 1:1 , owl class second table name. if cardinality 1:* , 1 of tables describes object properties, create owl object property first table name, create owl class second table name. first of how can create class column names? have owl api installed in eclipse. public class snippet { public static void main(string[] args) { // sql server db jdbc string url = "jdbc:sqlserver://isd.ktu.lt:1433"; string databasename= "xxxx"; string username = "xxx"; string password = "xxx"; try { class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); connection con = drivermanager.getconnection (url, username, password); statement smt = con.createstatement(); smt.executequery("select * table_references"); resultset rs = smt.getresultset(); while (rs.next()) { string column1 = rs.getstring...

Getting RGB of a pixel in touchesMoved delegate -

i have created page picks rgb values of pixel. allows user move finger , choose pixel color of selected image. setting rgb hence obtained, small image view showing selection. here piece of code. - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; // touch location cgpoint touchlocation = [touch locationinview:touch.view]; // set touch location's center imageview if (cgrectcontainspoint(imageviewcolorpicker.frame, touchlocation)) { imageviewcolorpicker.center = touchlocation; cgimageref image = [imageviewselectedimage.image cgimage]; nsuinteger width = cgimagegetwidth(image); nsuinteger height = cgimagegetheight(image); cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); unsigned char *rawdata = malloc(height * width * 4); nsuinteger bytesperpixel = 4; nsuinteger bytesperrow = bytesperpixel * width; nsuin...

centos - Why my Tomcat has no catalina.sh? -

basic info: os: centos 7.0 x64 tomcat version: 7.0.54 (installed using yum) it begins wanna debug checking catalina.out . there nothing in file except 1 line: tomcat-7.0.54 rpm installed i got tips catalina.sh has setting logging. found tomcat has no file. in folder bin there 3 files: bootstrap.jar tomcat-juli.jar catalina-tasks.xml before start tomcat systemctl start tomcat , haven't notice problem. is reasonable ? should if wanna edit setting logging or others startup? this may ref how install tomcat 7 on centos 7 log location /usr/share/tomcat/logs the rpm command below show files are. rpm -ql tomcat |more the systemctl command given detailed list of service systemctl status tomcat.service -l ref tomcat logging server.xml to additionally log information requests going web application, "valves" can configured in server.xml file, described in detail here. example, inside tag: for more information on valves in ...

html - AngularJS ng-repeat with track overwriting array -

i'm using ng-repeat render conversation-style in ionic app. i'm using track ($index + message._id), same result using track $index. the problem have array of messages wich contains text , of them html linked via ng-bind-html. when more 1 message html appears in array (pushed array doing $scope.messages.push(message)) previous elements html content being overwritten las message html content. how can avoid behaviour? i'm trying not being successful. think strange behaviour. been working angularjs year , never got this. example: <div ng-repeat="message in chat.messages track ($index + message._id)"> <div class="message" ng-bind-html="message.content"></div> </div> and in javascript, when message arrives (message can plain text or html content): $scope.messages.push(message); even if delete ng-bind-html , make {{message.content}} html presented plain text changes in array elements. every message has $i...

render - How to symfony 1.4 parse filter Odata V2? -

i having problem api. working on framwork symfony 1.4 , plugin igniteui filter odata v2. want ask symfony 1.4 have plugin or solution filter odata v2? thanks. url filter: callback=jquery19101818354631625243_1458209143729&$filter=indexof(tolower(pname),'3242342') ge 0 , indexof(tolower(palias),'23423424') ge 0 , indexof(tolower(plang),'34534535') ge 0 , indexof(tolower(pprice),'345345') ge 0&pageindex=0&pagesize=25&_=1458209143735

c# - Toggling the window visibility instanciates new window -

i have modularized application prism. simple window (shell) displayed. shell contains taskbar icon invokes command toggle windows visibility. clicking taskbaricon creates new instance of shell instead of toggling visibility of original one. know why code not invoke method on first shell? my bootstrapper protected override dependencyobject createshell() { var shell = servicelocator.current.getinstance<shell>(); registertypeifmissing(typeof(shell), typeof(shell), true); return shell; } protected override void initializeshell() { var mainwindow = (shell)this.shell; var regionmanager = servicelocator.current.getinstance<iregionmanager>(); application.current.mainwindow = mainwindow; mainwindow.show(); } my taskbaricon <tb:taskbaricon name="toolbaricon" iconsource="/resources/images/icon.ico" tooltiptext="some text" ...

sql server - Passing values from first stored procedure to another is not working -

please help. have created stored procedure in no values have passed. like: create procedure updatetablemonthlytrend inside have declared variables , have stored values them table. like: @previousmonth , @currentyear now these values passing storedprocedure have created earlier accepting these variables' values. create procedure tablemonthlytrend (@previousmonth varchar(20), @currentyear int) from first procedure passing values second procedure like: exec tablemonthlytrend @previousmonth, @currentyear. but while executing first procedure nothing passing down second procedure. when exec updatetablemonthlytrend --nothing happens , second procedure runs not functioning should do. please , let me know mistake doing. here first sp:- alter procedure [dbo].[bo_sp_update_supportkpi_monthlytrend] begin begin transaction; begin try create table #temp_currentdatetime (id int identity(1,1), currentdate datetime, currentmonth varchar(15), previousmonth varchar (15)...

php - execute multi query when I hit submit with mysqli -

i'm learning mysql/php , i'm trying execute multi query using msqli. have read through several tutorials, , tried apply them, cannot working... hope can me. dont mind messy code, clean later!!! code : else if (isset($_post['btnslaopings'])) { $id=$_post['id']; $uitgeleend=$_post['uitgeleend']; $nr=$_post['nr']; $model=$_post['model']; $serienummer=$_post['serienummer']; $capaciteit=$_post['capaciteit']; $uptodate=$_post['uptodate']; $persoon=$_post['persoon']; $datumuitgeleend=$_post['datumuitgeleend']; $datumretour=$_post['datumretour']; $opmerking=$_post['opmerking']; $sql="update ipads set nr='$nr', model='$model', serienummer='$serienummer', capaciteit='$capaciteit', uptodate='$uptodate', persoon='$persoon', datumuitgeleend='$datumuitgeleend', datumretour='$datumreto...

sql - setting form authentication in impersonate -

Image
i have intranet website. database uses windows authentication. website uses network credential using logonuser() . intptr token = intptr.zero; bool result = logonuser(txtusername.text, txtdomain.text, txtpassword.text, 2, 0, ref token); //2, 0, ref token); if (result) { windowsidentity newid = new windowsidentity(token); windowsimpersonationcontext impersonateduser = newid.impersonate(); formsauthentication.setauthcookie(txtdomain.text + "\\" + txtusername.text, false); using (sqlconnection cnn=new sqlconnection(configurationmanager.connectionstrings["connectionstring"].connectionstring)) { using (sqlcommand cmd=new sqlcommand("select * [user] username=@user", cnn)) { cmd.parameters.clear(); cmd.parameters.addwithvalue("@user",txtdomain.text+"\\"+txtusername.text); ...

android - How to match xml layout files to integers on an decompiled apk? -

i trying learn how decompiling android apk using apktool works. when use apktool extract simple apk, of resources extracted correctly. when check activity oncreate , expect see findviewbyid(myview) this: findviewbyid(2356778) i not know number comes from, , can not figure out number refers xml layout file. if extracted apktool means, corresponding layout name findviewbyid(0x7f030028) present in /res/values/public.xml in public.xml can see this, <public type="layout" name="your_layout_name" id="0x7f030028" />

php - Laravel custom helper - undefined index SERVER_NAME -

in laravel 5.1, created custom helper file: custom.php load in composer.json : "autoload": { "files": [ "app/helpers/custom.php" ] }, and contains method: function website() { return str_replace('dashboard.', '', $_server['server_name']); } it works expected, every time php artisan commands, call stack , message: notice: undefined index: server_name in /path/to/custom.php on line 4 why so? method returns correct value when run within laravel app. $_server['server_name'] global variable accessible when running application through browser. through error when run application through php-cli/through terminal. change code to function website() { if(php_sapi_name() === 'cli' or defined('stdin')){ // section of code runs when application being runned terminal return "some default server name or can use environment set server name" }e...

Why python list is not passed by reference -

i'm doing homework , assignment make script removes highest , lowest prices , prints middle price here code: def removeall(list,value): list = [n n in list if n != value] print(list) prices = [] while true: usrinput = input('please enter price or stop stop: ') if usrinput == 'stop': break prices.append(float(usrinput)) print(prices) highestprice = max(prices) lowestprice = min(prices) removeall(prices, highestprice) removeall(prices, lowestprice) print(prices) print(sum(prices)/len(prices)) i know can make work like: def removeall(list,value): mylist = [n n in list if n != value] return mylist prices = removeall(prices,highest) but question why removeall() not changing prices? isn't passed reference? python parameters not same references in other languages. it's more pointer that's being passed value. if modify pointer point else, calling code doesn't see change. to make change c...

Serialize Json into generic structure without schema using Java and Jackson -

i have need serialize json without being attached particular schema resulting object, e.g., generic set/map/hashmap. as input , have string json. not know schema json. as output, want java object such hashmap or similar has key-value serialization of input. note that input json has both basic fields , array/list inside it. i have use java , jackson (or other library). how possibly can that? jackson data binding able read json input map string key , object value (that can map or collection). tell mapper read json map. giving mapper appropriate type reference: import java.util.*; import com.fasterxml.jackson.core.type.typereference; import com.fasterxml.jackson.databind.objectmapper; public class test { public static void main(string[] args) { try { string json = "{ " + "\"string-property\": \"string-value\", " + "\"int-property\": 1, "...

How to prevent Java reflection to access a custom Java package in a custom Android? -

let have custom android 4.3 custom java package xyz.java. my questions are: how use java security manager prevent apps using reflectoin enumerate java methods in custom java package xyz.java? where in android source code should put java security manager code (suggested in 1) prevent apps enumerating methods in custom package xzy.java?

c++ - regex_token_iterator issue in Visual Studio 2015 Update 2 RC -

i installed visual studio 2015 update 2 release candidate , seem have problem use of sregex_token_iterator far seemed work fine. verify tried following sample code cppreference.com (note changed variable text have white space @ end): #include <iostream> #include <regex> int main() { std::string text = "quick brown fox "; // tokenization (non-matched fragments) // note regex matched 2 times: when third value obtained // iterator suffix iterator. std::regex ws_re("\\s+"); // whitespace std::copy(std::sregex_token_iterator(text.begin(), text.end(), ws_re, -1), std::sregex_token_iterator(), std::ostream_iterator<std::string>(std::cout, "\n")); } running gives following assertion: debug assertion failed! program: c:\windows\system32\msvcp140d.dll file: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring line: 247 expression: string iterators incompatible in...

datalist - data list move up and down rows jquery -

hi trying move data , down data list, here fiddle tried not getting required one. can 1 me https://jsfiddle.net/mwd4ranu/ $(document).ready(function(){ $(".up,.down").click(function(){ var row = $(this).parents("tr:first"); if ($(this).is(".up")) { row.insertbefore(row.prev()); } else { row.insertafter(row.next()); } }); }); when use parents("tr:first") select closest tr , not 1 try move $(document).ready(function(){ $(".up,.down").click(function(){ var row = $(this).parents("#dllist > tbody > tr").first(); if ($(this).is(".up")) { row.insertbefore(row.prev()); } else { row.insertafter(row.next()); } }); }); ps : not forget select jquery fiddle javascript library

sql - Calendar control date not known (ASP.Net) -

sometimes have dates unknown, eg: won't know date month , year. eg: --/dec/2015, date not known? how accept these kind of values? any ideas on can stored on sql server database? i store date in database. because date have benefits like: calculation function dateadd , datediff . you able sort on 1 column index 1 column when need year , month. use month , year

eaaccessory - Error during initializing the Scanner of mPop Printer -

i developing point of sale application in there requirement of bluetooth connectivity printer , scanner. using star printer. getting following error randomly when scanner being initialized. error - opening session error - /sourcecache/externalaccessory/externalaccessory-288.20.7/easession.m:-[easession dealloc] - 141 unable close session _accessory=0x16768100 , sessionid=65536 thanks, ratneshwar i had same bug, fixed downloading mpop utility , changing in bluetooth configuration name port. it isnt complete solution, while star micronics fix problem can works customers. edit: if have implemented both sdks stario.framework , stario_extension.framework , using barcode lector in app should use method [_starioextmanager.lock lock]; before try connection of port , after , close port, use [_starioextmanager.lock unlock];

r - Returning 1st Largest and 2nd Largest numbers -

df <- b c d e f g h 0 1 2 3 4 5 6 7 1 2 3 8 5 6 7 4 need find 1st , 2nd largest number in above given data frame . result should below . a b c d e f g h 1st largest 2nd largest 0 1 2 3 4 5 6 7 7 6 1 2 3 8 5 6 7 4 8 7 we can loop through rows using apply (with margin=1 ), sort elements decreasing=true option, , first 2 elements head or [1:2] , transpose output , assign create 2 new columns in 'df'. df[c("firstlargest", "secondlargest")] <- t(apply(df, 1, function(x) head(sort(x, decreasing=true),2))) df # b c d e f g h firstlargest secondlargest #1 0 1 2 3 4 5 6 7 7 6 #2 1 2 3 8 5 6 7 4 8 7

how to use Custom Progress bar in Asynk task in android -

public class loginactivity extends activity { public static final int dialog_loading = 1; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); showdialog(dialog_loading); thread thread = new thread(null, dosometask); thread.start(); } private runnable dosometask = new runnable() { public void run() { try { //code of task thread.sleep(10000); } catch (interruptedexception e) {} //done! continue on ui thread runonuithread(taskdone); } }; //since can't update our ui thread runnable takes care of that! private runnable taskdone = new runnable() { public void run() { dismissdialog(dialog_loading); } }; @override protected dialog oncreatedialog(int id) { switch (id) { ...

html - CSS3 - Transform Issues - Div positioning -

i'm trying create container animates... on hover background image transform scale (zooms in) while opacity layer appears on image. caption translates in right "learn more" caption. my issue when try absolute position .caption not appear in front of elements within container. seems position:absolute being overwritten something. when try debug can see it's behind container elements. desired affect .caption position in front of container elements. does know i'm doing wrong here? <div class="container"> <img id="image-zoom" src="http://s16.postimg.org/cr851jb5h/services_img_demo.jpg"/> <span class="opacity-layer scale-opacity-layer"></span> <div class="caption"><a href="#">learn more+</a></div> </div> /* overflow prevent scaled image expanding width of it's container */ .container { cursor...

objective c - How to make UITableView scroll show on more than 25 records? -

i have created ios app uitableview.uitableview default loads 25 records. scrolling tableview 25 records. how set of data? here code. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return timelist.count; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellidentifier = @"item"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell=[[uitableviewcell alloc]initwithstyle: uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; } nsdictionary *tmpdict = [timelist objectatindex:indexpath.row]; nsmutablestring *text; nsstring *currentstatus; text = [nsmutablestring stringwithformat:@"%@",[tmpdict objectforkeyedsubscript:startdate]]; currentstatus = [self statusstring:[nsmutablestring stringwithformat:@"%@",[tmpdic...

Permission denied error in app engine code -

i getting below error in line 5 while executing app engine code in localhost , in cloud. 1 httpclient client = new httpclient(); 2 getmethod getmethod =new getmethod(url); 3 client.gethttpconnectionmanager().getparams() 4 .setconnectiontimeout(1000); 5 int response = client.executemethod(getmethod); i seeing error while running job in localhost , in app engine. please find error logs below: info] 2016-03-07 11:04:03 debug httpconnection:1215 - enter httpconnection.closesockedandstreams() [info] 2016-03-07 11:04:03 info httpmethoddirector:439 - i/o exception (java.net.socketexception) caught when processing request: permission denied: not allowe d issue socket bind: permission denied. [info] 2016-03-07 11:04:03 debug httpmethoddirector:443 - permission denied: not allowed issue socket bind: permission denied. [info] java.net.socketexception: permission denied: not allowed issue socket bind: permission denied. [info] @ com.google.appengine.api.sock...

android - Eclipse AVD screen is zoom and merged -

Image
i run 'xxx' project in eclipse , before showing avd raises dialog box no compatible targets found. wish add new avd? yes or no button choose no, launch cancelled. after this, if run other projects in workspace avd screen zoomed , icons merged. then deleted , recreate new avd tried different targets , different devices nothing works zoomed above image i'm not one: avd screen content jumbled there no single solution. if came across problem, give solutions

php - how to convert object to array Symfony2 -

i have object named property, how can convert array /** * @route("/property/{id}/pictures/download_all", name="property_zip_files_and_download", methods={"get"}) */ public function zipfilesanddownloadaction(property $property) { $pictures = $property->pictures; $compresspath = $this->get('some_service.property.picture_compress')->compress($pictures); //some code download... .... } how can convert pictures array , pass service? can please me out here what pictures? in simple cases can use (array) $pictures . also, can use serializer normalizers if variable iterator (arraycollection or persistentcollection example) , service method has array typehinting, can convert simple array iterator_to_array function. try: $compresspath = $this->get('some_service.property.picture_compress')->compress(iterator_to_array($pictures));

fiware - Changing the workspace name when using WireCloud with KeyStone -

after integrating keystone wirecloud, workspaces , usernames user name plus id. there way configure keystone and/or wirecloud allow unique user names id not neccessary? this seems happen, if user name in use. that id appended username python-social-auth , can change of username generation settings used module. in regard, can use social_auth_uuid_length = 0 remove ids, wirecloud associate new idm accounts existing users same username.

openerp - How can I pass values to the context of qweb reports that will be accessed on the template -

i have 2 values start_date , end_date want access in qweb template. how can these values in qweb.? i generating , sending email. here's how creating report. job_id = self.pool.get('module.report_name').search(self.env.cr, self.env.uid, [('date', '>=', start),('date', '<=', end)], context=none) data, format = openerp.report.render_report(self.env.cr,self.env.uid, job_id, report.report_name, {}, {}) while rendering report, last argument passing context reports. pass variables that, data, format = openerp.report.render_report(self.env.cr,self.env.uid, job_id, report.report_name, {}, {'start_date': start_date, 'end_date': end_date}) and in qweb access them as, <t t-esc="docs._context['start_date']"></t>

linux - Trying to set up freeradius in eap-tls mode using wpa supplicant -

i trying setup freeraadius in eap-tls mode. using freeradius server , wpa-supplicant client. have installed both packages in ubuntu-14.04.3. using sample certificates provided along freeradius package. use script bootstrap provided in /freerad/raddb/cert . donot know if script signs certificate or not not expert in area. provide paths these certificates in client.conf freeradius , configuration file in wpa-supplicant. following wpa-supplicant configuration using network={ ssid="your-ssid" scan_ssid=1 key_mgmt=wpa-eap eap=tls identity="alice" ca_cert="/home/areh/freeradius-server-3.0.11/raddb/certs/ca.pem" client_cert="/home/areh/freeradius-server-3.0.11/raddb/certs/client.pem" private_key="/home/areh/freeradius-server-3.0.11/raddb/certs/client.key" } i running freeradius using freeradius -x command , eapol_test -c eap-tls.conf -s testing123 wpa-supplicant command. i receive following error on wpa-supplica...

I want to make an android road accident saver application, which notify selected contacts about road accident. -

i want make android road accident saver application, notify selected contacts road accident. want judge jerk sensors , how handle that? possible accelrometer? yes, possible judge jerk differentiating accelerometer data, smartphones' accelerometers don't have enough range give useful data @ kinds of accelerations involved in road accidents. you'll need lot of analysis , collect real data able write algorithm distinguishes road accident from, say, dropping phone on floor or tapping hard on desk.