2018-10-22         Lorraine

MySql syntax error; Deleting from two tables in one query possible?

Is it not possible to perform two deletes in one query by separating them with a semicolon?Here is my query:$query="DELETE FROM $sql_tableWHERE EXISTS ( SELECT 1 FROM classified WHERE classified.poster_password = '$pass' AND classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id );DELETE FROM classifiedWHERE classified.poster_password = '$pass'AND classified.ad_id = '$id'";This gives this error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...

 php                     3 answers                     3 view
 2018-10-22         Lorraine

change border color of multiple divs with button

I'm totally new to this and working on a script that will change body background color and some html div's border color on button click.I got where I can change the body background color to a random color with button click but now I'm stuck on how to do the same to all div borders with a separate button and all the divs have different class names and I would like to change them all at same time to same random color.Any ideas that will help me or if you could point me in the right direction I would really appreciate it.var button2 = document.getElementById("button2");var all...

 javascript                     3 answers                     59 view
 2018-10-22         Lorraine

Conditional minimum of two columns with NA's

How can I efficiently create a new column which is the minimum of column 3 and column 2 when column 1 has a particular value?Example:my_dataframe=pd.DataFrame({'col1':[1.0,2.0,3.0], 'col2':[4.0,5.0,6.0], 'col3':[0.25,np.nan,0.25]})my_dataframe = my_dataframe.assign(col4 = lambda x: np.where(x['col1']>1, np.minimum(x['col2'], x['col3']), 0))RuntimeWarning: invalid value encountered in minimumI assume that the np.minimumfunction can't handle the NA, so how can I work around this? The numpy.nanmin function does not work as well.It returns the followi...

 python                     1 answers                     5 view
 2018-10-22         Lorraine

Reinitialize/Reset dropzone after form is submitted

I'm using the dropzone.js to upload image on ruby on rails .Here is my HTML code <div class="row"> <div class="col-md-12" id="drop-zone-container"> <%= form_tag '/settlement_proofs', method: :post, class: 'dropzone form', id: 'media-dropzone' do %> <div class="fallback"> <%= file_field_tag 'attachment', multiple: true%> </div> <% end %> </div></div>and I initialized dropzone as $("#media-dropzone").dropzone({ acceptedFiles: pg.constants.ACCEPTED_FORMAT, maxFilesize: pg.constants.ATTAC...

 javascript                     5 answers                     67 view
 2018-10-22         Lorraine

pgAdmin 4 v3.0 and v3.1 doesn't load (crashes) on Windows 10

I tried to google issue, but I couldn't really find any help or solution that would work. It is trying to load - loading box appear, but app doesn't appear after that. There is no log in "%APPDATA%\pgAdmin\pgadmin4.log" file or any error. There is no process after it crashes. Version v2 works properly.I'll provide any info, you need. I am kinda out of ideas how to log / fix this. Have you tried running it as Administrator? If not I would suggest try it once, I don't know the exact reason but sometimes it fails to load on Windows.I faced the same issue, Here are the steps...

 postgresql                     1 answers                     62 view
 2018-10-22         Lorraine

PowerShell/Batch to Remove End Text from Folder Name

I installed the new Google Drive's software "Backup and Sync" and now all the suddenly it added the text (1) at the end of ALL my music folders!It's painful going through so many artists and manually editing these... Is there any way I can use a batch file to go through each file and remove that piece string?I've done a lot of searching and I can't seem to find any details pertaining to removing text from a FOLDER name. Everything I've searched is about remove text from a filename.Example Directory:Awesome Artist (1)Another Cool Artist (1)Artist Is Fun (1)WOW COOL Artist (1...

 powershell                     1 answers                     77 view
 2018-10-22         Lorraine

Arduino not connecting to computer after working before

I bought my Arduino Uno R3 a few months ago. It's been working like a charm since then, but today, it stopped interfacing with my computer. Let me be more specific. I have a 2013 Macbook Pro Retina with OS X 10.9 (Mavericks). It has the latest Arduino IDE installed.I was using it today and after uploading a simple sketch (it worked for a little while) my Mac stopped recognizing it, and since, I haven't been able to access it. The LED connected to Pin 13 stays on 100% of the time. The RX/TX LEDs don't flash, but the main functions of my sketch (other than the serial fu...

 macos                     1 answers                     26 view
 2018-10-22         Lorraine

Google Chrome command line switch to emulate a device size?

Does anyone know what are the Google Chrome command line switches that I can use to emulate the device size?The component that I want to test contains the CSS @media query min-device-width/min-device-height. I tried using the --window-size and --user-agent but I have no luck with those.Basically, I am trying to write a webdriver test for this component. Regular Chrome does not really support this function, but Chrome Canary is exactly what you are looking for.https://www.google.com/intl/en/chrome/browser/canary.htmlhttps://developers.google.com/chrome-developer-tools/doc...

 css                     2 answers                     74 view
 2018-10-22         Lorraine

