Posts

Showing posts from September 20, 2018

How to reset settings in c# httpClient?

Image
Clash Royale CLAN TAG #URR8PPP How to reset settings in c# httpClient? In c#, I make get and post requests. This is my code GET private async Task<string> GetAsync(string uri, Token token, string accept, string content_type) HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(accept)); // ACCEPT header bool added = client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "text/xml"); if (token != null) client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(token.token_type, token.access_token); HttpResponseMessage g = await client.GetAsync(uri); if (g.IsSuccessStatusCode) return await g.Content.ReadAsStringAsync(); else errors.AddError(g.ReasonPhrase, await g.Content.ReadAsStringAsync()); return null; } POST private async Task<string> PostAsync(string uri, Token token, string postData, string accept, string content_type) HttpClient client = ne

SectionList wont render section header

Image
Clash Royale CLAN TAG #URR8PPP SectionList wont render section header My SectionList will not render anything inside the renderSectionHeader function. It will create the View but it will be empty. I have tried putting text, Image, with no luck. The item rows work perfectly fine, but the sectionHeader won't have any content. render() return( <SectionList style=fill sections=deals renderItem= (item, index, section) => ( <View style=styles.container> <Text style=[txt.med.left, styles.text]> item.name </Text> <Text style=[txt.med.right, styles.text]> item.date </Text> </View> ) renderSectionHeader= (section: title) => ( <View style=styles.container2> names[title] </View> ) keyExtractor=(item, index) => item + index /> ) } and here is names export const names = item1: <Image source=require('./path') style=img resizeMode="contain" />, item2: <Image source=requi

docker image directory does not exist during build

Image
Clash Royale CLAN TAG #URR8PPP docker image directory does not exist during build I'm building a simple image from a Dockerfile: (note, pm3 is the name of the folder this Dockerfile lives in) pm3 FROM continuumio/miniconda3 MINTAINER Jordan Miller ENV PORT=5000 COPY . /opt/repos/ WORKDIR /opt/repos/pm3/ RUN ls -la RUN python /opt/repos/pm3/lib/acquire_requirements.py EXPOSE $PORT ENTRYPOINT ["python","/opt/repos/pm3/src/web/api.py"] I use docker build -f Dockerfile -t jm/pm3 . to build it. Now I thought this was working great last week, but I made some changes and it broke. so I ran docker system prune to clean everything out. But that didn't fix it so I think it's something wrong with the code. docker build -f Dockerfile -t jm/pm3 . docker system prune At any rate, here's the error I get: Step 7/9 : RUN python /opt/repos/pm3/lib/acquire_requirements.py ---> Running in f842a282a6a0 Invalid requirement: '/opt/repos/pm3/lib/acquire_requi

Make Bluetooth connection alive for multiple activity

Image
Clash Royale CLAN TAG #URR8PPP Make Bluetooth connection alive for multiple activity In my application i want to send value from multiple activity to connected Thread,i don't know to solve this problem please help me Example: I want to send String string ="#FFFFFF000*";from First-activity to service class, String string= "#000000000*" ;from Second- activity to service class public class BluetoothDataService1 extends Service { final int handlerState = 0; Handler bluetoothIn; private BluetoothAdapter btAdapter = null; private ConnectingThread mConnectingThread; private ConnectedThread mConnectedThread; private boolean stopThread; private static final UUID BTMODULEUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); // private static String MAC_ADDRESS="98:D3:31:30:A5:00" ; private static String MAC_ADDRESS="98:D3:32:20:42:54" ; private StringBuilder recDataString = new StringBuilder(); private final IBinder

How can I compress my FBX file further?

Image
Clash Royale CLAN TAG #URR8PPP How can I compress my FBX file further? I have an FBX file that takes 58.8MB After converting it to a .glb using draco compression with this package: https://github.com/facebookincubator/FBX2glTF/tree/master/npm The file now takes 28.4MB Ideally, I would need to get the file below 5MB. How can I achieve that ? I am using 3DS Max. The character used to take the whole screen on load, now here is what I see after converting the FBX to gltf, reducing the size of the textures from 2048x2048 to 1024x1024 and converting them to .jpg : I don't think a >90% compression ratio is realistic, even for the best compression algorithms, given 3D mesh input data. Your best bet may be to reduce the amount of incoming data, by removing fine-grained detail. Some packages call this "decimating" the mesh. It may also be possible to convert high-poly detail to baked normal maps on a low-poly mesh. – emackey Aug 7 at 20:47 @emackey Ultimately