Django template ifequal tag

I'm using an ifequal tag in my django template inside a loop where atleast one of the items should equal the other at some point in the loop but for some reason it never displays what it should. I was wondering if there are any weird cases that i should know about.I have a list of int city ID's that should be checked as check boxes. so as i loop through all of the cities, for each one i loop through the ones that are supposed to be checked to see if the equal anywhere in the list. But for whatever reason none of them ever match. I verified that the data is right using the d...

 python                     2 answers                     100 view
 2018-10-22         Lorraine

Piping multiple commands to bash, pipe behavior question

I have this command sequence that I'm having trouble understanding:[me@mine ~]$ (echo 'test'; cat) | bashecho $?1echo 'this is the new shell'this is the new shellexit[me@mine ~]$ As far as I can understand, here is what happens:A pipe is created.stdout of echo 'test' is sent to the pipe.bash receives 'test' on stdin.echo $? returns 1, which is what happens when you run test without args. cat runs.It is copying stdin to stdout. stdout is sent to the pipe. bash will execute whatever you type in, but stderr won't get printed to the screen (we used |, not |&). I have three ...

 bash                     1 answers                     45 view
 2018-10-22         Lorraine

Scope of Functions as objects in Python

I am trying to understand how python stores and accesses its functions as objects .For example take the following code-def make_pretty(func): def inner(): print("I got decorated") func() return func return innerdef ordinary(): print("I am ordinary 2")ordinary()pretty=make_pretty(ordinary)pretty()When executed , pretty() returns I got decoratedI am ordinary 2<function __main__.ordinary()>which seems to imply that the ordinary() function passed to make_pretty() is accessed as in the main scope, and as dir(pretty) doesn't show ordinary (Plea...

 python-3.x                     1 answers                     50 view
 2018-10-22         Lorraine

How to make a React multi-step form work with React Router?

I'm working to learn React + ReactRouter to build a multi-step form. I got the example working here: https://www.viget.com/articles/building-a-multi-step-registration-form-with-reactThe problem is this example doesn't use ReactRouter so the URL never changes during the form. The author mentions "You could set each step to a custom route" however, I haven't been able to figure out how to get that to work. How can you update the current render process to work with ReactRouter?render: function() { switch (this.state.step) { case 1: return <AccountFields fieldVa...

 javascript                     1 answers                     17 view
 2018-10-22         Lorraine

How would I display a UIDatePicker when a UITableView cell is tapped?

Here's what I'm trying to do. I have a UITableView with 5 rows. In the last two rows I want the UILabel to display Dates (as in a "from" date and a "to" date). When the user taps the cell I want a UIDatePicker to popup with a "Done" button up in the toolbar. When the user selects a date and clicks "Done", the UIDatePicker should close and the new date should be displayed for the UILabel in the cell. I have seen several examples online and here on SO that say to assign the InputView and InputAccessoryView to the date picker and toolbar containing the Done button. However, th...

 ios                     1 answers                     32 view
 2018-10-22         Lorraine

Get the position of a spinner in Android

I'm trying to get the position (number) of the spinner when selected to use it in another Activity that will display a different map each time depending on the item selected. when I run the application it crashes. this is the first Activity code: public class TestProjectActivity extends Activity { public Spinner spinner1; public Integer number; private Button valideButton; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MySpinner(); valide_button(); } public vo...

 android                     3 answers                     51 view
 2018-10-22         Lorraine

Case insensitive search without using a function in the where clause

Any way to make a case insensitive without using a function in the where clause?Please specify the database you are talking about when/if you reply. I am aware that MySQL is already case insensitive by default. What about Oracle or MSSQL or HANA?select * from mytable WHERE upper(fieldname) = 'VALUE' collate SQL_Latin1_General_CP1_CS_AS.Default Collation is SQL_Latin1_General_CP1_CI_AS which is case insensitive. And if we need to make it case sensitive, then adding COLLATE Latin1_General_CS_AS makes the search case sensitive.Queryselect * from [mytable] where [fieldname...

 sql                     5 answers                     33 view
 2018-10-22         Lorraine

what causes "permission denied"-message with FIREBASE and FLUTTER

I've got the error 'W/SyncTree(31625): Listen at /address failed: DatabaseError: Permission denied'while sending a request to firebase with an anonymous firebase user and without fancy firebase database rules :) . ..and i want to find out what causes this message.EDIT: error is the same with an existing user, means user signIn seems to work but accessing database not.What i've done so far:Set up firebase (including adding google_service.json, dependencies in pubspec.yaml) - works so farcreating login as follows (like in example from google link):Future<String> _test...

 android                     1 answers                     88 view

Page 1 of 143  |  Show More Pages:  Top Prev Next Last