Can I Use Dart Compiled JS (JavaScript) Into Firebase Hosting For Static Website

Image
Clash Royale CLAN TAG #URR8PPP Can I Use Dart Compiled JS (JavaScript) Into Firebase Hosting For Static Website I am Trying to deploy a static website with some DART Features. Before that I want to Know that Can I Use Dart Compiled JavaScript Code In it or not. 2 Answers 2 Absolutely! In fact, you can configure your firebase.json file to run the build for you as part of deploy. firebase.json "hosting": "public": "build", "predeploy": "rm -rf build; pub run build_runner build -o web:build --fail-on-severe --release" See https://github.com/dart-lang/angular/tree/master/examples/hacker_news_pwa for an example. Always nice to see questions answered by the developers who created the frameworks in question – Christian Scillitoe Aug 7 at 20:14 Firebase Hosting just serves static assets (e.g. HTML, CSS, JS, images). It doesn't care what those assets are. It performs no alteration of the assets on the way to the client.

Spring Rest Controller - business validations & resolving id

Image
Clash Royale CLAN TAG #URR8PPP Spring Rest Controller - business validations & resolving id We are designing rest api for our existing application using spring+jpa. want to validate the input/request payload prior to persisting. Have found @PrePersist listener method and hope we can validate entity business validations(unique etc) and id's can be resolved in prior to persist, however had few issues @PrePersist EntityManager is not auto wired: trying to autowire entity manager in super Entity class like below so that entityManger object can be used in all subclasses EntityManager @PersistenceContext protected EntityManager entityManager; Understood that since the entity is not spring managed bean, entity manager object is not autowired. @PersistenceContext protected EntityManager entityManager; After setting entiy object manually (as a workaround for point 1), while trying to resolve ids based on user provided values in PrePersist callback method resulted is getting same

SQL Convert Pivot results to H:mm:ss

Image
Clash Royale CLAN TAG #URR8PPP SQL Convert Pivot results to H:mm:ss This is what my Original Db looks like: +-------------+----------+---------------------+------+ | StationName | State | Start_time | Time | +-------------+----------+---------------------+------+ | P3 | Downtime | 2018-02-14 13:57:39 | 83 | +-------------+----------+---------------------+------+ | P4 | Downtime | 2018-02-14 13:57:39 | 118 | +-------------+----------+---------------------+------+ | P3 | Downtime | 2018-02-15 06:52:51 | 6 | +-------------+----------+---------------------+------+ | P4 | Downtime | 2018-02-15 06:52:51 | 11 | +-------------+----------+---------------------+------+ | P2 | Downtime | 2018-02-15 07:04:16 | 60 | +-------------+----------+---------------------+------+ | P8 | Downtime | 2018-02-15 07:04:16 | 7 | +-------------+----------+---------------------+------+ This is the code I use to achieve my current results: SELECT * FROM( SELECT CAST([start_time] as DATE) AS [DATE], State, Sum(Tim

how StormCrawler identifies seed urls?

Image
Clash Royale CLAN TAG #URR8PPP how StormCrawler identifies seed urls? I am using storm crawler with mysql. I have 100 seed urls but my buffer size is 50 only. what will happen if the outlinks from some seeds fall in bucket number zero . In that case will those outlinks also be treated as seed? how storm crawler diffrentiates seed urls from other urls? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Why “android:tint” doesn't set any color to checkbox

Image
Clash Royale CLAN TAG #URR8PPP Why “android:tint” doesn't set any color to checkbox So this is it. I have to set my drawable in android:button . Nor android:tint , neither android:buttonTint change the color of checkbox image. android:button android:tint android:buttonTint By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How to install Openpyxl with pip

Image
Clash Royale CLAN TAG #URR8PPP How to install Openpyxl with pip I have windows 10 (64 bit). I want to utilize the Openpyxl package to start learning how to interact with excel and other spreadsheets. Openpyxl I installed Python with "windowsx86-64web-basedinstaller" I have a 64 bit OS, was I mistaken when trying to install this version? "windowsx86-64web-basedinstaller" Have tried pip install openpyxl . – shivsn Jul 14 '16 at 6:38 pip install openpyxl 5 Answers 5 You need to ensure that C:Python35Sripts is in your system path. Follow the top answer instructions here to do that: C:Python35Sripts You run the command in windows command prompt, not in the python interpreter that you have open. Press: Win + R Type CMD in the run window which has opened CMD Type pip install openpyxl in windows command prompt. pip install openpyxl I had to do: c:Usersxxxx>c:/python27/scripts/pip install openpyxl I had to save the openpyxl files in the scr

What are the mkusb options “msdos”, “upefi” and “d-n-i”?

Image
Clash Royale CLAN TAG #URR8PPP What are the mkusb options “msdos”, “upefi” and “d-n-i”? I'm trying to create a persistent live Ubuntu bootable USB drive using mkusb. In the "Persistent live drive settings" I have the options "msdos", "upefi" and "d-n-i", and also have the buttons "Use defaults" and "OK". Unfortunately, I couldn't find in the wiki nor the manual what each item or the "Use defaults" button does. Clicking "Use defaults" is the same as clicking "OK" without any item selected? And what is the meaning of each item? When should (or shouldn't) each one be used? I'm sure @sudodus will help out here. He's the developer of mkusb and very active here. – DK Bose 5 hours ago I just about always choose "Use defaults" with mkusb. That way the flash drive will boot in BIOS or UEFI. msdos chooses the type of partition table to use, upefi chooses the gru

PostgreSQL: Declare a cursor for prepared statement

Image
Clash Royale CLAN TAG #URR8PPP PostgreSQL: Declare a cursor for prepared statement The following DECLARE fails: DECLARE PREPARE stmt(bigint) AS SELECT ...; DECLARE crs CURSOR FOR stmt; According to https://www.postgresql.org/docs/9.6/static/sql-declare.html, stmt has to be either SELECT or VALUES command. stmt SELECT VALUES I use PREPARE statement in a latency-critical section of the code in which thousands of quick queries are emitted. Parsing and generating a query plan each time would be performance killer. However, in some rare cases the query can return millions of records and the result doesn't fit into memory. PREPARE Is there a way to declare a cursor for prepared statement in PostgreSQL? If not, are there any workarounds? prepared stmt is for "Any SELECT, INSERT, UPDATE, DELETE, or VALUES statement." and cant be used with cursors. your question is if you can somehow FETCH from prepared select?.. – Vao Tsun Jan 12 at 16:19 FETCH That's rig

website using divi - wordpress working on google chrome but no safari

Image
Clash Royale CLAN TAG #URR8PPP website using divi - wordpress working on google chrome but no safari I have been working on a website using divi - wordpress and seems to work well on google chrome. The sad thing is that I opened safari and all the blocks and everything are moved or above each other and there's even some elements that you can't even see (like the contact form for example). I'm very new with creating websites so I don't really know what could be creating this visual bug on safari. I tried to look some info on google and divi blogs etc but I haven't find any answer so far. Is there someone that has been in a similar situation before or that know about this kind of browser issues that could give me some advice? Thank you so much for your time and your help ! here the website : http://231e47.com/accueil-cf/ 1 Answer 1 I believe your issue is with Autoptomize. When it tries to aggregate and minify Divi's js, it often creates issues. Deactiva

Login to website redirect to url and get htmlsource of new page?

Image
Clash Royale CLAN TAG #URR8PPP Login to website redirect to url and get htmlsource of new page? I'm trying to get html source after login a website with a userdata, but It doesn't give me html source of the new page It gives me login page htmlsource. So where is the problem in my source code?On the website it redirects me to a server select page after login "lobby.ogame.gameforge.com/?language=tr"; I'm trying to get html source of this page. And this is my code; public void button1_Click(object sender, EventArgs e) string URI = "https://tr.ogame.gameforge.com/"; string myParameters = "login=testusername&pass=testpassword"; using (WebClient wc = new WebClient()) wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; string HtmlResult = wc.UploadString(URI, myParameters); richTextBox1.Text = HtmlResult; Username and password are not sent via URL parameters to log you into a website. If they